ApiLink
Defines this route as a link between two types
@ApiLink(__0: ApiLinkOptions)
Parameters
| Option | Type | Description |
|---|---|---|
__0
|
ApiLinkOptions |
Returns
MethodDecorator
See also
Description
Typically used when the link between the types is not present in the from type,
eg with the following
class User {
@ApiProperty()
id: string
// no field documentIds: string[]
}
class Document {
@ApiProperty()
id: string
}
@Controller()
class UserController {
@Get(':userId/documents')
@ApiLink({from: User, fromField: 'id', routeParam: 'userId'})
getDocuments(@Param('userId') userId: string)): Promise<Documents[]>
}