@grapadigital/shared-schemas 1.0.164 → 1.0.166
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/.claude/settings.json +9 -0
- package/dist/schemas/action.schema.js +6 -0
- package/dist/schemas/client.schema.js +4 -0
- package/dist/schemas/commission.schema.js +5 -0
- package/dist/schemas/content.schema.js +6 -0
- package/dist/schemas/invoice.schema.js +5 -0
- package/dist/schemas/log.schema.js +2 -0
- package/dist/schemas/payment.schema.js +10 -0
- package/dist/schemas/profile.schema.js +3 -0
- package/dist/schemas/recruitment.schema.js +5 -0
- package/dist/schemas/sale.schema.js +8 -0
- package/dist/schemas/schedule.schema.d.ts +6 -3
- package/dist/schemas/schedule.schema.js +23 -4
- package/dist/schemas/token.schema.js +2 -0
- package/dist/schemas/user.schema.js +4 -0
- package/package.json +1 -1
- package/src/schemas/action.schema.ts +8 -0
- package/src/schemas/client.schema.ts +6 -0
- package/src/schemas/commission.schema.ts +7 -0
- package/src/schemas/content.schema.ts +8 -0
- package/src/schemas/invoice.schema.ts +7 -0
- package/src/schemas/log.schema.ts +4 -0
- package/src/schemas/payment.schema.ts +12 -0
- package/src/schemas/profile.schema.ts +5 -0
- package/src/schemas/recruitment.schema.ts +7 -0
- package/src/schemas/sale.schema.ts +10 -0
- package/src/schemas/schedule.schema.ts +25 -5
- package/src/schemas/token.schema.ts +4 -0
- package/src/schemas/user.schema.ts +6 -0
|
@@ -281,4 +281,10 @@ Action = __decorate([
|
|
|
281
281
|
], Action);
|
|
282
282
|
exports.Action = Action;
|
|
283
283
|
exports.ActionSchema = mongoose_1.SchemaFactory.createForClass(Action);
|
|
284
|
+
exports.ActionSchema.index({ organization: 1, status: 1 });
|
|
285
|
+
exports.ActionSchema.index({ organization: 1, client: 1 });
|
|
286
|
+
exports.ActionSchema.index({ organization: 1, sale: 1 });
|
|
287
|
+
exports.ActionSchema.index({ sale: 1 });
|
|
288
|
+
exports.ActionSchema.index({ organization: 1, startDate: 1, endDate: 1 });
|
|
289
|
+
exports.ActionSchema.index({ 'responsibles.service.email': 1 });
|
|
284
290
|
exports.ActionModel = (0, mongoose_2.model)('Action', exports.ActionSchema);
|
|
@@ -139,4 +139,8 @@ Client = __decorate([
|
|
|
139
139
|
], Client);
|
|
140
140
|
exports.Client = Client;
|
|
141
141
|
exports.ClientSchema = mongoose_1.SchemaFactory.createForClass(Client);
|
|
142
|
+
exports.ClientSchema.index({ name: 1 });
|
|
143
|
+
exports.ClientSchema.index({ 'company.legalName': 1 });
|
|
144
|
+
exports.ClientSchema.index({ 'company.document': 1 });
|
|
145
|
+
exports.ClientSchema.index({ createdAt: -1 });
|
|
142
146
|
exports.ClientModel = (0, mongoose_2.model)('Client', exports.ClientSchema);
|
|
@@ -113,4 +113,9 @@ Commission = __decorate([
|
|
|
113
113
|
], Commission);
|
|
114
114
|
exports.Commission = Commission;
|
|
115
115
|
exports.CommissionSchema = mongoose_1.SchemaFactory.createForClass(Commission);
|
|
116
|
+
exports.CommissionSchema.index({ email: 1, organization: 1 });
|
|
117
|
+
exports.CommissionSchema.index({ email: 1, status: 1 });
|
|
118
|
+
exports.CommissionSchema.index({ email: 1, createdAt: -1 });
|
|
119
|
+
exports.CommissionSchema.index({ organization: 1, status: 1 });
|
|
120
|
+
exports.CommissionSchema.index({ sale: 1, installmentNumber: 1, status: 1 });
|
|
116
121
|
exports.CommissionModel = (0, mongoose_2.model)('Commission', exports.CommissionSchema);
|
|
@@ -300,4 +300,10 @@ Content = __decorate([
|
|
|
300
300
|
], Content);
|
|
301
301
|
exports.Content = Content;
|
|
302
302
|
exports.ContentSchema = mongoose_1.SchemaFactory.createForClass(Content);
|
|
303
|
+
exports.ContentSchema.index({ action: 1, status: 1 });
|
|
304
|
+
exports.ContentSchema.index({ action: 1, profile: 1, type: 1 });
|
|
305
|
+
exports.ContentSchema.index({ action: 1, profile: 1, socialnetwork: 1 });
|
|
306
|
+
exports.ContentSchema.index({ action: 1, status: 1, postedAt: 1 });
|
|
307
|
+
exports.ContentSchema.index({ profile: 1 });
|
|
308
|
+
exports.ContentSchema.index({ createdAt: -1, status: 1 });
|
|
303
309
|
exports.ContentModel = (0, mongoose_2.model)('Content', exports.ContentSchema);
|
|
@@ -262,4 +262,9 @@ Invoice = __decorate([
|
|
|
262
262
|
], Invoice);
|
|
263
263
|
exports.Invoice = Invoice;
|
|
264
264
|
exports.InvoiceSchema = mongoose_1.SchemaFactory.createForClass(Invoice);
|
|
265
|
+
exports.InvoiceSchema.index({ organization: 1, phase: 1 });
|
|
266
|
+
exports.InvoiceSchema.index({ organization: 1, 'invoiced.issueDate': 1 });
|
|
267
|
+
exports.InvoiceSchema.index({ sale: 1, installmentNumber: 1 });
|
|
268
|
+
exports.InvoiceSchema.index({ sale: 1, phase: 1 });
|
|
269
|
+
exports.InvoiceSchema.index({ tags: 1 });
|
|
265
270
|
exports.InvoiceModel = (0, mongoose_2.model)('Invoice', exports.InvoiceSchema);
|
|
@@ -87,4 +87,6 @@ Log = __decorate([
|
|
|
87
87
|
], Log);
|
|
88
88
|
exports.Log = Log;
|
|
89
89
|
exports.LogSchema = mongoose_1.SchemaFactory.createForClass(Log);
|
|
90
|
+
exports.LogSchema.index({ referenceId: 1, reference: 1 });
|
|
91
|
+
exports.LogSchema.index({ reference: 1, updatedAt: -1 });
|
|
90
92
|
exports.LogModel = (0, mongoose_2.model)('Log', exports.LogSchema);
|
|
@@ -356,4 +356,14 @@ Payment = __decorate([
|
|
|
356
356
|
], Payment);
|
|
357
357
|
exports.Payment = Payment;
|
|
358
358
|
exports.PaymentSchema = mongoose_1.SchemaFactory.createForClass(Payment);
|
|
359
|
+
exports.PaymentSchema.index({ 'pending.sale': 1 });
|
|
360
|
+
exports.PaymentSchema.index({ 'pending.influencer': 1 });
|
|
361
|
+
exports.PaymentSchema.index({ 'pending.recruitment': 1 });
|
|
362
|
+
exports.PaymentSchema.index({ 'pending.action': 1 });
|
|
363
|
+
exports.PaymentSchema.index({ 'pending.supplier': 1 });
|
|
364
|
+
exports.PaymentSchema.index({ 'pending.recruitment': 1, 'pending.type': 1 });
|
|
365
|
+
exports.PaymentSchema.index({ 'pending.influencer': 1, 'pending.recruitment': 1, 'pending.action': 1, 'pending.type': 1 });
|
|
366
|
+
exports.PaymentSchema.index({ organization: 1, phase: 1 });
|
|
367
|
+
exports.PaymentSchema.index({ organization: 1, 'queued.issueDate': 1 });
|
|
368
|
+
exports.PaymentSchema.index({ omieId: 1 }, { sparse: true });
|
|
359
369
|
exports.PaymentModel = (0, mongoose_2.model)('Payment', exports.PaymentSchema);
|
|
@@ -55,4 +55,7 @@ Profile = __decorate([
|
|
|
55
55
|
], Profile);
|
|
56
56
|
exports.Profile = Profile;
|
|
57
57
|
exports.ProfileSchema = mongoose_1.SchemaFactory.createForClass(Profile);
|
|
58
|
+
exports.ProfileSchema.index({ influencer: 1 });
|
|
59
|
+
exports.ProfileSchema.index({ username: 1 });
|
|
60
|
+
exports.ProfileSchema.index({ username: 1, influencer: 1 });
|
|
58
61
|
exports.ProfileModel = (0, mongoose_2.model)('Profile', exports.ProfileSchema);
|
|
@@ -331,4 +331,9 @@ Recruitment = __decorate([
|
|
|
331
331
|
], Recruitment);
|
|
332
332
|
exports.Recruitment = Recruitment;
|
|
333
333
|
exports.RecruitmentSchema = mongoose_1.SchemaFactory.createForClass(Recruitment);
|
|
334
|
+
exports.RecruitmentSchema.index({ action: 1, status: 1 });
|
|
335
|
+
exports.RecruitmentSchema.index({ action: 1 });
|
|
336
|
+
exports.RecruitmentSchema.index({ profile: 1, status: 1 });
|
|
337
|
+
exports.RecruitmentSchema.index({ profile: 1, status: 1, 'scope.exclusivity': 1 });
|
|
338
|
+
exports.RecruitmentSchema.index({ username: 1, _id: 1 });
|
|
334
339
|
exports.RecruitmentModel = (0, mongoose_2.model)('Recruitment', exports.RecruitmentSchema);
|
|
@@ -482,4 +482,12 @@ Sale = __decorate([
|
|
|
482
482
|
], Sale);
|
|
483
483
|
exports.Sale = Sale;
|
|
484
484
|
exports.SaleSchema = mongoose_1.SchemaFactory.createForClass(Sale);
|
|
485
|
+
exports.SaleSchema.index({ organization: 1, phase: 1 });
|
|
486
|
+
exports.SaleSchema.index({ organization: 1, createdAt: -1 });
|
|
487
|
+
exports.SaleSchema.index({ organization: 1, 'formalization.brand': 1 });
|
|
488
|
+
exports.SaleSchema.index({ organization: 1, 'formalization.agency': 1 });
|
|
489
|
+
exports.SaleSchema.index({ organization: 1, closedAt: 1, phase: 1 });
|
|
490
|
+
exports.SaleSchema.index({ 'proposal.influencer': 1 });
|
|
491
|
+
exports.SaleSchema.index({ 'proposal.responsable.email': 1 });
|
|
492
|
+
exports.SaleSchema.index({ tags: 1 });
|
|
485
493
|
exports.SaleModel = (0, mongoose_2.model)('Sale', exports.SaleSchema);
|
|
@@ -27,15 +27,18 @@ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
|
27
27
|
import { Action } from './action.schema';
|
|
28
28
|
import { Client } from './client.schema';
|
|
29
29
|
import { Content } from './content.schema';
|
|
30
|
+
import { Influencer } from './influencer.schema';
|
|
30
31
|
import { Profile } from './profile.schema';
|
|
31
32
|
import { Recruitment } from './recruitment.schema';
|
|
32
33
|
export type ScheduleDocument = HydratedDocument<Schedule>;
|
|
33
34
|
export declare class Schedule {
|
|
34
35
|
_id?: Types.ObjectId;
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
recruitment: Types.ObjectId | Recruitment;
|
|
37
|
+
profile: Types.ObjectId | Profile;
|
|
38
|
+
influencer: Types.ObjectId | Influencer;
|
|
37
39
|
socialnetwork: string;
|
|
38
|
-
type:
|
|
40
|
+
type: 'post' | 'task';
|
|
41
|
+
format?: string;
|
|
39
42
|
scheduledAt: Date;
|
|
40
43
|
status: 'scheduled' | 'published' | 'late' | 'cancelled';
|
|
41
44
|
contentId?: Types.ObjectId | Content;
|
|
@@ -24,22 +24,37 @@ __decorate([
|
|
|
24
24
|
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345678' }),
|
|
25
25
|
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Recruitment', required: true }),
|
|
26
26
|
__metadata("design:type", Object)
|
|
27
|
-
], Schedule.prototype, "
|
|
27
|
+
], Schedule.prototype, "recruitment", void 0);
|
|
28
28
|
__decorate([
|
|
29
29
|
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345679' }),
|
|
30
30
|
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: true }),
|
|
31
31
|
__metadata("design:type", Object)
|
|
32
|
-
], Schedule.prototype, "
|
|
32
|
+
], Schedule.prototype, "profile", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345683' }),
|
|
35
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Influencer', required: true }),
|
|
36
|
+
__metadata("design:type", Object)
|
|
37
|
+
], Schedule.prototype, "influencer", void 0);
|
|
33
38
|
__decorate([
|
|
34
39
|
(0, swagger_1.ApiProperty)({ example: 'instagram' }),
|
|
35
40
|
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
36
41
|
__metadata("design:type", String)
|
|
37
42
|
], Schedule.prototype, "socialnetwork", void 0);
|
|
38
43
|
__decorate([
|
|
39
|
-
(0, swagger_1.ApiProperty)({ example: '
|
|
40
|
-
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
44
|
+
(0, swagger_1.ApiProperty)({ enum: ['post', 'task'], example: 'post' }),
|
|
45
|
+
(0, mongoose_1.Prop)({ type: String, enum: ['post', 'task'], required: true }),
|
|
41
46
|
__metadata("design:type", String)
|
|
42
47
|
], Schedule.prototype, "type", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, swagger_1.ApiProperty)({ example: 'reel', required: false }),
|
|
50
|
+
(0, mongoose_1.Prop)({
|
|
51
|
+
type: String,
|
|
52
|
+
required: function () {
|
|
53
|
+
return this.type === 'post';
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], Schedule.prototype, "format", void 0);
|
|
43
58
|
__decorate([
|
|
44
59
|
(0, swagger_1.ApiProperty)({ example: '2025-11-05T14:00:00.000Z' }),
|
|
45
60
|
(0, mongoose_1.Prop)({ type: Date, required: true }),
|
|
@@ -74,4 +89,8 @@ Schedule = __decorate([
|
|
|
74
89
|
], Schedule);
|
|
75
90
|
exports.Schedule = Schedule;
|
|
76
91
|
exports.ScheduleSchema = mongoose_1.SchemaFactory.createForClass(Schedule);
|
|
92
|
+
exports.ScheduleSchema.index({ actionId: 1, scheduledAt: 1 });
|
|
93
|
+
exports.ScheduleSchema.index({ clientId: 1 });
|
|
94
|
+
exports.ScheduleSchema.index({ recruitment: 1 });
|
|
95
|
+
exports.ScheduleSchema.index({ influencer: 1 });
|
|
77
96
|
exports.ScheduleModel = (0, mongoose_2.model)('Schedule', exports.ScheduleSchema);
|
|
@@ -55,4 +55,6 @@ Token = __decorate([
|
|
|
55
55
|
], Token);
|
|
56
56
|
exports.Token = Token;
|
|
57
57
|
exports.TokenSchema = mongoose_1.SchemaFactory.createForClass(Token);
|
|
58
|
+
exports.TokenSchema.index({ profileId: 1, provider: 1 });
|
|
59
|
+
exports.TokenSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
58
60
|
exports.TokenModel = (0, mongoose_2.model)('Token', exports.TokenSchema);
|
|
@@ -168,4 +168,8 @@ User = __decorate([
|
|
|
168
168
|
], User);
|
|
169
169
|
exports.User = User;
|
|
170
170
|
exports.UserSchema = mongoose_1.SchemaFactory.createForClass(User);
|
|
171
|
+
exports.UserSchema.index({ name: 1 });
|
|
172
|
+
exports.UserSchema.index({ 'company.document': 1 });
|
|
173
|
+
exports.UserSchema.index({ 'company.legalName': 1 });
|
|
174
|
+
exports.UserSchema.index({ createdAt: -1 });
|
|
171
175
|
exports.UserModel = (0, mongoose_2.model)('User', exports.UserSchema);
|
package/package.json
CHANGED
|
@@ -223,4 +223,12 @@ export class Action {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
export const ActionSchema = SchemaFactory.createForClass(Action);
|
|
226
|
+
|
|
227
|
+
ActionSchema.index({ organization: 1, status: 1 });
|
|
228
|
+
ActionSchema.index({ organization: 1, client: 1 });
|
|
229
|
+
ActionSchema.index({ organization: 1, sale: 1 });
|
|
230
|
+
ActionSchema.index({ sale: 1 });
|
|
231
|
+
ActionSchema.index({ organization: 1, startDate: 1, endDate: 1 });
|
|
232
|
+
ActionSchema.index({ 'responsibles.service.email': 1 });
|
|
233
|
+
|
|
226
234
|
export const ActionModel = MongooseModel('Action', ActionSchema);
|
|
@@ -97,4 +97,10 @@ export class Client extends User {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export const ClientSchema = SchemaFactory.createForClass(Client);
|
|
100
|
+
|
|
101
|
+
ClientSchema.index({ name: 1 });
|
|
102
|
+
ClientSchema.index({ 'company.legalName': 1 });
|
|
103
|
+
ClientSchema.index({ 'company.document': 1 });
|
|
104
|
+
ClientSchema.index({ createdAt: -1 });
|
|
105
|
+
|
|
100
106
|
export const ClientModel = MongooseModel('Client', ClientSchema);
|
|
@@ -89,4 +89,11 @@ export class Commission {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export const CommissionSchema = SchemaFactory.createForClass(Commission);
|
|
92
|
+
|
|
93
|
+
CommissionSchema.index({ email: 1, organization: 1 });
|
|
94
|
+
CommissionSchema.index({ email: 1, status: 1 });
|
|
95
|
+
CommissionSchema.index({ email: 1, createdAt: -1 });
|
|
96
|
+
CommissionSchema.index({ organization: 1, status: 1 });
|
|
97
|
+
CommissionSchema.index({ sale: 1, installmentNumber: 1, status: 1 });
|
|
98
|
+
|
|
92
99
|
export const CommissionModel = MongooseModel('Commission', CommissionSchema);
|
|
@@ -228,4 +228,12 @@ export class Content {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
export const ContentSchema = SchemaFactory.createForClass(Content);
|
|
231
|
+
|
|
232
|
+
ContentSchema.index({ action: 1, status: 1 });
|
|
233
|
+
ContentSchema.index({ action: 1, profile: 1, type: 1 });
|
|
234
|
+
ContentSchema.index({ action: 1, profile: 1, socialnetwork: 1 });
|
|
235
|
+
ContentSchema.index({ action: 1, status: 1, postedAt: 1 });
|
|
236
|
+
ContentSchema.index({ profile: 1 });
|
|
237
|
+
ContentSchema.index({ createdAt: -1, status: 1 });
|
|
238
|
+
|
|
231
239
|
export const ContentModel = MongooseModel('Content', ContentSchema);
|
|
@@ -165,4 +165,11 @@ export class Invoice {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export const InvoiceSchema = SchemaFactory.createForClass(Invoice);
|
|
168
|
+
|
|
169
|
+
InvoiceSchema.index({ organization: 1, phase: 1 });
|
|
170
|
+
InvoiceSchema.index({ organization: 1, 'invoiced.issueDate': 1 });
|
|
171
|
+
InvoiceSchema.index({ sale: 1, installmentNumber: 1 });
|
|
172
|
+
InvoiceSchema.index({ sale: 1, phase: 1 });
|
|
173
|
+
InvoiceSchema.index({ tags: 1 });
|
|
174
|
+
|
|
168
175
|
export const InvoiceModel = MongooseModel('Invoice', InvoiceSchema);
|
|
@@ -56,4 +56,8 @@ export class Log {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export const LogSchema = SchemaFactory.createForClass(Log);
|
|
59
|
+
|
|
60
|
+
LogSchema.index({ referenceId: 1, reference: 1 });
|
|
61
|
+
LogSchema.index({ reference: 1, updatedAt: -1 });
|
|
62
|
+
|
|
59
63
|
export const LogModel = MongooseModel('Log', LogSchema);
|
|
@@ -267,4 +267,16 @@ export class Payment {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
export const PaymentSchema = SchemaFactory.createForClass(Payment);
|
|
270
|
+
|
|
271
|
+
PaymentSchema.index({ 'pending.sale': 1 });
|
|
272
|
+
PaymentSchema.index({ 'pending.influencer': 1 });
|
|
273
|
+
PaymentSchema.index({ 'pending.recruitment': 1 });
|
|
274
|
+
PaymentSchema.index({ 'pending.action': 1 });
|
|
275
|
+
PaymentSchema.index({ 'pending.supplier': 1 });
|
|
276
|
+
PaymentSchema.index({ 'pending.recruitment': 1, 'pending.type': 1 });
|
|
277
|
+
PaymentSchema.index({ 'pending.influencer': 1, 'pending.recruitment': 1, 'pending.action': 1, 'pending.type': 1 });
|
|
278
|
+
PaymentSchema.index({ organization: 1, phase: 1 });
|
|
279
|
+
PaymentSchema.index({ organization: 1, 'queued.issueDate': 1 });
|
|
280
|
+
PaymentSchema.index({ omieId: 1 }, { sparse: true });
|
|
281
|
+
|
|
270
282
|
export const PaymentModel = MongooseModel('Payment', PaymentSchema);
|
|
@@ -35,5 +35,10 @@ export class Profile {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export const ProfileSchema = SchemaFactory.createForClass(Profile);
|
|
38
|
+
|
|
39
|
+
ProfileSchema.index({ influencer: 1 });
|
|
40
|
+
ProfileSchema.index({ username: 1 });
|
|
41
|
+
ProfileSchema.index({ username: 1, influencer: 1 });
|
|
42
|
+
|
|
38
43
|
export const ProfileModel = MongooseModel('Profile', ProfileSchema);
|
|
39
44
|
|
|
@@ -217,5 +217,12 @@ export class Recruitment {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
export const RecruitmentSchema = SchemaFactory.createForClass(Recruitment);
|
|
220
|
+
|
|
221
|
+
RecruitmentSchema.index({ action: 1, status: 1 });
|
|
222
|
+
RecruitmentSchema.index({ action: 1 });
|
|
223
|
+
RecruitmentSchema.index({ profile: 1, status: 1 });
|
|
224
|
+
RecruitmentSchema.index({ profile: 1, status: 1, 'scope.exclusivity': 1 });
|
|
225
|
+
RecruitmentSchema.index({ username: 1, _id: 1 });
|
|
226
|
+
|
|
220
227
|
export const RecruitmentModel = MongooseModel('Recruitment', RecruitmentSchema);
|
|
221
228
|
|
|
@@ -269,4 +269,14 @@ export class Sale {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
export const SaleSchema = SchemaFactory.createForClass(Sale);
|
|
272
|
+
|
|
273
|
+
SaleSchema.index({ organization: 1, phase: 1 });
|
|
274
|
+
SaleSchema.index({ organization: 1, createdAt: -1 });
|
|
275
|
+
SaleSchema.index({ organization: 1, 'formalization.brand': 1 });
|
|
276
|
+
SaleSchema.index({ organization: 1, 'formalization.agency': 1 });
|
|
277
|
+
SaleSchema.index({ organization: 1, closedAt: 1, phase: 1 });
|
|
278
|
+
SaleSchema.index({ 'proposal.influencer': 1 });
|
|
279
|
+
SaleSchema.index({ 'proposal.responsable.email': 1 });
|
|
280
|
+
SaleSchema.index({ tags: 1 });
|
|
281
|
+
|
|
272
282
|
export const SaleModel = MongooseModel('Sale', SaleSchema);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { Action } from './action.schema';
|
|
12
12
|
import { Client } from './client.schema';
|
|
13
13
|
import { Content } from './content.schema';
|
|
14
|
+
import { Influencer } from './influencer.schema';
|
|
14
15
|
import { Profile } from './profile.schema';
|
|
15
16
|
import { Recruitment } from './recruitment.schema';
|
|
16
17
|
|
|
@@ -24,19 +25,32 @@ export class Schedule {
|
|
|
24
25
|
|
|
25
26
|
@ApiProperty({ example: '64bfc3a78d3f1e2a12345678' })
|
|
26
27
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment', required: true })
|
|
27
|
-
|
|
28
|
+
recruitment: Types.ObjectId | Recruitment;
|
|
28
29
|
|
|
29
30
|
@ApiProperty({ example: '64bfc3a78d3f1e2a12345679' })
|
|
30
31
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
|
|
31
|
-
|
|
32
|
+
profile: Types.ObjectId | Profile;
|
|
33
|
+
|
|
34
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345683' })
|
|
35
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Influencer', required: true })
|
|
36
|
+
influencer: Types.ObjectId | Influencer;
|
|
32
37
|
|
|
33
38
|
@ApiProperty({ example: 'instagram' })
|
|
34
39
|
@Prop({ type: String, required: true })
|
|
35
40
|
socialnetwork: string;
|
|
36
41
|
|
|
37
|
-
@ApiProperty({ example: '
|
|
38
|
-
@Prop({ type: String, required: true })
|
|
39
|
-
type:
|
|
42
|
+
@ApiProperty({ enum: ['post', 'task'], example: 'post' })
|
|
43
|
+
@Prop({ type: String, enum: ['post', 'task'], required: true })
|
|
44
|
+
type: 'post' | 'task';
|
|
45
|
+
|
|
46
|
+
@ApiProperty({ example: 'reel', required: false })
|
|
47
|
+
@Prop({
|
|
48
|
+
type: String,
|
|
49
|
+
required: function (this: Schedule) {
|
|
50
|
+
return this.type === 'post';
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
format?: string;
|
|
40
54
|
|
|
41
55
|
@ApiProperty({ example: '2025-11-05T14:00:00.000Z' })
|
|
42
56
|
@Prop({ type: Date, required: true })
|
|
@@ -64,4 +78,10 @@ export class Schedule {
|
|
|
64
78
|
}
|
|
65
79
|
|
|
66
80
|
export const ScheduleSchema = SchemaFactory.createForClass(Schedule);
|
|
81
|
+
|
|
82
|
+
ScheduleSchema.index({ actionId: 1, scheduledAt: 1 });
|
|
83
|
+
ScheduleSchema.index({ clientId: 1 });
|
|
84
|
+
ScheduleSchema.index({ recruitment: 1 });
|
|
85
|
+
ScheduleSchema.index({ influencer: 1 });
|
|
86
|
+
|
|
67
87
|
export const ScheduleModel = MongooseModel('Schedule', ScheduleSchema);
|
|
@@ -34,5 +34,9 @@ export class Token {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export const TokenSchema = SchemaFactory.createForClass(Token);
|
|
37
|
+
|
|
38
|
+
TokenSchema.index({ profileId: 1, provider: 1 });
|
|
39
|
+
TokenSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
40
|
+
|
|
37
41
|
export const TokenModel = MongooseModel('Token', TokenSchema);
|
|
38
42
|
|
|
@@ -120,5 +120,11 @@ export class User {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export const UserSchema = SchemaFactory.createForClass(User);
|
|
123
|
+
|
|
124
|
+
UserSchema.index({ name: 1 });
|
|
125
|
+
UserSchema.index({ 'company.document': 1 });
|
|
126
|
+
UserSchema.index({ 'company.legalName': 1 });
|
|
127
|
+
UserSchema.index({ createdAt: -1 });
|
|
128
|
+
|
|
123
129
|
export const UserModel = MongooseModel('User', UserSchema);
|
|
124
130
|
|