@pixelplex/api-decorators
v0.4.5
Published
Set of decorators that can simplify DTO creation.
Readme
Nest.js API Decorators
Set of decorators that can simplify DTO creation.
Install the library
yarn add @pixelplex/api-decoratorsUse the library
Example of usage
import { ApiPropertyString, ApiPropertyArray } from '@pixelplex/api-decorators';
export class MyBodyDTO {
@ApiPropertyString()
comment: string;
@ApiPropertyArray({ type: 'enum', enumValue: USER_ROLE, isNotEmpty: true, isUnique: true })
roles: USER_ROLE[];
}List of decorators:
ApiPropertyArray
ApiPropertyBigint
ApiPropertyBoolean
ApiPropertyDate
ApiPropertyEmail
ApiPropertyEnum
ApiPropertyFloat
ApiPropertyHash
ApiPropertyId
ApiPropertyJwt
ApiPropertyNumber
ApiPropertyPassword
ApiPropertyPhoneNumber
ApiPropertyString