This repository was archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput.dto.ts
More file actions
125 lines (87 loc) · 3.19 KB
/
Copy pathoutput.dto.ts
File metadata and controls
125 lines (87 loc) · 3.19 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import type { email } from '#types';
import type { OutputUserRoleDto, OutputUserVisibilityDto, OutputBaseUserDto } from '#types/api';
import { ApiProperty } from '@nestjs/swagger';
import { OutputUserDto, PERMISSION_NAMES, GENDERS } from '#types/api';
import { USER_GENDER } from '@exported/api/constants/genders';
import { PERMISSIONS_NAMES } from '@exported/api/constants/perms';
import { OutputBaseDTO } from '@modules/base/dto/output.dto';
export class OutputBaseUserDTO extends OutputBaseDTO implements OutputBaseUserDto {
@ApiProperty()
first_name: string;
@ApiProperty()
last_name: string;
@ApiProperty({ required: false })
nickname?: string;
}
export class OutputUserRoleDTO extends OutputBaseDTO implements OutputUserRoleDto {
@ApiProperty({ required: true, type: Date, example: new Date().toISOString() })
expires: Date;
@ApiProperty({ required: true, example: 'AE_ADMINS' })
name: Uppercase<string>;
@ApiProperty({ required: true, type: Boolean, default: false })
revoked: boolean;
@ApiProperty({ enum: PERMISSIONS_NAMES, isArray: true })
permissions: Array<PERMISSION_NAMES>;
}
export class OutputUserDTO extends OutputBaseDTO implements OutputUserDto {
@ApiProperty({ example: 'John' })
first_name: string;
@ApiProperty({ example: 'Doe' })
last_name: string;
@ApiProperty({ example: 'John Doe' })
full_name: string;
@ApiProperty({ minimum: 1, required: false })
picture?: number;
@ApiProperty({ minimum: 1, required: false })
banner?: number;
@ApiProperty({ type: String, example: 'example@domain.com', required: false })
email?: email;
@ApiProperty({ type: Boolean, default: false })
email_verified?: boolean;
@ApiProperty({ example: new Date('1999-12-31').toISOString() })
birth_date?: Date;
@ApiProperty({ example: 21 })
age: number;
@ApiProperty()
is_minor: boolean;
@ApiProperty({ required: false })
nickname?: string;
@ApiProperty({ example: USER_GENDER[0], enum: USER_GENDER })
gender?: GENDERS;
@ApiProperty({ example: null })
pronouns?: string;
@ApiProperty({ minimum: 1 })
promotion?: number;
@ApiProperty({ example: new Date().toISOString() })
last_seen?: Date;
@ApiProperty({ example: false })
subscribed: boolean; // TODO: (KEY: 2) Make a PR to implement subscriptions in the API
@ApiProperty({ required: false })
secondary_email?: email;
@ApiProperty({ required: false })
phone?: string;
@ApiProperty({ required: false })
parents_phone?: string;
@ApiProperty({ type: Date, example: new Date().toISOString(), required: false })
verified?: Date;
}
export class OutputUserVisibilityDTO extends OutputBaseDTO implements OutputUserVisibilityDto {
@ApiProperty({ minimum: 1 })
user_id: number;
@ApiProperty({ type: Boolean, default: false })
email: boolean;
@ApiProperty({ type: Boolean, default: false })
secondary_email: boolean;
@ApiProperty({ type: Boolean, default: true })
birth_date: boolean;
@ApiProperty({ type: Boolean, default: false })
gender: boolean;
@ApiProperty({ type: Boolean, default: false })
pronouns: boolean;
@ApiProperty({ type: Boolean, default: true })
promotion: boolean;
@ApiProperty({ type: Boolean, default: false })
phone: boolean;
@ApiProperty({ type: Boolean, default: false })
parents_phone: boolean;
}