@nestjs/swagger#PartialType TypeScript Examples

The following examples show how to use @nestjs/swagger#PartialType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: update-user-dto.ts    From nestjs-starter with MIT License 6 votes vote down vote up
// TODO: sintetizar esto porque a lo mejor los tipados estan demas
export class UpdateUserDto extends PartialType(OmitType(CreateUserDto, ['email', 'username', 'metadata'])) {
  @ApiProperty()
  @IsOptional()
  id?: number;

  @ApiProperty()
  @IsEmailAlreadyExist({ message: 'Email $value already exists. Choose another Email.' })
  @IsEmail()
  @IsString()
  @IsOptional()
  email: string;

  @ApiProperty()
  @IsUsernameAlreadyExist({ message: 'Username $value already exists. Choose another username.' })
  @IsString()
  @MinLength(8)
  @MaxLength(20)
  @Matches(PATTERN_VALID_USERNAME, {
    message: `Username $value don't have a valid format`,
  })
  @IsOptional()
  username: string;

  @ApiProperty()
  @IsString()
  @IsOptional()
  password: string;
}
Example #2
Source File: update-user.dto.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
export default class UpdateUserDto extends PartialType(SignUpDto) {
  @ApiPropertyOptional({
    type: Boolean,
  })
  @IsOptional()
  @IsBoolean()
  readonly verified: boolean = false;
}
Example #3
Source File: sign-in.dto.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
export default class SignInDto extends PartialType(SignUpDto) {}
Example #4
Source File: update-contact-address.dto.ts    From nestjs-starter with MIT License 5 votes vote down vote up
export class UpdateContactAddressDto extends PartialType(CreateContactAddressDto) {
  line1: string;
  city: string;
  state: string;
  zip: string;
  country: string;
}
Example #5
Source File: update-contact-phone.dto.ts    From nestjs-starter with MIT License 5 votes vote down vote up
export class UpdateContactPhoneDto extends PartialType(CreateContactPhoneDto) {
  phone: string;
}
Example #6
Source File: update-user-metadata.dto.ts    From nestjs-starter with MIT License 5 votes vote down vote up
export class UpdateUserMetadataDto extends PartialType(CreateUserMetadataDto) {}