@grapadigital/shared-schemas 1.0.172 → 1.0.174
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/action.schema.d.ts +2 -0
- package/dist/schemas/action.schema.js +6 -0
- package/dist/schemas/campaign.schema.d.ts +3 -0
- package/dist/schemas/campaign.schema.js +12 -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/notifications.schema.d.ts +69 -0
- package/dist/schemas/notifications.schema.js +90 -0
- 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/task.schema.d.ts +2 -3
- package/dist/schemas/task.schema.js +12 -12
- 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/action.schema.ts +4 -0
- package/src/schemas/campaign.schema.ts +8 -1
- 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/notifications.schema.ts +61 -0
- 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/task.schema.ts +13 -13
- package/src/schemas/user.schema.ts +31 -107
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PartyModel = exports.PartySchema = exports.Party = exports.IndividualSchema = exports.Individual = exports.CompanySchema = exports.Company = exports.AddressSchema = exports.Address = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
let Address = class Address {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, mongoose_1.Prop)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], Address.prototype, "zipcode", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], Address.prototype, "city", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)(),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Address.prototype, "state", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], Address.prototype, "street", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, mongoose_1.Prop)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], Address.prototype, "number", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], Address.prototype, "complement", void 0);
|
|
41
|
+
Address = __decorate([
|
|
42
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
43
|
+
], Address);
|
|
44
|
+
exports.Address = Address;
|
|
45
|
+
exports.AddressSchema = mongoose_1.SchemaFactory.createForClass(Address);
|
|
46
|
+
let Company = class Company {
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, mongoose_1.Prop)(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], Company.prototype, "legalName", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, mongoose_1.Prop)(),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], Company.prototype, "document", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, mongoose_1.Prop)(),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], Company.prototype, "bank", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, mongoose_1.Prop)(),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], Company.prototype, "agency", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, mongoose_1.Prop)(),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], Company.prototype, "account", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, mongoose_1.Prop)(),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], Company.prototype, "digit", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, mongoose_1.Prop)(),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], Company.prototype, "pix", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, mongoose_1.Prop)(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], Company.prototype, "email", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], Company.prototype, "omieGrapaId", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], Company.prototype, "omieOmaId", void 0);
|
|
88
|
+
Company = __decorate([
|
|
89
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
90
|
+
], Company);
|
|
91
|
+
exports.Company = Company;
|
|
92
|
+
exports.CompanySchema = mongoose_1.SchemaFactory.createForClass(Company);
|
|
93
|
+
let Individual = class Individual {
|
|
94
|
+
};
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, mongoose_1.Prop)(),
|
|
97
|
+
__metadata("design:type", String)
|
|
98
|
+
], Individual.prototype, "rg", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, mongoose_1.Prop)(),
|
|
101
|
+
__metadata("design:type", String)
|
|
102
|
+
], Individual.prototype, "cpf", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, mongoose_1.Prop)(),
|
|
105
|
+
__metadata("design:type", Date)
|
|
106
|
+
], Individual.prototype, "birthday", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, mongoose_1.Prop)(),
|
|
109
|
+
__metadata("design:type", String)
|
|
110
|
+
], Individual.prototype, "maritalStatus", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, mongoose_1.Prop)(),
|
|
113
|
+
__metadata("design:type", String)
|
|
114
|
+
], Individual.prototype, "nationality", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, mongoose_1.Prop)(),
|
|
117
|
+
__metadata("design:type", String)
|
|
118
|
+
], Individual.prototype, "profession", void 0);
|
|
119
|
+
Individual = __decorate([
|
|
120
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
121
|
+
], Individual);
|
|
122
|
+
exports.Individual = Individual;
|
|
123
|
+
exports.IndividualSchema = mongoose_1.SchemaFactory.createForClass(Individual);
|
|
124
|
+
let Party = class Party {
|
|
125
|
+
};
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
128
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
129
|
+
], Party.prototype, "_id", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, mongoose_1.Prop)(),
|
|
132
|
+
__metadata("design:type", String)
|
|
133
|
+
], Party.prototype, "name", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], Party.prototype, "email", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
140
|
+
__metadata("design:type", String)
|
|
141
|
+
], Party.prototype, "phone", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
144
|
+
__metadata("design:type", String)
|
|
145
|
+
], Party.prototype, "picture", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, mongoose_1.Prop)({ type: exports.AddressSchema, required: false }),
|
|
148
|
+
__metadata("design:type", Address)
|
|
149
|
+
], Party.prototype, "address", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, mongoose_1.Prop)({ type: exports.CompanySchema, required: false }),
|
|
152
|
+
__metadata("design:type", Company)
|
|
153
|
+
], Party.prototype, "company", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, mongoose_1.Prop)({ type: exports.IndividualSchema, required: false }),
|
|
156
|
+
__metadata("design:type", Individual)
|
|
157
|
+
], Party.prototype, "individual", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, mongoose_1.Prop)({ default: Date.now, required: false }),
|
|
160
|
+
__metadata("design:type", Date)
|
|
161
|
+
], Party.prototype, "createdAt", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, mongoose_1.Prop)({ default: Date.now, required: false }),
|
|
164
|
+
__metadata("design:type", Date)
|
|
165
|
+
], Party.prototype, "updatedAt", void 0);
|
|
166
|
+
Party = __decorate([
|
|
167
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
168
|
+
], Party);
|
|
169
|
+
exports.Party = Party;
|
|
170
|
+
exports.PartySchema = mongoose_1.SchemaFactory.createForClass(Party);
|
|
171
|
+
exports.PartySchema.index({ name: 1 });
|
|
172
|
+
exports.PartySchema.index({ 'company.document': 1 });
|
|
173
|
+
exports.PartySchema.index({ 'company.legalName': 1 });
|
|
174
|
+
exports.PartySchema.index({ createdAt: -1 });
|
|
175
|
+
exports.PartyModel = (0, mongoose_2.model)('Party', exports.PartySchema);
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
26
|
import { HydratedDocument } from 'mongoose';
|
|
27
|
-
import {
|
|
27
|
+
import { Party } from './party.schema';
|
|
28
28
|
export type SupplierDocument = HydratedDocument<Supplier>;
|
|
29
|
-
export declare class Supplier extends
|
|
29
|
+
export declare class Supplier extends Party {
|
|
30
30
|
}
|
|
31
31
|
export declare const SupplierSchema: import("mongoose").Schema<Supplier, import("mongoose").Model<Supplier, any, any, any, import("mongoose").Document<unknown, any, Supplier, any, {}> & Supplier & Required<{
|
|
32
32
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.SupplierModel = exports.SupplierSchema = exports.Supplier = void 0;
|
|
10
10
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
11
11
|
const mongoose_2 = require("mongoose");
|
|
12
|
-
const
|
|
13
|
-
let Supplier = class Supplier extends
|
|
12
|
+
const party_schema_1 = require("./party.schema");
|
|
13
|
+
let Supplier = class Supplier extends party_schema_1.Party {
|
|
14
14
|
};
|
|
15
15
|
Supplier = __decorate([
|
|
16
16
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
@@ -36,8 +36,7 @@ export type TaskFormat = (typeof TASK_FORMAT_VALUES)[number];
|
|
|
36
36
|
export declare const TASK_TYPE_VALUES: readonly ["briefing", "script", "production", "posting", "analytics", "diagnosis"];
|
|
37
37
|
export type TaskType = (typeof TASK_TYPE_VALUES)[number];
|
|
38
38
|
export declare const TASK_STATUS_BY_TYPE: Record<TaskType, string[]>;
|
|
39
|
-
export
|
|
40
|
-
export type TaskStatus = (typeof TASK_STATUS_VALUES)[number];
|
|
39
|
+
export type TaskStatus = 'awaiting' | 'pending' | 'late' | 'done' | 'cancelled' | 'approval' | 'rework';
|
|
41
40
|
export declare class Task {
|
|
42
41
|
_id?: Types.ObjectId;
|
|
43
42
|
recruitment: Types.ObjectId | Recruitment;
|
|
@@ -49,7 +48,7 @@ export declare class Task {
|
|
|
49
48
|
format?: TaskFormat;
|
|
50
49
|
sequence: number;
|
|
51
50
|
type: TaskType;
|
|
52
|
-
status:
|
|
51
|
+
status: string;
|
|
53
52
|
link?: string;
|
|
54
53
|
dueDate?: Date | null;
|
|
55
54
|
contentId?: Types.ObjectId | Content;
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TaskModel = exports.TaskSchema = exports.Task = exports.
|
|
12
|
+
exports.TaskModel = exports.TaskSchema = exports.Task = exports.TASK_STATUS_BY_TYPE = exports.TASK_TYPE_VALUES = exports.TASK_FORMAT_VALUES = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const swagger_1 = require("@nestjs/swagger");
|
|
15
15
|
const mongoose_2 = require("mongoose");
|
|
@@ -40,15 +40,6 @@ exports.TASK_STATUS_BY_TYPE = {
|
|
|
40
40
|
analytics: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
41
41
|
diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
|
|
42
42
|
};
|
|
43
|
-
exports.TASK_STATUS_VALUES = [
|
|
44
|
-
'awaiting',
|
|
45
|
-
'pending',
|
|
46
|
-
'late',
|
|
47
|
-
'done',
|
|
48
|
-
'approval',
|
|
49
|
-
'rework',
|
|
50
|
-
'cancelled',
|
|
51
|
-
];
|
|
52
43
|
let Task = class Task {
|
|
53
44
|
};
|
|
54
45
|
__decorate([
|
|
@@ -108,8 +99,17 @@ __decorate([
|
|
|
108
99
|
__metadata("design:type", String)
|
|
109
100
|
], Task.prototype, "type", void 0);
|
|
110
101
|
__decorate([
|
|
111
|
-
(0, swagger_1.ApiProperty)({
|
|
112
|
-
(0, mongoose_1.Prop)({
|
|
102
|
+
(0, swagger_1.ApiProperty)({ example: 'awaiting' }),
|
|
103
|
+
(0, mongoose_1.Prop)({
|
|
104
|
+
type: String,
|
|
105
|
+
required: true,
|
|
106
|
+
validate: {
|
|
107
|
+
validator: function (value) {
|
|
108
|
+
return exports.TASK_STATUS_BY_TYPE[this.type]?.includes(value) ?? false;
|
|
109
|
+
},
|
|
110
|
+
message: 'status inválido para o type da task',
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
113
|
__metadata("design:type", String)
|
|
114
114
|
], Task.prototype, "status", void 0);
|
|
115
115
|
__decorate([
|
|
@@ -23,94 +23,39 @@
|
|
|
23
23
|
/// <reference types="mongoose/types/schematypes" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
-
import { HydratedDocument,
|
|
26
|
+
import { HydratedDocument, Types } from 'mongoose';
|
|
27
27
|
export type UserDocument = HydratedDocument<User>;
|
|
28
|
-
export declare
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
complement: string;
|
|
28
|
+
export declare enum OrganizationTeam {
|
|
29
|
+
SERVICE = "service",
|
|
30
|
+
ADMIN = "admin",
|
|
31
|
+
ARTISTIC = "artistic",
|
|
32
|
+
FINANCIAL = "financial",
|
|
33
|
+
COMERCIAL = "comercial"
|
|
35
34
|
}
|
|
36
|
-
export declare
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_id: Types.ObjectId;
|
|
42
|
-
} & {
|
|
43
|
-
__v: number;
|
|
44
|
-
}>;
|
|
45
|
-
export declare class Company {
|
|
46
|
-
legalName: string;
|
|
47
|
-
document: string;
|
|
48
|
-
bank: string;
|
|
49
|
-
agency: string;
|
|
50
|
-
account: string;
|
|
51
|
-
digit: string;
|
|
52
|
-
pix: string;
|
|
53
|
-
email: string;
|
|
54
|
-
omieGrapaId?: string;
|
|
55
|
-
omieOmaId?: string;
|
|
56
|
-
}
|
|
57
|
-
export declare const CompanySchema: MongooseSchema<Company, import("mongoose").Model<Company, any, any, any, import("mongoose").Document<unknown, any, Company, any, {}> & Company & {
|
|
58
|
-
_id: Types.ObjectId;
|
|
59
|
-
} & {
|
|
60
|
-
__v: number;
|
|
61
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Company, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Company>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Company> & {
|
|
62
|
-
_id: Types.ObjectId;
|
|
63
|
-
} & {
|
|
64
|
-
__v: number;
|
|
65
|
-
}>;
|
|
66
|
-
export declare class Individual {
|
|
67
|
-
rg: string;
|
|
68
|
-
cpf: string;
|
|
69
|
-
birthday: Date;
|
|
70
|
-
maritalStatus: string;
|
|
71
|
-
nationality: string;
|
|
72
|
-
profession: string;
|
|
35
|
+
export declare enum UserRole {
|
|
36
|
+
ADMIN = "admin",
|
|
37
|
+
USER = "user",
|
|
38
|
+
CLIENT = "client",
|
|
39
|
+
INFLUENCER = "influencer"
|
|
73
40
|
}
|
|
74
|
-
export declare const IndividualSchema: MongooseSchema<Individual, import("mongoose").Model<Individual, any, any, any, import("mongoose").Document<unknown, any, Individual, any, {}> & Individual & {
|
|
75
|
-
_id: Types.ObjectId;
|
|
76
|
-
} & {
|
|
77
|
-
__v: number;
|
|
78
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Individual, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Individual>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Individual> & {
|
|
79
|
-
_id: Types.ObjectId;
|
|
80
|
-
} & {
|
|
81
|
-
__v: number;
|
|
82
|
-
}>;
|
|
83
41
|
export declare class User {
|
|
84
|
-
|
|
42
|
+
organization: Types.ObjectId;
|
|
43
|
+
email: string;
|
|
85
44
|
name: string;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
individual?: Individual;
|
|
45
|
+
username: string;
|
|
46
|
+
team?: OrganizationTeam;
|
|
47
|
+
role?: UserRole;
|
|
48
|
+
firebaseUid?: string;
|
|
49
|
+
disabled?: boolean;
|
|
92
50
|
createdAt?: Date;
|
|
93
51
|
updatedAt?: Date;
|
|
94
52
|
}
|
|
95
|
-
export declare const UserSchema:
|
|
53
|
+
export declare const UserSchema: import("mongoose").Schema<User, import("mongoose").Model<User, any, any, any, import("mongoose").Document<unknown, any, User, any, {}> & User & {
|
|
96
54
|
_id: Types.ObjectId;
|
|
97
|
-
}
|
|
55
|
+
} & {
|
|
98
56
|
__v: number;
|
|
99
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<User>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<User> &
|
|
57
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<User>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<User> & {
|
|
100
58
|
_id: Types.ObjectId;
|
|
101
|
-
}
|
|
59
|
+
} & {
|
|
102
60
|
__v: number;
|
|
103
61
|
}>;
|
|
104
|
-
export declare const UserModel: import("mongoose").Model<User, {}, {}, {}, import("mongoose").Document<unknown, {}, User, {}, import("mongoose").DefaultSchemaOptions> & User & Required<{
|
|
105
|
-
_id: Types.ObjectId;
|
|
106
|
-
}> & {
|
|
107
|
-
__v: number;
|
|
108
|
-
}, MongooseSchema<User, import("mongoose").Model<User, any, any, any, import("mongoose").Document<unknown, any, User, any, {}> & User & Required<{
|
|
109
|
-
_id: Types.ObjectId;
|
|
110
|
-
}> & {
|
|
111
|
-
__v: number;
|
|
112
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, User, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<User>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<User> & Required<{
|
|
113
|
-
_id: Types.ObjectId;
|
|
114
|
-
}> & {
|
|
115
|
-
__v: number;
|
|
116
|
-
}>>;
|
|
@@ -9,167 +9,62 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.UserSchema = exports.User = exports.UserRole = exports.OrganizationTeam = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
(0, mongoose_1.Prop)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], Address.prototype, "street", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, mongoose_1.Prop)(),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], Address.prototype, "number", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, mongoose_1.Prop)(),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], Address.prototype, "complement", void 0);
|
|
41
|
-
Address = __decorate([
|
|
42
|
-
(0, mongoose_1.Schema)({ _id: false })
|
|
43
|
-
], Address);
|
|
44
|
-
exports.Address = Address;
|
|
45
|
-
exports.AddressSchema = mongoose_1.SchemaFactory.createForClass(Address);
|
|
46
|
-
let Company = class Company {
|
|
47
|
-
};
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, mongoose_1.Prop)(),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], Company.prototype, "legalName", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, mongoose_1.Prop)(),
|
|
54
|
-
__metadata("design:type", String)
|
|
55
|
-
], Company.prototype, "document", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, mongoose_1.Prop)(),
|
|
58
|
-
__metadata("design:type", String)
|
|
59
|
-
], Company.prototype, "bank", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, mongoose_1.Prop)(),
|
|
62
|
-
__metadata("design:type", String)
|
|
63
|
-
], Company.prototype, "agency", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, mongoose_1.Prop)(),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], Company.prototype, "account", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, mongoose_1.Prop)(),
|
|
70
|
-
__metadata("design:type", String)
|
|
71
|
-
], Company.prototype, "digit", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, mongoose_1.Prop)(),
|
|
74
|
-
__metadata("design:type", String)
|
|
75
|
-
], Company.prototype, "pix", void 0);
|
|
76
|
-
__decorate([
|
|
77
|
-
(0, mongoose_1.Prop)(),
|
|
78
|
-
__metadata("design:type", String)
|
|
79
|
-
], Company.prototype, "email", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
(0, mongoose_1.Prop)({ required: false }),
|
|
82
|
-
__metadata("design:type", String)
|
|
83
|
-
], Company.prototype, "omieGrapaId", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, mongoose_1.Prop)({ required: false }),
|
|
86
|
-
__metadata("design:type", String)
|
|
87
|
-
], Company.prototype, "omieOmaId", void 0);
|
|
88
|
-
Company = __decorate([
|
|
89
|
-
(0, mongoose_1.Schema)({ _id: false })
|
|
90
|
-
], Company);
|
|
91
|
-
exports.Company = Company;
|
|
92
|
-
exports.CompanySchema = mongoose_1.SchemaFactory.createForClass(Company);
|
|
93
|
-
let Individual = class Individual {
|
|
94
|
-
};
|
|
95
|
-
__decorate([
|
|
96
|
-
(0, mongoose_1.Prop)(),
|
|
97
|
-
__metadata("design:type", String)
|
|
98
|
-
], Individual.prototype, "rg", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
(0, mongoose_1.Prop)(),
|
|
101
|
-
__metadata("design:type", String)
|
|
102
|
-
], Individual.prototype, "cpf", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
(0, mongoose_1.Prop)(),
|
|
105
|
-
__metadata("design:type", Date)
|
|
106
|
-
], Individual.prototype, "birthday", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
(0, mongoose_1.Prop)(),
|
|
109
|
-
__metadata("design:type", String)
|
|
110
|
-
], Individual.prototype, "maritalStatus", void 0);
|
|
111
|
-
__decorate([
|
|
112
|
-
(0, mongoose_1.Prop)(),
|
|
113
|
-
__metadata("design:type", String)
|
|
114
|
-
], Individual.prototype, "nationality", void 0);
|
|
115
|
-
__decorate([
|
|
116
|
-
(0, mongoose_1.Prop)(),
|
|
117
|
-
__metadata("design:type", String)
|
|
118
|
-
], Individual.prototype, "profession", void 0);
|
|
119
|
-
Individual = __decorate([
|
|
120
|
-
(0, mongoose_1.Schema)({ _id: false })
|
|
121
|
-
], Individual);
|
|
122
|
-
exports.Individual = Individual;
|
|
123
|
-
exports.IndividualSchema = mongoose_1.SchemaFactory.createForClass(Individual);
|
|
15
|
+
var OrganizationTeam;
|
|
16
|
+
(function (OrganizationTeam) {
|
|
17
|
+
OrganizationTeam["SERVICE"] = "service";
|
|
18
|
+
OrganizationTeam["ADMIN"] = "admin";
|
|
19
|
+
OrganizationTeam["ARTISTIC"] = "artistic";
|
|
20
|
+
OrganizationTeam["FINANCIAL"] = "financial";
|
|
21
|
+
OrganizationTeam["COMERCIAL"] = "comercial";
|
|
22
|
+
})(OrganizationTeam = exports.OrganizationTeam || (exports.OrganizationTeam = {}));
|
|
23
|
+
var UserRole;
|
|
24
|
+
(function (UserRole) {
|
|
25
|
+
UserRole["ADMIN"] = "admin";
|
|
26
|
+
UserRole["USER"] = "user";
|
|
27
|
+
UserRole["CLIENT"] = "client";
|
|
28
|
+
UserRole["INFLUENCER"] = "influencer";
|
|
29
|
+
})(UserRole = exports.UserRole || (exports.UserRole = {}));
|
|
124
30
|
let User = class User {
|
|
125
31
|
};
|
|
126
32
|
__decorate([
|
|
127
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.
|
|
33
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Types.ObjectId, ref: 'Organization', required: true, index: true }),
|
|
128
34
|
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
129
|
-
], User.prototype, "
|
|
35
|
+
], User.prototype, "organization", void 0);
|
|
130
36
|
__decorate([
|
|
131
|
-
(0, mongoose_1.Prop)(),
|
|
132
|
-
__metadata("design:type", String)
|
|
133
|
-
], User.prototype, "name", void 0);
|
|
134
|
-
__decorate([
|
|
135
|
-
(0, mongoose_1.Prop)({ required: false }),
|
|
37
|
+
(0, mongoose_1.Prop)({ required: true, trim: true, lowercase: true, index: true }),
|
|
136
38
|
__metadata("design:type", String)
|
|
137
39
|
], User.prototype, "email", void 0);
|
|
138
40
|
__decorate([
|
|
139
|
-
(0, mongoose_1.Prop)({ required:
|
|
41
|
+
(0, mongoose_1.Prop)({ required: true, trim: true }),
|
|
140
42
|
__metadata("design:type", String)
|
|
141
|
-
], User.prototype, "
|
|
43
|
+
], User.prototype, "name", void 0);
|
|
142
44
|
__decorate([
|
|
143
|
-
(0, mongoose_1.Prop)({ required:
|
|
45
|
+
(0, mongoose_1.Prop)({ required: true, trim: true }),
|
|
144
46
|
__metadata("design:type", String)
|
|
145
|
-
], User.prototype, "
|
|
146
|
-
__decorate([
|
|
147
|
-
(0, mongoose_1.Prop)({ type: exports.AddressSchema, required: false }),
|
|
148
|
-
__metadata("design:type", Address)
|
|
149
|
-
], User.prototype, "address", void 0);
|
|
47
|
+
], User.prototype, "username", void 0);
|
|
150
48
|
__decorate([
|
|
151
|
-
(0, mongoose_1.Prop)({
|
|
152
|
-
__metadata("design:type",
|
|
153
|
-
], User.prototype, "
|
|
49
|
+
(0, mongoose_1.Prop)({ enum: OrganizationTeam }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], User.prototype, "team", void 0);
|
|
154
52
|
__decorate([
|
|
155
|
-
(0, mongoose_1.Prop)({
|
|
156
|
-
__metadata("design:type",
|
|
157
|
-
], User.prototype, "
|
|
53
|
+
(0, mongoose_1.Prop)({ enum: UserRole }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], User.prototype, "role", void 0);
|
|
158
56
|
__decorate([
|
|
159
|
-
(0, mongoose_1.Prop)({
|
|
160
|
-
__metadata("design:type",
|
|
161
|
-
], User.prototype, "
|
|
57
|
+
(0, mongoose_1.Prop)({ trim: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], User.prototype, "firebaseUid", void 0);
|
|
162
60
|
__decorate([
|
|
163
|
-
(0, mongoose_1.Prop)({ default:
|
|
164
|
-
__metadata("design:type",
|
|
165
|
-
], User.prototype, "
|
|
61
|
+
(0, mongoose_1.Prop)({ default: false }),
|
|
62
|
+
__metadata("design:type", Boolean)
|
|
63
|
+
], User.prototype, "disabled", void 0);
|
|
166
64
|
User = __decorate([
|
|
167
|
-
(0, mongoose_1.Schema)({ timestamps: true })
|
|
65
|
+
(0, mongoose_1.Schema)({ timestamps: true, collection: 'user' })
|
|
168
66
|
], User);
|
|
169
67
|
exports.User = User;
|
|
170
68
|
exports.UserSchema = mongoose_1.SchemaFactory.createForClass(User);
|
|
171
|
-
exports.UserSchema.index({
|
|
172
|
-
exports.UserSchema.index({
|
|
173
|
-
exports.UserSchema.index({ 'company.legalName': 1 });
|
|
174
|
-
exports.UserSchema.index({ createdAt: -1 });
|
|
175
|
-
exports.UserModel = (0, mongoose_2.model)('User', exports.UserSchema);
|
|
69
|
+
exports.UserSchema.index({ organization: 1, email: 1 }, { unique: true });
|
|
70
|
+
exports.UserSchema.index({ organization: 1, username: 1 }, { unique: true });
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -17,3 +17,7 @@ export * from './schemas/project.schema';
|
|
|
17
17
|
export * from './schemas/commission.schema';
|
|
18
18
|
export * from './schemas/contract.schema';
|
|
19
19
|
export * from './schemas/benchmark.schema';
|
|
20
|
+
export * from './schemas/notifications.schema';
|
|
21
|
+
export * from './schemas/organization.schema';
|
|
22
|
+
export * from './schemas/user.schema';
|
|
23
|
+
export * from './schemas/group.schema';
|
|
@@ -12,6 +12,7 @@ import { Recruitment } from './recruitment.schema';
|
|
|
12
12
|
import { Content } from './content.schema';
|
|
13
13
|
import { Client } from './client.schema';
|
|
14
14
|
import { Sale } from './sale.schema';
|
|
15
|
+
import { Campaign } from './campaign.schema';
|
|
15
16
|
|
|
16
17
|
export type ActionDocument = HydratedDocument<Action>;
|
|
17
18
|
|
|
@@ -245,6 +246,9 @@ export class Action {
|
|
|
245
246
|
@Prop({ type: String, enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
|
|
246
247
|
businessUnit?: ActionBusinessUnit;
|
|
247
248
|
|
|
249
|
+
@ApiProperty({ type: () => Campaign, required: false })
|
|
250
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Campaign', required: false })
|
|
251
|
+
campaign?: Types.ObjectId | Campaign;
|
|
248
252
|
}
|
|
249
253
|
|
|
250
254
|
export const ActionSchema = SchemaFactory.createForClass(Action);
|
|
@@ -21,7 +21,14 @@ export class Campaign {
|
|
|
21
21
|
@Prop({ default: Date.now, required: false })
|
|
22
22
|
updatedAt?: Date;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
@Prop({ required: false })
|
|
25
|
+
description?: string;
|
|
26
|
+
|
|
27
|
+
@Prop({ required: false })
|
|
28
|
+
startDate?: Date;
|
|
29
|
+
|
|
30
|
+
@Prop({ required: false })
|
|
31
|
+
endDate?: Date;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
export const CampaignSchema = SchemaFactory.createForClass(Campaign);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
2
|
import { HydratedDocument, model as MongooseModel } from 'mongoose';
|
|
3
|
-
import {
|
|
3
|
+
import { Party } from './party.schema';
|
|
4
4
|
|
|
5
5
|
export type ClientDocument = HydratedDocument<Client>;
|
|
6
6
|
|
|
@@ -69,7 +69,7 @@ export class NicheItem {
|
|
|
69
69
|
export const NicheItemSchema = SchemaFactory.createForClass(NicheItem);
|
|
70
70
|
|
|
71
71
|
@Schema({ timestamps: true })
|
|
72
|
-
export class Client extends
|
|
72
|
+
export class Client extends Party {
|
|
73
73
|
@Prop({ type: [ClusterSchema], default: [] })
|
|
74
74
|
clusters: Cluster[];
|
|
75
75
|
|