~~~typescript
import { property, expose, IMQService } from '@imqueue/rpc';
class Address {
@property('string')
country: string;
@property('string')
city: string;
@property('string')
address: string;
@property('string', true)
zipCode?: string; // this is optional
}
class User {
@property('string')
firstName: string;
@property('string')
lastName: string;
@property('string')
email: string;
@property('Array<Address>', true)
address?: Array<Address>;
}
// now we can use those complex types as service methods args
// and them will be properly exposed to service clients
class UserService extends IMQService {
@expose()
public save(user: User) {
// do smth with given user data to persis it
}
@expose()
public find(id: number): User {
// find and return user
}
}
~~~
Implements '@property' decorator factory This is used to specify complex service types to be exposed