forked from Sairyss/domain-driven-hexagon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-user.request.dto.ts
47 lines (43 loc) · 1.27 KB
/
create-user.request.dto.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { CreateUser } from '@src/interface-adapters/interfaces/user/create.user.interface';
import { ApiProperty } from '@nestjs/swagger';
import { ArgsType, Field, InputType } from '@nestjs/graphql';
import {
IsAlphanumeric,
IsEmail,
IsString,
Matches,
MaxLength,
MinLength,
} from 'class-validator';
@ArgsType() // <- only if you are using GraphQL
@InputType() // <- only if you are using GraphQL
export class CreateUserRequest implements CreateUser {
@ApiProperty({
example: '[email protected]',
description: 'User email address',
})
@MaxLength(320)
@MinLength(5)
@IsEmail()
@Field() // <- only if you are using graphql
readonly email: string;
@ApiProperty({ example: 'France', description: 'Country of residence' })
@MaxLength(50)
@MinLength(4)
@IsString()
@Matches(/^[a-zA-Z ]*$/)
@Field() // <- only if you are using graphql
readonly country: string;
@ApiProperty({ example: '28566', description: 'Postal code' })
@MaxLength(10)
@MinLength(4)
@IsAlphanumeric()
@Field() // <- only if you are using graphql
readonly postalCode: string;
@ApiProperty({ example: 'Grande Rue', description: 'Street' })
@MaxLength(50)
@MinLength(5)
@Matches(/^[a-zA-Z ]*$/)
@Field() // <- only if you are using graphql
readonly street: string;
}