-
Notifications
You must be signed in to change notification settings - Fork 70
/
user-view.model.ts
157 lines (136 loc) · 2.5 KB
/
user-view.model.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// Copyright (c) 2023 Sourcefuse Technologies
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
import {DataObject, Model, model, property} from '@loopback/repository';
import {Gender, UserModifiableEntity, UserStatus} from '@sourceloop/core';
@model({
name: 'v_users',
description: 'User details view in DB',
settings: {
defaultIdSort: false,
},
})
export class UserView<T = DataObject<Model>> extends UserModifiableEntity<
T & UserView
> {
@property({
type: 'string',
id: true,
generated: false,
})
id?: string;
@property({
type: 'string',
required: true,
name: 'first_name',
})
firstName: string;
@property({
type: 'string',
name: 'last_name',
})
lastName: string;
@property({
type: 'string',
name: 'middle_name',
})
middleName?: string;
@property({
type: 'string',
required: true,
})
username: string;
@property({
type: 'string',
required: true,
})
email: string;
@property({
type: 'string',
})
designation?: string;
@property({
type: 'string',
})
phone?: string;
@property({
type: 'string',
name: 'auth_client_ids',
})
authClientIds: string;
@property({
name: 'last_login',
type: 'string',
})
lastLogin?: string;
@property({
name: 'photo_url',
type: 'string',
})
photoUrl?: string;
@property({
type: 'string',
description: `This field takes a single character as input in database.
'M' for male and 'F' for female.`,
jsonSchema: {
enum: ['M', 'F', 'O'],
},
})
gender?: Gender;
@property({
type: 'date',
jsonSchema: {
nullable: true,
},
})
dob?: Date;
@property({
type: 'string',
name: 'default_tenant_id',
required: true,
})
defaultTenantId: string;
@property({
type: 'number',
jsonSchema: {
maximum: 11,
minimum: 0,
},
})
status?: UserStatus;
@property({
type: 'string',
name: 'tenant_id',
required: true,
})
tenantId: string;
@property({
type: 'string',
name: 'role_id',
required: true,
})
roleId: string;
@property({
name: 'name',
type: 'string',
required: true,
})
tenantName: string;
@property({
name: 'key',
type: 'string',
})
tenantKey?: string;
@property({
name: 'rolename',
type: 'string',
})
roleName?: string;
@property({
name: 'user_tenant_id',
type: 'string',
required: true,
})
userTenantId: string;
}