@grapadigital/shared-schemas 1.0.192 → 1.0.195
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/schemas/comment.schema.js +5 -1
- package/dist/schemas/content.schema.d.ts +21 -0
- package/dist/schemas/content.schema.js +54 -7
- package/dist/schemas/influencer.schema.d.ts +22 -0
- package/dist/schemas/influencer.schema.js +49 -1
- package/dist/schemas/recruitment.schema.d.ts +1 -0
- package/dist/schemas/recruitment.schema.js +4 -0
- package/package.json +1 -1
- package/src/schemas/comment.schema.ts +5 -1
- package/src/schemas/content.schema.ts +47 -6
- package/src/schemas/influencer.schema.ts +45 -0
- package/src/schemas/recruitment.schema.ts +7 -0
|
@@ -165,7 +165,11 @@ Comment = __decorate([
|
|
|
165
165
|
], Comment);
|
|
166
166
|
exports.Comment = Comment;
|
|
167
167
|
exports.CommentSchema = mongoose_1.SchemaFactory.createForClass(Comment);
|
|
168
|
-
|
|
168
|
+
// partialFilterExpression não aceita $exists:false (só $exists:true) — usamos
|
|
169
|
+
// igualdade com null, que no Mongo casa tanto "campo ausente" quanto "campo
|
|
170
|
+
// null" (cobre o documento original, sem exigir que quem insere via
|
|
171
|
+
// bulkWrite raw declare sourceCommentId explicitamente).
|
|
172
|
+
exports.CommentSchema.index({ content: 1, externalId: 1 }, { unique: true, partialFilterExpression: { sourceCommentId: null } });
|
|
169
173
|
exports.CommentSchema.index({ action: 1, funnel: 1 });
|
|
170
174
|
exports.CommentSchema.index({ action: 1, target: 1 });
|
|
171
175
|
exports.CommentSchema.index({ content: 1, parent: 1 });
|
|
@@ -110,6 +110,19 @@ export declare const MetricsSchema: MongooseSchema<Metrics, import("mongoose").M
|
|
|
110
110
|
} & {
|
|
111
111
|
__v: number;
|
|
112
112
|
}>;
|
|
113
|
+
export declare class ContentMetricsHistoryEntry {
|
|
114
|
+
metrics: Metrics;
|
|
115
|
+
recordedAt: Date;
|
|
116
|
+
}
|
|
117
|
+
export declare const ContentMetricsHistoryEntrySchema: MongooseSchema<ContentMetricsHistoryEntry, import("mongoose").Model<ContentMetricsHistoryEntry, any, any, any, import("mongoose").Document<unknown, any, ContentMetricsHistoryEntry, any, {}> & ContentMetricsHistoryEntry & {
|
|
118
|
+
_id: Types.ObjectId;
|
|
119
|
+
} & {
|
|
120
|
+
__v: number;
|
|
121
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentMetricsHistoryEntry, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentMetricsHistoryEntry>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentMetricsHistoryEntry> & {
|
|
122
|
+
_id: Types.ObjectId;
|
|
123
|
+
} & {
|
|
124
|
+
__v: number;
|
|
125
|
+
}>;
|
|
113
126
|
export declare class Estimates {
|
|
114
127
|
impressionCount?: number | null;
|
|
115
128
|
reachCount?: number | null;
|
|
@@ -151,6 +164,14 @@ export declare class Content {
|
|
|
151
164
|
mediaUrl?: string;
|
|
152
165
|
isEdited?: boolean;
|
|
153
166
|
editedAt?: Date;
|
|
167
|
+
followersAtPost?: number | null;
|
|
168
|
+
history?: ContentMetricsHistoryEntry[];
|
|
169
|
+
effectiveReach?: number | null;
|
|
170
|
+
reachPerformance?: number | null;
|
|
171
|
+
qualifiedEngagementRate?: number | null;
|
|
172
|
+
score?: number | null;
|
|
173
|
+
allocatedBudgetAmount?: number | null;
|
|
174
|
+
cpmi?: number | null;
|
|
154
175
|
}
|
|
155
176
|
export declare const ContentSchema: MongooseSchema<Content, import("mongoose").Model<Content, any, any, any, import("mongoose").Document<unknown, any, Content, any, {}> & Content & Required<{
|
|
156
177
|
_id: Types.ObjectId;
|
|
@@ -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.ContentModel = exports.ContentSchema = exports.Content = exports.EstimatesSchema = exports.Estimates = exports.MetricsSchema = exports.Metrics = exports.SentimentAnalysisSchema = exports.SentimentAnalysis = exports.SentimentScoreSchema = exports.SentimentScore = exports.WordCloudSchema = exports.WordCloud = exports.SentimentCommentSchema = exports.SentimentComment = void 0;
|
|
12
|
+
exports.ContentModel = exports.ContentSchema = exports.Content = exports.EstimatesSchema = exports.Estimates = exports.ContentMetricsHistoryEntrySchema = exports.ContentMetricsHistoryEntry = exports.MetricsSchema = exports.Metrics = exports.SentimentAnalysisSchema = exports.SentimentAnalysis = exports.SentimentScoreSchema = exports.SentimentScore = exports.WordCloudSchema = exports.WordCloud = exports.SentimentCommentSchema = exports.SentimentComment = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
15
|
let SentimentComment = class SentimentComment {
|
|
@@ -159,6 +159,21 @@ Metrics = __decorate([
|
|
|
159
159
|
], Metrics);
|
|
160
160
|
exports.Metrics = Metrics;
|
|
161
161
|
exports.MetricsSchema = mongoose_1.SchemaFactory.createForClass(Metrics);
|
|
162
|
+
let ContentMetricsHistoryEntry = class ContentMetricsHistoryEntry {
|
|
163
|
+
};
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, mongoose_1.Prop)({ type: exports.MetricsSchema, required: true }),
|
|
166
|
+
__metadata("design:type", Metrics)
|
|
167
|
+
], ContentMetricsHistoryEntry.prototype, "metrics", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, mongoose_1.Prop)({ type: Date, required: true, default: Date.now }),
|
|
170
|
+
__metadata("design:type", Date)
|
|
171
|
+
], ContentMetricsHistoryEntry.prototype, "recordedAt", void 0);
|
|
172
|
+
ContentMetricsHistoryEntry = __decorate([
|
|
173
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
174
|
+
], ContentMetricsHistoryEntry);
|
|
175
|
+
exports.ContentMetricsHistoryEntry = ContentMetricsHistoryEntry;
|
|
176
|
+
exports.ContentMetricsHistoryEntrySchema = mongoose_1.SchemaFactory.createForClass(ContentMetricsHistoryEntry);
|
|
162
177
|
let Estimates = class Estimates {
|
|
163
178
|
};
|
|
164
179
|
__decorate([
|
|
@@ -189,11 +204,11 @@ __decorate([
|
|
|
189
204
|
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
190
205
|
], Content.prototype, "_id", void 0);
|
|
191
206
|
__decorate([
|
|
192
|
-
(0, mongoose_1.Prop)({
|
|
207
|
+
(0, mongoose_1.Prop)({ type: String, required: false, default: '' }),
|
|
193
208
|
__metadata("design:type", String)
|
|
194
209
|
], Content.prototype, "caption", void 0);
|
|
195
210
|
__decorate([
|
|
196
|
-
(0, mongoose_1.Prop)({
|
|
211
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
197
212
|
__metadata("design:type", String)
|
|
198
213
|
], Content.prototype, "link", void 0);
|
|
199
214
|
__decorate([
|
|
@@ -238,19 +253,19 @@ __decorate([
|
|
|
238
253
|
__metadata("design:type", Object)
|
|
239
254
|
], Content.prototype, "action", void 0);
|
|
240
255
|
__decorate([
|
|
241
|
-
(0, mongoose_1.Prop)({
|
|
256
|
+
(0, mongoose_1.Prop)({ type: Date, required: true }),
|
|
242
257
|
__metadata("design:type", Date)
|
|
243
258
|
], Content.prototype, "postedAt", void 0);
|
|
244
259
|
__decorate([
|
|
245
|
-
(0, mongoose_1.Prop)({
|
|
260
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
|
|
246
261
|
__metadata("design:type", Boolean)
|
|
247
262
|
], Content.prototype, "isCollab", void 0);
|
|
248
263
|
__decorate([
|
|
249
|
-
(0, mongoose_1.Prop)({
|
|
264
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
|
|
250
265
|
__metadata("design:type", Boolean)
|
|
251
266
|
], Content.prototype, "isBoosted", void 0);
|
|
252
267
|
__decorate([
|
|
253
|
-
(0, mongoose_1.Prop)({
|
|
268
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
|
|
254
269
|
__metadata("design:type", Boolean)
|
|
255
270
|
], Content.prototype, "hasAffiliateLink", void 0);
|
|
256
271
|
__decorate([
|
|
@@ -303,6 +318,38 @@ __decorate([
|
|
|
303
318
|
(0, mongoose_1.Prop)({ type: Date, required: false }),
|
|
304
319
|
__metadata("design:type", Date)
|
|
305
320
|
], Content.prototype, "editedAt", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
323
|
+
__metadata("design:type", Object)
|
|
324
|
+
], Content.prototype, "followersAtPost", void 0);
|
|
325
|
+
__decorate([
|
|
326
|
+
(0, mongoose_1.Prop)({ type: [exports.ContentMetricsHistoryEntrySchema], required: false, default: [] }),
|
|
327
|
+
__metadata("design:type", Array)
|
|
328
|
+
], Content.prototype, "history", void 0);
|
|
329
|
+
__decorate([
|
|
330
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
331
|
+
__metadata("design:type", Object)
|
|
332
|
+
], Content.prototype, "effectiveReach", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
335
|
+
__metadata("design:type", Object)
|
|
336
|
+
], Content.prototype, "reachPerformance", void 0);
|
|
337
|
+
__decorate([
|
|
338
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
339
|
+
__metadata("design:type", Object)
|
|
340
|
+
], Content.prototype, "qualifiedEngagementRate", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
343
|
+
__metadata("design:type", Object)
|
|
344
|
+
], Content.prototype, "score", void 0);
|
|
345
|
+
__decorate([
|
|
346
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
347
|
+
__metadata("design:type", Object)
|
|
348
|
+
], Content.prototype, "allocatedBudgetAmount", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
351
|
+
__metadata("design:type", Object)
|
|
352
|
+
], Content.prototype, "cpmi", void 0);
|
|
306
353
|
Content = __decorate([
|
|
307
354
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
308
355
|
], Content);
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
|
|
27
27
|
import { Profile } from './profile.schema';
|
|
28
28
|
import { Party } from './party.schema';
|
|
29
|
+
import { Client } from './client.schema';
|
|
30
|
+
import { Delivery } from './recruitment.schema';
|
|
29
31
|
export type InfluencerDocument = HydratedDocument<Influencer>;
|
|
30
32
|
export declare class Advisor {
|
|
31
33
|
email: string;
|
|
@@ -60,12 +62,32 @@ export declare const NoteSchema: MongooseSchema<Note, import("mongoose").Model<N
|
|
|
60
62
|
} & {
|
|
61
63
|
__v: number;
|
|
62
64
|
}>;
|
|
65
|
+
export declare class InfluencerContract {
|
|
66
|
+
_id?: Types.ObjectId;
|
|
67
|
+
client: Types.ObjectId | Client;
|
|
68
|
+
value: number;
|
|
69
|
+
periodType: 'monthly' | 'annual';
|
|
70
|
+
startDate: Date;
|
|
71
|
+
endDate?: Date;
|
|
72
|
+
deliveryScope?: Delivery;
|
|
73
|
+
documentUrl?: string;
|
|
74
|
+
}
|
|
75
|
+
export declare const InfluencerContractSchema: MongooseSchema<InfluencerContract, import("mongoose").Model<InfluencerContract, any, any, any, import("mongoose").Document<unknown, any, InfluencerContract, any, {}> & InfluencerContract & Required<{
|
|
76
|
+
_id: Types.ObjectId;
|
|
77
|
+
}> & {
|
|
78
|
+
__v: number;
|
|
79
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, InfluencerContract, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<InfluencerContract>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<InfluencerContract> & Required<{
|
|
80
|
+
_id: Types.ObjectId;
|
|
81
|
+
}> & {
|
|
82
|
+
__v: number;
|
|
83
|
+
}>;
|
|
63
84
|
export declare class Influencer extends Party {
|
|
64
85
|
financialManagementSheet?: string;
|
|
65
86
|
isExclusive: boolean;
|
|
66
87
|
advisor?: Advisor;
|
|
67
88
|
profiles?: Types.ObjectId[] | Profile[];
|
|
68
89
|
notes?: Note[];
|
|
90
|
+
contracts?: InfluencerContract[];
|
|
69
91
|
}
|
|
70
92
|
export declare const InfluencerSchema: MongooseSchema<Influencer, import("mongoose").Model<Influencer, any, any, any, import("mongoose").Document<unknown, any, Influencer, any, {}> & Influencer & Required<{
|
|
71
93
|
_id: Types.ObjectId;
|
|
@@ -9,10 +9,11 @@ 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.InfluencerModel = exports.InfluencerSchema = exports.Influencer = exports.NoteSchema = exports.Note = exports.AdvisorSchema = exports.Advisor = void 0;
|
|
12
|
+
exports.InfluencerModel = exports.InfluencerSchema = exports.Influencer = exports.InfluencerContractSchema = exports.InfluencerContract = exports.NoteSchema = exports.Note = exports.AdvisorSchema = exports.Advisor = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
15
|
const party_schema_1 = require("./party.schema");
|
|
16
|
+
const recruitment_schema_1 = require("./recruitment.schema");
|
|
16
17
|
let Advisor = class Advisor {
|
|
17
18
|
};
|
|
18
19
|
__decorate([
|
|
@@ -71,6 +72,49 @@ Note = __decorate([
|
|
|
71
72
|
], Note);
|
|
72
73
|
exports.Note = Note;
|
|
73
74
|
exports.NoteSchema = mongoose_1.SchemaFactory.createForClass(Note);
|
|
75
|
+
// Contrato de valor fixo recorrente (influenciador embaixador de marca) —
|
|
76
|
+
// alternativa ao pagamento avulso por Recruitment (scope.payment/advisorPayment).
|
|
77
|
+
// Escopo de entregas reaproveita a mesma classe Delivery do termo de aceite
|
|
78
|
+
// (Recruitment.scope.delivery), pra manter o mesmo vocabulário.
|
|
79
|
+
let InfluencerContract = class InfluencerContract {
|
|
80
|
+
};
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
83
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
84
|
+
], InfluencerContract.prototype, "_id", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Client', required: true }),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], InfluencerContract.prototype, "client", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, mongoose_1.Prop)({ type: Number, required: true }),
|
|
91
|
+
__metadata("design:type", Number)
|
|
92
|
+
], InfluencerContract.prototype, "value", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, mongoose_1.Prop)({ type: String, enum: ['monthly', 'annual'], required: true }),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], InfluencerContract.prototype, "periodType", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, mongoose_1.Prop)({ type: Date, required: true }),
|
|
99
|
+
__metadata("design:type", Date)
|
|
100
|
+
], InfluencerContract.prototype, "startDate", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, mongoose_1.Prop)({ type: Date, required: false }),
|
|
103
|
+
__metadata("design:type", Date)
|
|
104
|
+
], InfluencerContract.prototype, "endDate", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, mongoose_1.Prop)({ type: recruitment_schema_1.DeliverySchema, required: false }),
|
|
107
|
+
__metadata("design:type", recruitment_schema_1.Delivery)
|
|
108
|
+
], InfluencerContract.prototype, "deliveryScope", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
111
|
+
__metadata("design:type", String)
|
|
112
|
+
], InfluencerContract.prototype, "documentUrl", void 0);
|
|
113
|
+
InfluencerContract = __decorate([
|
|
114
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
115
|
+
], InfluencerContract);
|
|
116
|
+
exports.InfluencerContract = InfluencerContract;
|
|
117
|
+
exports.InfluencerContractSchema = mongoose_1.SchemaFactory.createForClass(InfluencerContract);
|
|
74
118
|
let Influencer = class Influencer extends party_schema_1.Party {
|
|
75
119
|
};
|
|
76
120
|
__decorate([
|
|
@@ -95,6 +139,10 @@ __decorate([
|
|
|
95
139
|
(0, mongoose_1.Prop)({ type: [exports.NoteSchema], required: false }),
|
|
96
140
|
__metadata("design:type", Array)
|
|
97
141
|
], Influencer.prototype, "notes", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, mongoose_1.Prop)({ type: [exports.InfluencerContractSchema], required: false }),
|
|
144
|
+
__metadata("design:type", Array)
|
|
145
|
+
], Influencer.prototype, "contracts", void 0);
|
|
98
146
|
Influencer = __decorate([
|
|
99
147
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
100
148
|
], Influencer);
|
|
@@ -198,6 +198,7 @@ export declare class Recruitment {
|
|
|
198
198
|
createdAt?: Date;
|
|
199
199
|
updatedAt?: Date;
|
|
200
200
|
primetagId?: string;
|
|
201
|
+
useAmbassadorContract?: boolean;
|
|
201
202
|
}
|
|
202
203
|
export declare const RecruitmentSchema: MongooseSchema<Recruitment, import("mongoose").Model<Recruitment, any, any, any, import("mongoose").Document<unknown, any, Recruitment, any, {}> & Recruitment & Required<{
|
|
203
204
|
_id: Types.ObjectId;
|
|
@@ -326,6 +326,10 @@ __decorate([
|
|
|
326
326
|
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
327
327
|
__metadata("design:type", String)
|
|
328
328
|
], Recruitment.prototype, "primetagId", void 0);
|
|
329
|
+
__decorate([
|
|
330
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: false, default: false }),
|
|
331
|
+
__metadata("design:type", Boolean)
|
|
332
|
+
], Recruitment.prototype, "useAmbassadorContract", void 0);
|
|
329
333
|
Recruitment = __decorate([
|
|
330
334
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
331
335
|
], Recruitment);
|
package/package.json
CHANGED
|
@@ -143,9 +143,13 @@ export class Comment {
|
|
|
143
143
|
|
|
144
144
|
export const CommentSchema = SchemaFactory.createForClass(Comment);
|
|
145
145
|
|
|
146
|
+
// partialFilterExpression não aceita $exists:false (só $exists:true) — usamos
|
|
147
|
+
// igualdade com null, que no Mongo casa tanto "campo ausente" quanto "campo
|
|
148
|
+
// null" (cobre o documento original, sem exigir que quem insere via
|
|
149
|
+
// bulkWrite raw declare sourceCommentId explicitamente).
|
|
146
150
|
CommentSchema.index(
|
|
147
151
|
{ content: 1, externalId: 1 },
|
|
148
|
-
{ unique: true, partialFilterExpression: { sourceCommentId:
|
|
152
|
+
{ unique: true, partialFilterExpression: { sourceCommentId: null } },
|
|
149
153
|
);
|
|
150
154
|
CommentSchema.index({ action: 1, funnel: 1 });
|
|
151
155
|
CommentSchema.index({ action: 1, target: 1 });
|
|
@@ -119,6 +119,17 @@ export class Metrics {
|
|
|
119
119
|
|
|
120
120
|
export const MetricsSchema = SchemaFactory.createForClass(Metrics);
|
|
121
121
|
|
|
122
|
+
@Schema({ _id: false })
|
|
123
|
+
export class ContentMetricsHistoryEntry {
|
|
124
|
+
@Prop({ type: MetricsSchema, required: true })
|
|
125
|
+
metrics: Metrics;
|
|
126
|
+
|
|
127
|
+
@Prop({ type: Date, required: true, default: Date.now })
|
|
128
|
+
recordedAt: Date;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const ContentMetricsHistoryEntrySchema = SchemaFactory.createForClass(ContentMetricsHistoryEntry);
|
|
132
|
+
|
|
122
133
|
@Schema({ _id: false })
|
|
123
134
|
export class Estimates {
|
|
124
135
|
@Prop({ type: Number, required: true, default: null })
|
|
@@ -141,10 +152,10 @@ export class Content {
|
|
|
141
152
|
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
142
153
|
_id?: Types.ObjectId;
|
|
143
154
|
|
|
144
|
-
@Prop({
|
|
155
|
+
@Prop({ type: String, required: false, default: '' })
|
|
145
156
|
caption?: string;
|
|
146
157
|
|
|
147
|
-
@Prop({
|
|
158
|
+
@Prop({ type: String, required: true })
|
|
148
159
|
link: string;
|
|
149
160
|
|
|
150
161
|
@Prop({
|
|
@@ -182,16 +193,16 @@ export class Content {
|
|
|
182
193
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
|
|
183
194
|
action: Types.ObjectId | Action;
|
|
184
195
|
|
|
185
|
-
@Prop({
|
|
196
|
+
@Prop({ type: Date, required: true })
|
|
186
197
|
postedAt: Date;
|
|
187
198
|
|
|
188
|
-
@Prop({
|
|
199
|
+
@Prop({ type: Boolean, required: true, default: false })
|
|
189
200
|
isCollab: boolean;
|
|
190
201
|
|
|
191
|
-
@Prop({
|
|
202
|
+
@Prop({ type: Boolean, required: true, default: false })
|
|
192
203
|
isBoosted: boolean;
|
|
193
204
|
|
|
194
|
-
@Prop({
|
|
205
|
+
@Prop({ type: Boolean, required: true, default: false })
|
|
195
206
|
hasAffiliateLink: boolean;
|
|
196
207
|
|
|
197
208
|
@Prop([
|
|
@@ -231,6 +242,36 @@ export class Content {
|
|
|
231
242
|
|
|
232
243
|
@Prop({ type: Date, required: false })
|
|
233
244
|
editedAt?: Date;
|
|
245
|
+
|
|
246
|
+
// Snapshot de Profile.followers no momento da promoção — nunca muda depois
|
|
247
|
+
// de setado, usado nos pesos por seguidor das métricas derivadas abaixo.
|
|
248
|
+
@Prop({ type: Number, required: false, default: null })
|
|
249
|
+
followersAtPost?: number | null;
|
|
250
|
+
|
|
251
|
+
// Histórico de versões de `metrics` — cada promoção que NÃO é a primeira
|
|
252
|
+
// empurra o `metrics` anterior (antes de ser sobrescrito) pra cá.
|
|
253
|
+
@Prop({ type: [ContentMetricsHistoryEntrySchema], required: false, default: [] })
|
|
254
|
+
history?: ContentMetricsHistoryEntry[];
|
|
255
|
+
|
|
256
|
+
// Métricas derivadas (calculadas pelo metrics-generator-worker) — ver
|
|
257
|
+
// docs/spec/metrics-generator-worker.md pras fórmulas completas.
|
|
258
|
+
@Prop({ type: Number, required: false, default: null })
|
|
259
|
+
effectiveReach?: number | null;
|
|
260
|
+
|
|
261
|
+
@Prop({ type: Number, required: false, default: null })
|
|
262
|
+
reachPerformance?: number | null;
|
|
263
|
+
|
|
264
|
+
@Prop({ type: Number, required: false, default: null })
|
|
265
|
+
qualifiedEngagementRate?: number | null;
|
|
266
|
+
|
|
267
|
+
@Prop({ type: Number, required: false, default: null })
|
|
268
|
+
score?: number | null;
|
|
269
|
+
|
|
270
|
+
@Prop({ type: Number, required: false, default: null })
|
|
271
|
+
allocatedBudgetAmount?: number | null;
|
|
272
|
+
|
|
273
|
+
@Prop({ type: Number, required: false, default: null })
|
|
274
|
+
cpmi?: number | null;
|
|
234
275
|
}
|
|
235
276
|
|
|
236
277
|
export const ContentSchema = SchemaFactory.createForClass(Content);
|
|
@@ -2,6 +2,8 @@ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
|
2
2
|
import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
|
|
3
3
|
import { Profile } from './profile.schema';
|
|
4
4
|
import { Party } from './party.schema';
|
|
5
|
+
import { Client } from './client.schema';
|
|
6
|
+
import { Delivery, DeliverySchema } from './recruitment.schema';
|
|
5
7
|
|
|
6
8
|
export type InfluencerDocument = HydratedDocument<Influencer>;
|
|
7
9
|
@Schema({ _id: false })
|
|
@@ -45,6 +47,46 @@ export class Note {
|
|
|
45
47
|
|
|
46
48
|
export const NoteSchema = SchemaFactory.createForClass(Note);
|
|
47
49
|
|
|
50
|
+
// Contrato de valor fixo recorrente (influenciador embaixador de marca) —
|
|
51
|
+
// alternativa ao pagamento avulso por Recruitment (scope.payment/advisorPayment).
|
|
52
|
+
// Escopo de entregas reaproveita a mesma classe Delivery do termo de aceite
|
|
53
|
+
// (Recruitment.scope.delivery), pra manter o mesmo vocabulário.
|
|
54
|
+
@Schema({ timestamps: true })
|
|
55
|
+
export class InfluencerContract {
|
|
56
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
57
|
+
_id?: Types.ObjectId;
|
|
58
|
+
|
|
59
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Client', required: true })
|
|
60
|
+
client: Types.ObjectId | Client;
|
|
61
|
+
|
|
62
|
+
@Prop({ type: Number, required: true })
|
|
63
|
+
value: number;
|
|
64
|
+
|
|
65
|
+
@Prop({ type: String, enum: ['monthly', 'annual'], required: true })
|
|
66
|
+
periodType: 'monthly' | 'annual';
|
|
67
|
+
|
|
68
|
+
@Prop({ type: Date, required: true })
|
|
69
|
+
startDate: Date;
|
|
70
|
+
|
|
71
|
+
// Ausente = contrato em aberto/vigente.
|
|
72
|
+
@Prop({ type: Date, required: false })
|
|
73
|
+
endDate?: Date;
|
|
74
|
+
|
|
75
|
+
// Ausente/não preenchido = sem limite de escopo (denominador do rateio usa
|
|
76
|
+
// a contagem real de contents entregues no período); presente = soma de
|
|
77
|
+
// todos os campos preenchidos vira o denominador fixo (ex.: reels:1 + stories:3 = 4).
|
|
78
|
+
@Prop({ type: DeliverySchema, required: false })
|
|
79
|
+
deliveryScope?: Delivery;
|
|
80
|
+
|
|
81
|
+
// URL do documento do contrato (upload feito fora daqui, ex.: S3/GCS pela
|
|
82
|
+
// futura tela de "Contratos" no perfil do influenciador) — só a referência
|
|
83
|
+
// fica salva no Mongo.
|
|
84
|
+
@Prop({ type: String, required: false })
|
|
85
|
+
documentUrl?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const InfluencerContractSchema = SchemaFactory.createForClass(InfluencerContract);
|
|
89
|
+
|
|
48
90
|
@Schema({ timestamps: true })
|
|
49
91
|
export class Influencer extends Party {
|
|
50
92
|
@Prop({ required: false })
|
|
@@ -63,6 +105,9 @@ export class Influencer extends Party {
|
|
|
63
105
|
|
|
64
106
|
@Prop({ type: [NoteSchema], required: false })
|
|
65
107
|
notes?: Note[];
|
|
108
|
+
|
|
109
|
+
@Prop({ type: [InfluencerContractSchema], required: false })
|
|
110
|
+
contracts?: InfluencerContract[];
|
|
66
111
|
}
|
|
67
112
|
|
|
68
113
|
export const InfluencerSchema = SchemaFactory.createForClass(Influencer);
|
|
@@ -214,6 +214,13 @@ export class Recruitment {
|
|
|
214
214
|
|
|
215
215
|
@Prop({ type: String, required: false })
|
|
216
216
|
primetagId?: string;
|
|
217
|
+
|
|
218
|
+
// Toggle: paga via contrato de embaixador do influenciador (valor fixo
|
|
219
|
+
// recorrente, ver Influencer.contracts) em vez de scope.payment/advisorPayment.
|
|
220
|
+
// Só pode haver 1 contrato ativo por (influencer, client) ao mesmo tempo,
|
|
221
|
+
// então não precisa referenciar um contrato específico por _id.
|
|
222
|
+
@Prop({ type: Boolean, required: false, default: false })
|
|
223
|
+
useAmbassadorContract?: boolean;
|
|
217
224
|
}
|
|
218
225
|
|
|
219
226
|
export const RecruitmentSchema = SchemaFactory.createForClass(Recruitment);
|