@grapadigital/shared-schemas 1.0.193 → 1.0.196
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/content.schema.d.ts +23 -0
- package/dist/schemas/content.schema.js +62 -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/content.schema.ts +53 -6
- package/src/schemas/influencer.schema.ts +45 -0
- package/src/schemas/recruitment.schema.ts +7 -0
|
@@ -100,6 +100,14 @@ export declare class Metrics {
|
|
|
100
100
|
emv?: number | null;
|
|
101
101
|
engagementCount?: number | null;
|
|
102
102
|
engagementRate?: number | null;
|
|
103
|
+
effectiveReach?: number | null;
|
|
104
|
+
reachPerformance?: number | null;
|
|
105
|
+
qualifiedEngagementRate?: number | null;
|
|
106
|
+
score?: number | null;
|
|
107
|
+
allocatedBudgetAmount?: number | null;
|
|
108
|
+
cpmi?: number | null;
|
|
109
|
+
cpi?: number | null;
|
|
110
|
+
cpe?: number | null;
|
|
103
111
|
}
|
|
104
112
|
export declare const MetricsSchema: MongooseSchema<Metrics, import("mongoose").Model<Metrics, any, any, any, import("mongoose").Document<unknown, any, Metrics, any, {}> & Metrics & {
|
|
105
113
|
_id: Types.ObjectId;
|
|
@@ -110,6 +118,19 @@ export declare const MetricsSchema: MongooseSchema<Metrics, import("mongoose").M
|
|
|
110
118
|
} & {
|
|
111
119
|
__v: number;
|
|
112
120
|
}>;
|
|
121
|
+
export declare class ContentMetricsHistoryEntry {
|
|
122
|
+
metrics: Metrics;
|
|
123
|
+
recordedAt: Date;
|
|
124
|
+
}
|
|
125
|
+
export declare const ContentMetricsHistoryEntrySchema: MongooseSchema<ContentMetricsHistoryEntry, import("mongoose").Model<ContentMetricsHistoryEntry, any, any, any, import("mongoose").Document<unknown, any, ContentMetricsHistoryEntry, any, {}> & ContentMetricsHistoryEntry & {
|
|
126
|
+
_id: Types.ObjectId;
|
|
127
|
+
} & {
|
|
128
|
+
__v: number;
|
|
129
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentMetricsHistoryEntry, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentMetricsHistoryEntry>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentMetricsHistoryEntry> & {
|
|
130
|
+
_id: Types.ObjectId;
|
|
131
|
+
} & {
|
|
132
|
+
__v: number;
|
|
133
|
+
}>;
|
|
113
134
|
export declare class Estimates {
|
|
114
135
|
impressionCount?: number | null;
|
|
115
136
|
reachCount?: number | null;
|
|
@@ -151,6 +172,8 @@ export declare class Content {
|
|
|
151
172
|
mediaUrl?: string;
|
|
152
173
|
isEdited?: boolean;
|
|
153
174
|
editedAt?: Date;
|
|
175
|
+
followersAtPost?: number | null;
|
|
176
|
+
history?: ContentMetricsHistoryEntry[];
|
|
154
177
|
}
|
|
155
178
|
export declare const ContentSchema: MongooseSchema<Content, import("mongoose").Model<Content, any, any, any, import("mongoose").Document<unknown, any, Content, any, {}> & Content & Required<{
|
|
156
179
|
_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 {
|
|
@@ -154,11 +154,58 @@ __decorate([
|
|
|
154
154
|
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
155
155
|
__metadata("design:type", Object)
|
|
156
156
|
], Metrics.prototype, "engagementRate", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
159
|
+
__metadata("design:type", Object)
|
|
160
|
+
], Metrics.prototype, "effectiveReach", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
163
|
+
__metadata("design:type", Object)
|
|
164
|
+
], Metrics.prototype, "reachPerformance", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
167
|
+
__metadata("design:type", Object)
|
|
168
|
+
], Metrics.prototype, "qualifiedEngagementRate", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
171
|
+
__metadata("design:type", Object)
|
|
172
|
+
], Metrics.prototype, "score", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
175
|
+
__metadata("design:type", Object)
|
|
176
|
+
], Metrics.prototype, "allocatedBudgetAmount", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
179
|
+
__metadata("design:type", Object)
|
|
180
|
+
], Metrics.prototype, "cpmi", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
183
|
+
__metadata("design:type", Object)
|
|
184
|
+
], Metrics.prototype, "cpi", void 0);
|
|
185
|
+
__decorate([
|
|
186
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
187
|
+
__metadata("design:type", Object)
|
|
188
|
+
], Metrics.prototype, "cpe", void 0);
|
|
157
189
|
Metrics = __decorate([
|
|
158
190
|
(0, mongoose_1.Schema)({ _id: false })
|
|
159
191
|
], Metrics);
|
|
160
192
|
exports.Metrics = Metrics;
|
|
161
193
|
exports.MetricsSchema = mongoose_1.SchemaFactory.createForClass(Metrics);
|
|
194
|
+
let ContentMetricsHistoryEntry = class ContentMetricsHistoryEntry {
|
|
195
|
+
};
|
|
196
|
+
__decorate([
|
|
197
|
+
(0, mongoose_1.Prop)({ type: exports.MetricsSchema, required: true }),
|
|
198
|
+
__metadata("design:type", Metrics)
|
|
199
|
+
], ContentMetricsHistoryEntry.prototype, "metrics", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, mongoose_1.Prop)({ type: Date, required: true, default: Date.now }),
|
|
202
|
+
__metadata("design:type", Date)
|
|
203
|
+
], ContentMetricsHistoryEntry.prototype, "recordedAt", void 0);
|
|
204
|
+
ContentMetricsHistoryEntry = __decorate([
|
|
205
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
206
|
+
], ContentMetricsHistoryEntry);
|
|
207
|
+
exports.ContentMetricsHistoryEntry = ContentMetricsHistoryEntry;
|
|
208
|
+
exports.ContentMetricsHistoryEntrySchema = mongoose_1.SchemaFactory.createForClass(ContentMetricsHistoryEntry);
|
|
162
209
|
let Estimates = class Estimates {
|
|
163
210
|
};
|
|
164
211
|
__decorate([
|
|
@@ -189,11 +236,11 @@ __decorate([
|
|
|
189
236
|
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
190
237
|
], Content.prototype, "_id", void 0);
|
|
191
238
|
__decorate([
|
|
192
|
-
(0, mongoose_1.Prop)({
|
|
239
|
+
(0, mongoose_1.Prop)({ type: String, required: false, default: '' }),
|
|
193
240
|
__metadata("design:type", String)
|
|
194
241
|
], Content.prototype, "caption", void 0);
|
|
195
242
|
__decorate([
|
|
196
|
-
(0, mongoose_1.Prop)({
|
|
243
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
197
244
|
__metadata("design:type", String)
|
|
198
245
|
], Content.prototype, "link", void 0);
|
|
199
246
|
__decorate([
|
|
@@ -238,19 +285,19 @@ __decorate([
|
|
|
238
285
|
__metadata("design:type", Object)
|
|
239
286
|
], Content.prototype, "action", void 0);
|
|
240
287
|
__decorate([
|
|
241
|
-
(0, mongoose_1.Prop)({
|
|
288
|
+
(0, mongoose_1.Prop)({ type: Date, required: true }),
|
|
242
289
|
__metadata("design:type", Date)
|
|
243
290
|
], Content.prototype, "postedAt", void 0);
|
|
244
291
|
__decorate([
|
|
245
|
-
(0, mongoose_1.Prop)({
|
|
292
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
|
|
246
293
|
__metadata("design:type", Boolean)
|
|
247
294
|
], Content.prototype, "isCollab", void 0);
|
|
248
295
|
__decorate([
|
|
249
|
-
(0, mongoose_1.Prop)({
|
|
296
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
|
|
250
297
|
__metadata("design:type", Boolean)
|
|
251
298
|
], Content.prototype, "isBoosted", void 0);
|
|
252
299
|
__decorate([
|
|
253
|
-
(0, mongoose_1.Prop)({
|
|
300
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
|
|
254
301
|
__metadata("design:type", Boolean)
|
|
255
302
|
], Content.prototype, "hasAffiliateLink", void 0);
|
|
256
303
|
__decorate([
|
|
@@ -303,6 +350,14 @@ __decorate([
|
|
|
303
350
|
(0, mongoose_1.Prop)({ type: Date, required: false }),
|
|
304
351
|
__metadata("design:type", Date)
|
|
305
352
|
], Content.prototype, "editedAt", void 0);
|
|
353
|
+
__decorate([
|
|
354
|
+
(0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
|
|
355
|
+
__metadata("design:type", Object)
|
|
356
|
+
], Content.prototype, "followersAtPost", void 0);
|
|
357
|
+
__decorate([
|
|
358
|
+
(0, mongoose_1.Prop)({ type: [exports.ContentMetricsHistoryEntrySchema], required: false, default: [] }),
|
|
359
|
+
__metadata("design:type", Array)
|
|
360
|
+
], Content.prototype, "history", void 0);
|
|
306
361
|
Content = __decorate([
|
|
307
362
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
308
363
|
], 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
|
@@ -115,10 +115,47 @@ export class Metrics {
|
|
|
115
115
|
|
|
116
116
|
@Prop({ type: Number, required: false, default: null })
|
|
117
117
|
engagementRate?: number | null;
|
|
118
|
+
|
|
119
|
+
// Métricas derivadas (calculadas pelo metrics-generator-worker) — ver
|
|
120
|
+
// docs/spec/metrics-generator-worker.md pras fórmulas completas.
|
|
121
|
+
@Prop({ type: Number, required: false, default: null })
|
|
122
|
+
effectiveReach?: number | null;
|
|
123
|
+
|
|
124
|
+
@Prop({ type: Number, required: false, default: null })
|
|
125
|
+
reachPerformance?: number | null;
|
|
126
|
+
|
|
127
|
+
@Prop({ type: Number, required: false, default: null })
|
|
128
|
+
qualifiedEngagementRate?: number | null;
|
|
129
|
+
|
|
130
|
+
@Prop({ type: Number, required: false, default: null })
|
|
131
|
+
score?: number | null;
|
|
132
|
+
|
|
133
|
+
@Prop({ type: Number, required: false, default: null })
|
|
134
|
+
allocatedBudgetAmount?: number | null;
|
|
135
|
+
|
|
136
|
+
@Prop({ type: Number, required: false, default: null })
|
|
137
|
+
cpmi?: number | null;
|
|
138
|
+
|
|
139
|
+
@Prop({ type: Number, required: false, default: null })
|
|
140
|
+
cpi?: number | null;
|
|
141
|
+
|
|
142
|
+
@Prop({ type: Number, required: false, default: null })
|
|
143
|
+
cpe?: number | null;
|
|
118
144
|
}
|
|
119
145
|
|
|
120
146
|
export const MetricsSchema = SchemaFactory.createForClass(Metrics);
|
|
121
147
|
|
|
148
|
+
@Schema({ _id: false })
|
|
149
|
+
export class ContentMetricsHistoryEntry {
|
|
150
|
+
@Prop({ type: MetricsSchema, required: true })
|
|
151
|
+
metrics: Metrics;
|
|
152
|
+
|
|
153
|
+
@Prop({ type: Date, required: true, default: Date.now })
|
|
154
|
+
recordedAt: Date;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const ContentMetricsHistoryEntrySchema = SchemaFactory.createForClass(ContentMetricsHistoryEntry);
|
|
158
|
+
|
|
122
159
|
@Schema({ _id: false })
|
|
123
160
|
export class Estimates {
|
|
124
161
|
@Prop({ type: Number, required: true, default: null })
|
|
@@ -141,10 +178,10 @@ export class Content {
|
|
|
141
178
|
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
142
179
|
_id?: Types.ObjectId;
|
|
143
180
|
|
|
144
|
-
@Prop({
|
|
181
|
+
@Prop({ type: String, required: false, default: '' })
|
|
145
182
|
caption?: string;
|
|
146
183
|
|
|
147
|
-
@Prop({
|
|
184
|
+
@Prop({ type: String, required: true })
|
|
148
185
|
link: string;
|
|
149
186
|
|
|
150
187
|
@Prop({
|
|
@@ -182,16 +219,16 @@ export class Content {
|
|
|
182
219
|
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
|
|
183
220
|
action: Types.ObjectId | Action;
|
|
184
221
|
|
|
185
|
-
@Prop({
|
|
222
|
+
@Prop({ type: Date, required: true })
|
|
186
223
|
postedAt: Date;
|
|
187
224
|
|
|
188
|
-
@Prop({
|
|
225
|
+
@Prop({ type: Boolean, required: true, default: false })
|
|
189
226
|
isCollab: boolean;
|
|
190
227
|
|
|
191
|
-
@Prop({
|
|
228
|
+
@Prop({ type: Boolean, required: true, default: false })
|
|
192
229
|
isBoosted: boolean;
|
|
193
230
|
|
|
194
|
-
@Prop({
|
|
231
|
+
@Prop({ type: Boolean, required: true, default: false })
|
|
195
232
|
hasAffiliateLink: boolean;
|
|
196
233
|
|
|
197
234
|
@Prop([
|
|
@@ -231,6 +268,16 @@ export class Content {
|
|
|
231
268
|
|
|
232
269
|
@Prop({ type: Date, required: false })
|
|
233
270
|
editedAt?: Date;
|
|
271
|
+
|
|
272
|
+
// Snapshot de Profile.followers no momento da promoção — nunca muda depois
|
|
273
|
+
// de setado, usado nos pesos por seguidor das métricas derivadas abaixo.
|
|
274
|
+
@Prop({ type: Number, required: false, default: null })
|
|
275
|
+
followersAtPost?: number | null;
|
|
276
|
+
|
|
277
|
+
// Histórico de versões de `metrics` — cada promoção que NÃO é a primeira
|
|
278
|
+
// empurra o `metrics` anterior (antes de ser sobrescrito) pra cá.
|
|
279
|
+
@Prop({ type: [ContentMetricsHistoryEntrySchema], required: false, default: [] })
|
|
280
|
+
history?: ContentMetricsHistoryEntry[];
|
|
234
281
|
}
|
|
235
282
|
|
|
236
283
|
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);
|