@grapadigital/shared-schemas 1.0.163 → 1.0.165
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 +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/schemas/action.schema.d.ts +0 -11
- package/dist/schemas/action.schema.js +6 -50
- package/dist/schemas/benchmark.schema.d.ts +62 -0
- package/dist/schemas/benchmark.schema.js +54 -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 +66 -0
- package/dist/schemas/schedule.schema.js +80 -0
- package/dist/schemas/token.schema.js +2 -0
- package/dist/schemas/user.schema.js +4 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/schemas/action.schema.ts +8 -41
- package/src/schemas/benchmark.schema.ts +37 -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 +72 -0
- package/src/schemas/token.schema.ts +4 -0
- package/src/schemas/user.schema.ts +6 -0
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './schemas/campaign.schema';
|
|
|
7
7
|
export * from './schemas/payment.schema';
|
|
8
8
|
export * from './schemas/profile.schema';
|
|
9
9
|
export * from './schemas/recruitment.schema';
|
|
10
|
+
export * from './schemas/schedule.schema';
|
|
10
11
|
export * from './schemas/token.schema';
|
|
11
12
|
export * from './schemas/webhook.schema';
|
|
12
13
|
export * from './schemas/sale.schema';
|
|
@@ -15,3 +16,4 @@ export * from './schemas/log.schema';
|
|
|
15
16
|
export * from './schemas/project.schema';
|
|
16
17
|
export * from './schemas/commission.schema';
|
|
17
18
|
export * from './schemas/contract.schema';
|
|
19
|
+
export * from './schemas/benchmark.schema';
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __exportStar(require("./schemas/campaign.schema"), exports);
|
|
|
23
23
|
__exportStar(require("./schemas/payment.schema"), exports);
|
|
24
24
|
__exportStar(require("./schemas/profile.schema"), exports);
|
|
25
25
|
__exportStar(require("./schemas/recruitment.schema"), exports);
|
|
26
|
+
__exportStar(require("./schemas/schedule.schema"), exports);
|
|
26
27
|
__exportStar(require("./schemas/token.schema"), exports);
|
|
27
28
|
__exportStar(require("./schemas/webhook.schema"), exports);
|
|
28
29
|
__exportStar(require("./schemas/sale.schema"), exports);
|
|
@@ -31,3 +32,4 @@ __exportStar(require("./schemas/log.schema"), exports);
|
|
|
31
32
|
__exportStar(require("./schemas/project.schema"), exports);
|
|
32
33
|
__exportStar(require("./schemas/commission.schema"), exports);
|
|
33
34
|
__exportStar(require("./schemas/contract.schema"), exports);
|
|
35
|
+
__exportStar(require("./schemas/benchmark.schema"), exports);
|
|
@@ -28,7 +28,6 @@ import { Recruitment } from './recruitment.schema';
|
|
|
28
28
|
import { Content } from './content.schema';
|
|
29
29
|
import { Client } from './client.schema';
|
|
30
30
|
import { Sale } from './sale.schema';
|
|
31
|
-
import { Profile } from './profile.schema';
|
|
32
31
|
export type ActionDocument = HydratedDocument<Action>;
|
|
33
32
|
export declare class Responsible {
|
|
34
33
|
name: string;
|
|
@@ -62,15 +61,6 @@ declare class Note {
|
|
|
62
61
|
owner: string;
|
|
63
62
|
createdAt: Date;
|
|
64
63
|
}
|
|
65
|
-
declare class ScheduledPost {
|
|
66
|
-
recruitmentId: Types.ObjectId | Recruitment;
|
|
67
|
-
profileId: Types.ObjectId | Profile;
|
|
68
|
-
socialnetwork: string;
|
|
69
|
-
type: string;
|
|
70
|
-
scheduledAt: Date;
|
|
71
|
-
status: 'scheduled' | 'published' | 'late' | 'cancelled';
|
|
72
|
-
contentId?: Types.ObjectId | Content;
|
|
73
|
-
}
|
|
74
64
|
export declare class Action {
|
|
75
65
|
_id?: Types.ObjectId;
|
|
76
66
|
title: string;
|
|
@@ -102,7 +92,6 @@ export declare class Action {
|
|
|
102
92
|
updatedAt?: Date;
|
|
103
93
|
notes?: Note[];
|
|
104
94
|
primetagId?: string;
|
|
105
|
-
scheduledPosts?: ScheduledPost[];
|
|
106
95
|
hashtags?: string[];
|
|
107
96
|
instagramMentions?: string[];
|
|
108
97
|
tiktokMentions?: string[];
|
|
@@ -74,51 +74,6 @@ Note = __decorate([
|
|
|
74
74
|
(0, mongoose_1.Schema)({ _id: false })
|
|
75
75
|
], Note);
|
|
76
76
|
const NoteSchema = mongoose_1.SchemaFactory.createForClass(Note);
|
|
77
|
-
let ScheduledPost = class ScheduledPost {
|
|
78
|
-
};
|
|
79
|
-
__decorate([
|
|
80
|
-
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345678' }),
|
|
81
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: true }),
|
|
82
|
-
__metadata("design:type", Object)
|
|
83
|
-
], ScheduledPost.prototype, "recruitmentId", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345679' }),
|
|
86
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: true }),
|
|
87
|
-
__metadata("design:type", Object)
|
|
88
|
-
], ScheduledPost.prototype, "profileId", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
(0, swagger_1.ApiProperty)({ example: 'instagram' }),
|
|
91
|
-
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
92
|
-
__metadata("design:type", String)
|
|
93
|
-
], ScheduledPost.prototype, "socialnetwork", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
(0, swagger_1.ApiProperty)({ example: 'reel' }),
|
|
96
|
-
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
97
|
-
__metadata("design:type", String)
|
|
98
|
-
], ScheduledPost.prototype, "type", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
(0, swagger_1.ApiProperty)({ example: '2025-11-05T14:00:00.000Z' }),
|
|
101
|
-
(0, mongoose_1.Prop)({ type: Date, required: true }),
|
|
102
|
-
__metadata("design:type", Date)
|
|
103
|
-
], ScheduledPost.prototype, "scheduledAt", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
(0, swagger_1.ApiProperty)({ enum: ['scheduled', 'published', 'late', 'cancelled'], example: 'scheduled' }),
|
|
106
|
-
(0, mongoose_1.Prop)({
|
|
107
|
-
type: String,
|
|
108
|
-
enum: ['scheduled', 'published', 'late', 'cancelled'],
|
|
109
|
-
required: true,
|
|
110
|
-
}),
|
|
111
|
-
__metadata("design:type", String)
|
|
112
|
-
], ScheduledPost.prototype, "status", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345680', required: false }),
|
|
115
|
-
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: false }),
|
|
116
|
-
__metadata("design:type", Object)
|
|
117
|
-
], ScheduledPost.prototype, "contentId", void 0);
|
|
118
|
-
ScheduledPost = __decorate([
|
|
119
|
-
(0, mongoose_1.Schema)({ _id: false })
|
|
120
|
-
], ScheduledPost);
|
|
121
|
-
const ScheduledPostSchema = mongoose_1.SchemaFactory.createForClass(ScheduledPost);
|
|
122
77
|
let Action = class Action {
|
|
123
78
|
};
|
|
124
79
|
__decorate([
|
|
@@ -287,11 +242,6 @@ __decorate([
|
|
|
287
242
|
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
288
243
|
__metadata("design:type", String)
|
|
289
244
|
], Action.prototype, "primetagId", void 0);
|
|
290
|
-
__decorate([
|
|
291
|
-
(0, swagger_1.ApiProperty)({ type: () => [ScheduledPost], required: false }),
|
|
292
|
-
(0, mongoose_1.Prop)({ type: [ScheduledPostSchema], required: false }),
|
|
293
|
-
__metadata("design:type", Array)
|
|
294
|
-
], Action.prototype, "scheduledPosts", void 0);
|
|
295
245
|
__decorate([
|
|
296
246
|
(0, swagger_1.ApiProperty)({ example: ['#trending', '#viral'], required: false }),
|
|
297
247
|
(0, mongoose_1.Prop)({ type: [String], required: false }),
|
|
@@ -331,4 +281,10 @@ Action = __decorate([
|
|
|
331
281
|
], Action);
|
|
332
282
|
exports.Action = Action;
|
|
333
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 });
|
|
334
290
|
exports.ActionModel = (0, mongoose_2.model)('Action', exports.ActionSchema);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/session" />
|
|
19
|
+
/// <reference types="mongoose/types/types" />
|
|
20
|
+
/// <reference types="mongoose/types/utility" />
|
|
21
|
+
/// <reference types="mongoose/types/validation" />
|
|
22
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
23
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
|
+
import { Client } from './client.schema';
|
|
28
|
+
export type BenchmarkMetric = 'reach' | 'er' | 'cpi' | 'cpe';
|
|
29
|
+
export type BenchmarkMode = 'organic' | 'paid';
|
|
30
|
+
export type BenchmarkDocument = HydratedDocument<Benchmark>;
|
|
31
|
+
export declare class Benchmark {
|
|
32
|
+
_id?: Types.ObjectId;
|
|
33
|
+
format: string;
|
|
34
|
+
mode: BenchmarkMode;
|
|
35
|
+
metric: BenchmarkMetric;
|
|
36
|
+
bad: number;
|
|
37
|
+
good: number;
|
|
38
|
+
inverted: boolean;
|
|
39
|
+
client?: Types.ObjectId | Client;
|
|
40
|
+
}
|
|
41
|
+
export declare const BenchmarkSchema: MongooseSchema<Benchmark, import("mongoose").Model<Benchmark, any, any, any, import("mongoose").Document<unknown, any, Benchmark, any, {}> & Benchmark & Required<{
|
|
42
|
+
_id: Types.ObjectId;
|
|
43
|
+
}> & {
|
|
44
|
+
__v: number;
|
|
45
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Benchmark, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Benchmark>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Benchmark> & Required<{
|
|
46
|
+
_id: Types.ObjectId;
|
|
47
|
+
}> & {
|
|
48
|
+
__v: number;
|
|
49
|
+
}>;
|
|
50
|
+
export declare const BenchmarkModel: import("mongoose").Model<Benchmark, {}, {}, {}, import("mongoose").Document<unknown, {}, Benchmark, {}, import("mongoose").DefaultSchemaOptions> & Benchmark & Required<{
|
|
51
|
+
_id: Types.ObjectId;
|
|
52
|
+
}> & {
|
|
53
|
+
__v: number;
|
|
54
|
+
}, MongooseSchema<Benchmark, import("mongoose").Model<Benchmark, any, any, any, import("mongoose").Document<unknown, any, Benchmark, any, {}> & Benchmark & Required<{
|
|
55
|
+
_id: Types.ObjectId;
|
|
56
|
+
}> & {
|
|
57
|
+
__v: number;
|
|
58
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Benchmark, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Benchmark>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Benchmark> & Required<{
|
|
59
|
+
_id: Types.ObjectId;
|
|
60
|
+
}> & {
|
|
61
|
+
__v: number;
|
|
62
|
+
}>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
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.BenchmarkModel = exports.BenchmarkSchema = exports.Benchmark = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
let Benchmark = class Benchmark {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
19
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
20
|
+
], Benchmark.prototype, "_id", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], Benchmark.prototype, "format", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, mongoose_1.Prop)({ type: String, enum: ['organic', 'paid'], required: true }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Benchmark.prototype, "mode", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({ type: String, enum: ['reach', 'er', 'cpi', 'cpe'], required: true }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], Benchmark.prototype, "metric", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, mongoose_1.Prop)({ type: Number, required: true }),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], Benchmark.prototype, "bad", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, mongoose_1.Prop)({ type: Number, required: true }),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], Benchmark.prototype, "good", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true }),
|
|
43
|
+
__metadata("design:type", Boolean)
|
|
44
|
+
], Benchmark.prototype, "inverted", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Client', required: false }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], Benchmark.prototype, "client", void 0);
|
|
49
|
+
Benchmark = __decorate([
|
|
50
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
51
|
+
], Benchmark);
|
|
52
|
+
exports.Benchmark = Benchmark;
|
|
53
|
+
exports.BenchmarkSchema = mongoose_1.SchemaFactory.createForClass(Benchmark);
|
|
54
|
+
exports.BenchmarkModel = (0, mongoose_2.model)('Benchmark', exports.BenchmarkSchema);
|
|
@@ -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);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/session" />
|
|
19
|
+
/// <reference types="mongoose/types/types" />
|
|
20
|
+
/// <reference types="mongoose/types/utility" />
|
|
21
|
+
/// <reference types="mongoose/types/validation" />
|
|
22
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
23
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
26
|
+
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
|
+
import { Action } from './action.schema';
|
|
28
|
+
import { Client } from './client.schema';
|
|
29
|
+
import { Content } from './content.schema';
|
|
30
|
+
import { Profile } from './profile.schema';
|
|
31
|
+
import { Recruitment } from './recruitment.schema';
|
|
32
|
+
export type ScheduleDocument = HydratedDocument<Schedule>;
|
|
33
|
+
export declare class Schedule {
|
|
34
|
+
_id?: Types.ObjectId;
|
|
35
|
+
recruitmentId: Types.ObjectId | Recruitment;
|
|
36
|
+
profileId: Types.ObjectId | Profile;
|
|
37
|
+
socialnetwork: string;
|
|
38
|
+
type: string;
|
|
39
|
+
scheduledAt: Date;
|
|
40
|
+
status: 'scheduled' | 'published' | 'late' | 'cancelled';
|
|
41
|
+
contentId?: Types.ObjectId | Content;
|
|
42
|
+
actionId: Types.ObjectId | Action;
|
|
43
|
+
clientId: Types.ObjectId | Client;
|
|
44
|
+
}
|
|
45
|
+
export declare const ScheduleSchema: MongooseSchema<Schedule, import("mongoose").Model<Schedule, any, any, any, import("mongoose").Document<unknown, any, Schedule, any, {}> & Schedule & Required<{
|
|
46
|
+
_id: Types.ObjectId;
|
|
47
|
+
}> & {
|
|
48
|
+
__v: number;
|
|
49
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Schedule, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Schedule>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Schedule> & Required<{
|
|
50
|
+
_id: Types.ObjectId;
|
|
51
|
+
}> & {
|
|
52
|
+
__v: number;
|
|
53
|
+
}>;
|
|
54
|
+
export declare const ScheduleModel: import("mongoose").Model<Schedule, {}, {}, {}, import("mongoose").Document<unknown, {}, Schedule, {}, import("mongoose").DefaultSchemaOptions> & Schedule & Required<{
|
|
55
|
+
_id: Types.ObjectId;
|
|
56
|
+
}> & {
|
|
57
|
+
__v: number;
|
|
58
|
+
}, MongooseSchema<Schedule, import("mongoose").Model<Schedule, any, any, any, import("mongoose").Document<unknown, any, Schedule, any, {}> & Schedule & Required<{
|
|
59
|
+
_id: Types.ObjectId;
|
|
60
|
+
}> & {
|
|
61
|
+
__v: number;
|
|
62
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Schedule, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Schedule>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Schedule> & Required<{
|
|
63
|
+
_id: Types.ObjectId;
|
|
64
|
+
}> & {
|
|
65
|
+
__v: number;
|
|
66
|
+
}>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
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.ScheduleModel = exports.ScheduleSchema = exports.Schedule = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const mongoose_2 = require("mongoose");
|
|
16
|
+
let Schedule = class Schedule {
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345670' }),
|
|
20
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
21
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
22
|
+
], Schedule.prototype, "_id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345678' }),
|
|
25
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Recruitment', required: true }),
|
|
26
|
+
__metadata("design:type", Object)
|
|
27
|
+
], Schedule.prototype, "recruitmentId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345679' }),
|
|
30
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: true }),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], Schedule.prototype, "profileId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)({ example: 'instagram' }),
|
|
35
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], Schedule.prototype, "socialnetwork", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, swagger_1.ApiProperty)({ example: 'reel' }),
|
|
40
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], Schedule.prototype, "type", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, swagger_1.ApiProperty)({ example: '2025-11-05T14:00:00.000Z' }),
|
|
45
|
+
(0, mongoose_1.Prop)({ type: Date, required: true }),
|
|
46
|
+
__metadata("design:type", Date)
|
|
47
|
+
], Schedule.prototype, "scheduledAt", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, swagger_1.ApiProperty)({ enum: ['scheduled', 'published', 'late', 'cancelled'], example: 'scheduled' }),
|
|
50
|
+
(0, mongoose_1.Prop)({
|
|
51
|
+
type: String,
|
|
52
|
+
enum: ['scheduled', 'published', 'late', 'cancelled'],
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], Schedule.prototype, "status", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345680', required: false }),
|
|
59
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Content', required: false }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], Schedule.prototype, "contentId", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345681' }),
|
|
64
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: true }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], Schedule.prototype, "actionId", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345682' }),
|
|
69
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Client', required: true }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], Schedule.prototype, "clientId", void 0);
|
|
72
|
+
Schedule = __decorate([
|
|
73
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
74
|
+
], Schedule);
|
|
75
|
+
exports.Schedule = Schedule;
|
|
76
|
+
exports.ScheduleSchema = mongoose_1.SchemaFactory.createForClass(Schedule);
|
|
77
|
+
exports.ScheduleSchema.index({ actionId: 1, scheduledAt: 1 });
|
|
78
|
+
exports.ScheduleSchema.index({ clientId: 1 });
|
|
79
|
+
exports.ScheduleSchema.index({ recruitmentId: 1 });
|
|
80
|
+
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
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './schemas/campaign.schema';
|
|
|
7
7
|
export * from './schemas/payment.schema';
|
|
8
8
|
export * from './schemas/profile.schema';
|
|
9
9
|
export * from './schemas/recruitment.schema';
|
|
10
|
+
export * from './schemas/schedule.schema';
|
|
10
11
|
export * from './schemas/token.schema';
|
|
11
12
|
export * from './schemas/webhook.schema';
|
|
12
13
|
export * from './schemas/sale.schema';
|
|
@@ -15,3 +16,4 @@ export * from './schemas/log.schema';
|
|
|
15
16
|
export * from './schemas/project.schema';
|
|
16
17
|
export * from './schemas/commission.schema';
|
|
17
18
|
export * from './schemas/contract.schema';
|
|
19
|
+
export * from './schemas/benchmark.schema';
|
|
@@ -12,7 +12,6 @@ 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 { Profile } from './profile.schema';
|
|
16
15
|
|
|
17
16
|
export type ActionDocument = HydratedDocument<Action>;
|
|
18
17
|
|
|
@@ -55,42 +54,6 @@ class Note {
|
|
|
55
54
|
|
|
56
55
|
const NoteSchema = SchemaFactory.createForClass(Note);
|
|
57
56
|
|
|
58
|
-
@Schema({ _id: false })
|
|
59
|
-
class ScheduledPost {
|
|
60
|
-
@ApiProperty({ example: '64bfc3a78d3f1e2a12345678' })
|
|
61
|
-
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
|
|
62
|
-
recruitmentId: Types.ObjectId | Recruitment;
|
|
63
|
-
|
|
64
|
-
@ApiProperty({ example: '64bfc3a78d3f1e2a12345679' })
|
|
65
|
-
@Prop({ type: MongooseSchema.Types.ObjectId, required: true })
|
|
66
|
-
profileId: Types.ObjectId | Profile;
|
|
67
|
-
|
|
68
|
-
@ApiProperty({ example: 'instagram' })
|
|
69
|
-
@Prop({ type: String, required: true })
|
|
70
|
-
socialnetwork: string;
|
|
71
|
-
|
|
72
|
-
@ApiProperty({ example: 'reel' })
|
|
73
|
-
@Prop({ type: String, required: true })
|
|
74
|
-
type: string;
|
|
75
|
-
|
|
76
|
-
@ApiProperty({ example: '2025-11-05T14:00:00.000Z' })
|
|
77
|
-
@Prop({ type: Date, required: true })
|
|
78
|
-
scheduledAt: Date;
|
|
79
|
-
|
|
80
|
-
@ApiProperty({ enum: ['scheduled', 'published', 'late', 'cancelled'], example: 'scheduled' })
|
|
81
|
-
@Prop({
|
|
82
|
-
type: String,
|
|
83
|
-
enum: ['scheduled', 'published', 'late', 'cancelled'],
|
|
84
|
-
required: true,
|
|
85
|
-
})
|
|
86
|
-
status: 'scheduled' | 'published' | 'late' | 'cancelled';
|
|
87
|
-
|
|
88
|
-
@ApiProperty({ example: '64bfc3a78d3f1e2a12345680', required: false })
|
|
89
|
-
@Prop({ type: MongooseSchema.Types.ObjectId, required: false })
|
|
90
|
-
contentId?: Types.ObjectId | Content;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const ScheduledPostSchema = SchemaFactory.createForClass(ScheduledPost);
|
|
94
57
|
|
|
95
58
|
@Schema({ timestamps: true })
|
|
96
59
|
export class Action {
|
|
@@ -230,10 +193,6 @@ export class Action {
|
|
|
230
193
|
@Prop({ type: String, required: false })
|
|
231
194
|
primetagId?: string;
|
|
232
195
|
|
|
233
|
-
@ApiProperty({ type: () => [ScheduledPost], required: false })
|
|
234
|
-
@Prop({ type: [ScheduledPostSchema], required: false })
|
|
235
|
-
scheduledPosts?: ScheduledPost[];
|
|
236
|
-
|
|
237
196
|
@ApiProperty({ example: ['#trending', '#viral'], required: false })
|
|
238
197
|
@Prop({ type: [String], required: false })
|
|
239
198
|
hashtags?: string[];
|
|
@@ -264,4 +223,12 @@ export class Action {
|
|
|
264
223
|
}
|
|
265
224
|
|
|
266
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
|
+
|
|
267
234
|
export const ActionModel = MongooseModel('Action', ActionSchema);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
|
|
3
|
+
import { Client } from './client.schema';
|
|
4
|
+
|
|
5
|
+
export type BenchmarkMetric = 'reach' | 'er' | 'cpi' | 'cpe';
|
|
6
|
+
export type BenchmarkMode = 'organic' | 'paid';
|
|
7
|
+
export type BenchmarkDocument = HydratedDocument<Benchmark>;
|
|
8
|
+
|
|
9
|
+
@Schema({ timestamps: true })
|
|
10
|
+
export class Benchmark {
|
|
11
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
12
|
+
_id?: Types.ObjectId;
|
|
13
|
+
|
|
14
|
+
@Prop({ type: String, required: true })
|
|
15
|
+
format: string;
|
|
16
|
+
|
|
17
|
+
@Prop({ type: String, enum: ['organic', 'paid'], required: true })
|
|
18
|
+
mode: BenchmarkMode;
|
|
19
|
+
|
|
20
|
+
@Prop({ type: String, enum: ['reach', 'er', 'cpi', 'cpe'], required: true })
|
|
21
|
+
metric: BenchmarkMetric;
|
|
22
|
+
|
|
23
|
+
@Prop({ type: Number, required: true })
|
|
24
|
+
bad: number;
|
|
25
|
+
|
|
26
|
+
@Prop({ type: Number, required: true })
|
|
27
|
+
good: number;
|
|
28
|
+
|
|
29
|
+
@Prop({ type: Boolean, required: true })
|
|
30
|
+
inverted: boolean;
|
|
31
|
+
|
|
32
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Client', required: false })
|
|
33
|
+
client?: Types.ObjectId | Client;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const BenchmarkSchema = SchemaFactory.createForClass(Benchmark);
|
|
37
|
+
export const BenchmarkModel = MongooseModel('Benchmark', BenchmarkSchema);
|
|
@@ -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);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
HydratedDocument,
|
|
6
|
+
Schema as MongooseSchema,
|
|
7
|
+
Types,
|
|
8
|
+
model as MongooseModel,
|
|
9
|
+
} from 'mongoose';
|
|
10
|
+
|
|
11
|
+
import { Action } from './action.schema';
|
|
12
|
+
import { Client } from './client.schema';
|
|
13
|
+
import { Content } from './content.schema';
|
|
14
|
+
import { Profile } from './profile.schema';
|
|
15
|
+
import { Recruitment } from './recruitment.schema';
|
|
16
|
+
|
|
17
|
+
export type ScheduleDocument = HydratedDocument<Schedule>;
|
|
18
|
+
|
|
19
|
+
@Schema({ timestamps: true })
|
|
20
|
+
export class Schedule {
|
|
21
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345670' })
|
|
22
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
23
|
+
_id?: Types.ObjectId;
|
|
24
|
+
|
|
25
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345678' })
|
|
26
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Recruitment', required: true })
|
|
27
|
+
recruitmentId: Types.ObjectId | Recruitment;
|
|
28
|
+
|
|
29
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345679' })
|
|
30
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
|
|
31
|
+
profileId: Types.ObjectId | Profile;
|
|
32
|
+
|
|
33
|
+
@ApiProperty({ example: 'instagram' })
|
|
34
|
+
@Prop({ type: String, required: true })
|
|
35
|
+
socialnetwork: string;
|
|
36
|
+
|
|
37
|
+
@ApiProperty({ example: 'reel' })
|
|
38
|
+
@Prop({ type: String, required: true })
|
|
39
|
+
type: string;
|
|
40
|
+
|
|
41
|
+
@ApiProperty({ example: '2025-11-05T14:00:00.000Z' })
|
|
42
|
+
@Prop({ type: Date, required: true })
|
|
43
|
+
scheduledAt: Date;
|
|
44
|
+
|
|
45
|
+
@ApiProperty({ enum: ['scheduled', 'published', 'late', 'cancelled'], example: 'scheduled' })
|
|
46
|
+
@Prop({
|
|
47
|
+
type: String,
|
|
48
|
+
enum: ['scheduled', 'published', 'late', 'cancelled'],
|
|
49
|
+
required: true,
|
|
50
|
+
})
|
|
51
|
+
status: 'scheduled' | 'published' | 'late' | 'cancelled';
|
|
52
|
+
|
|
53
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345680', required: false })
|
|
54
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Content', required: false })
|
|
55
|
+
contentId?: Types.ObjectId | Content;
|
|
56
|
+
|
|
57
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345681' })
|
|
58
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
|
|
59
|
+
actionId: Types.ObjectId | Action;
|
|
60
|
+
|
|
61
|
+
@ApiProperty({ example: '64bfc3a78d3f1e2a12345682' })
|
|
62
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Client', required: true })
|
|
63
|
+
clientId: Types.ObjectId | Client;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const ScheduleSchema = SchemaFactory.createForClass(Schedule);
|
|
67
|
+
|
|
68
|
+
ScheduleSchema.index({ actionId: 1, scheduledAt: 1 });
|
|
69
|
+
ScheduleSchema.index({ clientId: 1 });
|
|
70
|
+
ScheduleSchema.index({ recruitmentId: 1 });
|
|
71
|
+
|
|
72
|
+
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
|
|