-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
create-notification.dto.ts
39 lines (33 loc) · 1.1 KB
/
create-notification.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
import { ApiModelProperty } from '@nestjs/swagger';
import { IsAscii, IsBoolean, IsEnum, IsIn, IsNotEmpty, IsString, MaxLength, MinLength } from 'class-validator';
import { NotificationColor, NotificationIcon } from '../notification.entity';
export class CreateNotificationDto {
@ApiModelProperty({ type: String, enum: NotificationIcon, default: 'notifications' })
@IsString()
@IsNotEmpty()
@IsEnum(NotificationIcon)
icon: NotificationIcon;
@ApiModelProperty({ type: String, minLength: 10, maxLength: 100 })
@IsString()
@IsNotEmpty()
message: string;
@ApiModelProperty({ type: Boolean, default: false })
@IsBoolean()
@IsNotEmpty()
read: boolean = false;
@ApiModelProperty({ type: String, enum: NotificationColor })
@IsString()
@IsNotEmpty()
@IsIn(['warn', 'accent', 'primary'])
color?: NotificationColor;
@ApiModelProperty({ type: String, minLength: 8, maxLength: 20, default: 'all' })
@IsAscii()
@IsNotEmpty()
@MinLength(3)
@MaxLength(20)
userId: string;
@ApiModelProperty({ type: Boolean, default: false })
@IsBoolean()
@IsNotEmpty()
public native = false;
}