@grapadigital/shared-schemas 1.0.173 → 1.0.175
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/schemas/client.schema.d.ts +2 -2
- package/dist/schemas/client.schema.js +2 -2
- package/dist/schemas/group.schema.d.ts +43 -0
- package/dist/schemas/group.schema.js +34 -0
- package/dist/schemas/influencer.schema.d.ts +2 -2
- package/dist/schemas/influencer.schema.js +2 -2
- package/dist/schemas/organization.schema.d.ts +45 -0
- package/dist/schemas/organization.schema.js +41 -0
- package/dist/schemas/party.schema.d.ts +116 -0
- package/dist/schemas/party.schema.js +175 -0
- package/dist/schemas/supplier.schema.d.ts +2 -2
- package/dist/schemas/supplier.schema.js +2 -2
- package/dist/schemas/trigger.schema.d.ts +53 -0
- package/dist/schemas/trigger.schema.js +65 -0
- package/dist/schemas/user.schema.d.ts +23 -78
- package/dist/schemas/user.schema.js +38 -143
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/schemas/client.schema.ts +2 -2
- package/src/schemas/group.schema.ts +23 -0
- package/src/schemas/influencer.schema.ts +2 -2
- package/src/schemas/organization.schema.ts +29 -0
- package/src/schemas/party.schema.ts +65 -0
- package/src/schemas/supplier.schema.ts +2 -2
- package/src/schemas/trigger.schema.ts +48 -0
- package/src/schemas/user.schema.ts +31 -107
|
@@ -1,130 +1,54 @@
|
|
|
1
1
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
-
import { HydratedDocument,
|
|
2
|
+
import { HydratedDocument, Types } from 'mongoose';
|
|
3
3
|
|
|
4
4
|
export type UserDocument = HydratedDocument<User>;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
city: string;
|
|
13
|
-
|
|
14
|
-
@Prop()
|
|
15
|
-
state: string;
|
|
16
|
-
|
|
17
|
-
@Prop()
|
|
18
|
-
street: string;
|
|
19
|
-
|
|
20
|
-
@Prop()
|
|
21
|
-
number: string;
|
|
22
|
-
|
|
23
|
-
@Prop()
|
|
24
|
-
complement: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const AddressSchema = SchemaFactory.createForClass(Address);
|
|
28
|
-
|
|
29
|
-
@Schema({ _id: false })
|
|
30
|
-
export class Company {
|
|
31
|
-
@Prop()
|
|
32
|
-
legalName: string;
|
|
33
|
-
|
|
34
|
-
@Prop()
|
|
35
|
-
document: string;
|
|
36
|
-
|
|
37
|
-
@Prop()
|
|
38
|
-
bank: string;
|
|
39
|
-
|
|
40
|
-
@Prop()
|
|
41
|
-
agency: string;
|
|
42
|
-
|
|
43
|
-
@Prop()
|
|
44
|
-
account: string;
|
|
45
|
-
|
|
46
|
-
@Prop()
|
|
47
|
-
digit: string;
|
|
48
|
-
|
|
49
|
-
@Prop()
|
|
50
|
-
pix: string;
|
|
51
|
-
|
|
52
|
-
@Prop()
|
|
53
|
-
email: string;
|
|
54
|
-
|
|
55
|
-
@Prop({ required: false })
|
|
56
|
-
omieGrapaId?: string;
|
|
57
|
-
|
|
58
|
-
@Prop({ required: false })
|
|
59
|
-
omieOmaId?: string;
|
|
60
|
-
|
|
61
|
-
|
|
6
|
+
export enum OrganizationTeam {
|
|
7
|
+
SERVICE = 'service',
|
|
8
|
+
ADMIN = 'admin',
|
|
9
|
+
ARTISTIC = 'artistic',
|
|
10
|
+
FINANCIAL = 'financial',
|
|
11
|
+
COMERCIAL = 'comercial',
|
|
62
12
|
}
|
|
63
13
|
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
rg: string;
|
|
70
|
-
|
|
71
|
-
@Prop()
|
|
72
|
-
cpf: string;
|
|
73
|
-
|
|
74
|
-
@Prop()
|
|
75
|
-
birthday: Date;
|
|
76
|
-
|
|
77
|
-
@Prop()
|
|
78
|
-
maritalStatus: string;
|
|
79
|
-
|
|
80
|
-
@Prop()
|
|
81
|
-
nationality: string;
|
|
82
|
-
|
|
83
|
-
@Prop()
|
|
84
|
-
profession: string;
|
|
14
|
+
export enum UserRole {
|
|
15
|
+
ADMIN = 'admin',
|
|
16
|
+
USER = 'user',
|
|
17
|
+
CLIENT = 'client',
|
|
18
|
+
INFLUENCER = 'influencer',
|
|
85
19
|
}
|
|
86
20
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@Schema({ timestamps: true })
|
|
21
|
+
@Schema({ timestamps: true, collection: 'user' })
|
|
90
22
|
export class User {
|
|
91
|
-
@Prop({ type:
|
|
92
|
-
|
|
23
|
+
@Prop({ type: Types.ObjectId, ref: 'Organization', required: true, index: true })
|
|
24
|
+
organization: Types.ObjectId;
|
|
93
25
|
|
|
94
|
-
@Prop()
|
|
95
|
-
|
|
26
|
+
@Prop({ required: true, trim: true, lowercase: true, index: true })
|
|
27
|
+
email: string;
|
|
96
28
|
|
|
97
|
-
@Prop({ required:
|
|
98
|
-
|
|
29
|
+
@Prop({ required: true, trim: true })
|
|
30
|
+
name: string;
|
|
99
31
|
|
|
100
|
-
@Prop({ required:
|
|
101
|
-
|
|
32
|
+
@Prop({ required: true, trim: true })
|
|
33
|
+
username: string;
|
|
102
34
|
|
|
103
|
-
@Prop({
|
|
104
|
-
|
|
35
|
+
@Prop({ enum: OrganizationTeam })
|
|
36
|
+
team?: OrganizationTeam;
|
|
105
37
|
|
|
106
|
-
@Prop({
|
|
107
|
-
|
|
38
|
+
@Prop({ enum: UserRole })
|
|
39
|
+
role?: UserRole;
|
|
108
40
|
|
|
109
|
-
@Prop({
|
|
110
|
-
|
|
41
|
+
@Prop({ trim: true })
|
|
42
|
+
firebaseUid?: string;
|
|
111
43
|
|
|
112
|
-
@Prop({
|
|
113
|
-
|
|
44
|
+
@Prop({ default: false })
|
|
45
|
+
disabled?: boolean;
|
|
114
46
|
|
|
115
|
-
@Prop({ default: Date.now, required: false })
|
|
116
47
|
createdAt?: Date;
|
|
117
|
-
|
|
118
|
-
@Prop({ default: Date.now, required: false })
|
|
119
48
|
updatedAt?: Date;
|
|
120
49
|
}
|
|
121
50
|
|
|
122
51
|
export const UserSchema = SchemaFactory.createForClass(User);
|
|
123
52
|
|
|
124
|
-
UserSchema.index({
|
|
125
|
-
UserSchema.index({
|
|
126
|
-
UserSchema.index({ 'company.legalName': 1 });
|
|
127
|
-
UserSchema.index({ createdAt: -1 });
|
|
128
|
-
|
|
129
|
-
export const UserModel = MongooseModel('User', UserSchema);
|
|
130
|
-
|
|
53
|
+
UserSchema.index({ organization: 1, email: 1 }, { unique: true });
|
|
54
|
+
UserSchema.index({ organization: 1, username: 1 }, { unique: true });
|