@grapadigital/shared-schemas 1.0.200 → 1.0.202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/schemas/client.schema.d.ts +1 -0
- package/dist/schemas/client.schema.js +4 -0
- package/dist/schemas/commission.schema.d.ts +1 -0
- package/dist/schemas/commission.schema.js +4 -0
- package/dist/schemas/lead.schema.d.ts +281 -0
- package/dist/schemas/lead.schema.js +456 -0
- package/dist/schemas/profile-followers-snapshot.schema.d.ts +67 -0
- package/dist/schemas/profile-followers-snapshot.schema.js +65 -0
- package/dist/schemas/profile.schema.d.ts +3 -0
- package/dist/schemas/profile.schema.js +12 -0
- package/dist/schemas/sale.schema.d.ts +19 -0
- package/dist/schemas/sale.schema.js +57 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/schemas/client.schema.ts +3 -0
- package/src/schemas/commission.schema.ts +3 -0
- package/src/schemas/lead.schema.ts +354 -0
- package/src/schemas/profile-followers-snapshot.schema.ts +55 -0
- package/src/schemas/profile.schema.ts +10 -0
- package/src/schemas/sale.schema.ts +51 -0
|
@@ -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.SaleModel = exports.SaleSchema = exports.Sale = exports.Inbox = exports.CommissionInfo = exports.CommissionParticipant = exports.TimelineEntry = exports.Activity = exports.Lost = exports.Formalization = exports.Negotiation = exports.Proposal = void 0;
|
|
12
|
+
exports.SaleModel = exports.SaleSchema = exports.Sale = exports.SaleLinks = exports.SaleResponsables = exports.Inbox = exports.CommissionInfo = exports.CommissionParticipant = exports.TimelineEntry = exports.Activity = exports.Lost = exports.Formalization = exports.Negotiation = exports.Proposal = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const mongoose_2 = require("mongoose");
|
|
15
15
|
const note_schema_1 = require("./note.schema");
|
|
@@ -351,6 +351,54 @@ Inbox = __decorate([
|
|
|
351
351
|
(0, mongoose_1.Schema)({ _id: false })
|
|
352
352
|
], Inbox);
|
|
353
353
|
exports.Inbox = Inbox;
|
|
354
|
+
let SaleResponsables = class SaleResponsables {
|
|
355
|
+
};
|
|
356
|
+
__decorate([
|
|
357
|
+
(0, mongoose_1.Prop)({
|
|
358
|
+
_id: false,
|
|
359
|
+
required: false,
|
|
360
|
+
type: {
|
|
361
|
+
team: String,
|
|
362
|
+
name: String,
|
|
363
|
+
email: String,
|
|
364
|
+
},
|
|
365
|
+
}),
|
|
366
|
+
__metadata("design:type", Object)
|
|
367
|
+
], SaleResponsables.prototype, "curation", void 0);
|
|
368
|
+
__decorate([
|
|
369
|
+
(0, mongoose_1.Prop)({
|
|
370
|
+
_id: false,
|
|
371
|
+
required: false,
|
|
372
|
+
type: {
|
|
373
|
+
team: String,
|
|
374
|
+
name: String,
|
|
375
|
+
email: String,
|
|
376
|
+
},
|
|
377
|
+
}),
|
|
378
|
+
__metadata("design:type", Object)
|
|
379
|
+
], SaleResponsables.prototype, "planning", void 0);
|
|
380
|
+
SaleResponsables = __decorate([
|
|
381
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
382
|
+
], SaleResponsables);
|
|
383
|
+
exports.SaleResponsables = SaleResponsables;
|
|
384
|
+
let SaleLinks = class SaleLinks {
|
|
385
|
+
};
|
|
386
|
+
__decorate([
|
|
387
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
388
|
+
__metadata("design:type", String)
|
|
389
|
+
], SaleLinks.prototype, "contract", void 0);
|
|
390
|
+
__decorate([
|
|
391
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
392
|
+
__metadata("design:type", String)
|
|
393
|
+
], SaleLinks.prototype, "clientSheet", void 0);
|
|
394
|
+
__decorate([
|
|
395
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
396
|
+
__metadata("design:type", String)
|
|
397
|
+
], SaleLinks.prototype, "internalSheet", void 0);
|
|
398
|
+
SaleLinks = __decorate([
|
|
399
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
400
|
+
], SaleLinks);
|
|
401
|
+
exports.SaleLinks = SaleLinks;
|
|
354
402
|
let Sale = class Sale {
|
|
355
403
|
};
|
|
356
404
|
__decorate([
|
|
@@ -461,6 +509,14 @@ __decorate([
|
|
|
461
509
|
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
462
510
|
__metadata("design:type", String)
|
|
463
511
|
], Sale.prototype, "omieId", void 0);
|
|
512
|
+
__decorate([
|
|
513
|
+
(0, mongoose_1.Prop)({ type: SaleResponsables, required: false }),
|
|
514
|
+
__metadata("design:type", SaleResponsables)
|
|
515
|
+
], Sale.prototype, "responsables", void 0);
|
|
516
|
+
__decorate([
|
|
517
|
+
(0, mongoose_1.Prop)({ type: SaleLinks, required: false }),
|
|
518
|
+
__metadata("design:type", SaleLinks)
|
|
519
|
+
], Sale.prototype, "links", void 0);
|
|
464
520
|
Sale = __decorate([
|
|
465
521
|
(0, mongoose_1.Schema)({ timestamps: true })
|
|
466
522
|
], Sale);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -31,3 +31,5 @@ export { Note, NoteSchema, NoteMention, NoteMentionSchema } from './schemas/note
|
|
|
31
31
|
export * from './schemas/content-capture-process.schema';
|
|
32
32
|
export * from './schemas/content-draft.schema';
|
|
33
33
|
export * from './schemas/export-comments-job.schema';
|
|
34
|
+
export * from './schemas/profile-followers-snapshot.schema';
|
|
35
|
+
export * from './schemas/lead.schema';
|
|
@@ -133,6 +133,9 @@ export class Client extends Party {
|
|
|
133
133
|
|
|
134
134
|
@Prop({ type: ResponsableSchema, required: false })
|
|
135
135
|
reportResponsable?: Responsable;
|
|
136
|
+
|
|
137
|
+
@Prop({ type: String, required: false })
|
|
138
|
+
brandResponsable?: string;
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
export const ClientSchema = SchemaFactory.createForClass(Client);
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import { HydratedDocument, Types, model as MongooseModel } from 'mongoose';
|
|
3
|
+
|
|
4
|
+
// Lead = briefing de campanha preenchido pelo cliente numa página pública (GD-616).
|
|
5
|
+
// O acesso público é sempre pelo accessToken, nunca pelo _id.
|
|
6
|
+
|
|
7
|
+
export const LEAD_STATUS_VALUES = ['draft', 'submitted'] as const;
|
|
8
|
+
export type LeadStatus = (typeof LEAD_STATUS_VALUES)[number];
|
|
9
|
+
|
|
10
|
+
export const LEAD_PRESENTATION_FORMAT_VALUES = ['online', 'in_person', 'email_only'] as const;
|
|
11
|
+
export type LeadPresentationFormat = (typeof LEAD_PRESENTATION_FORMAT_VALUES)[number];
|
|
12
|
+
|
|
13
|
+
export const LEAD_PAYMENT_TERM_VALUES = [30, 60, 90, 120] as const;
|
|
14
|
+
export type LeadPaymentTerm = (typeof LEAD_PAYMENT_TERM_VALUES)[number];
|
|
15
|
+
|
|
16
|
+
export const LEAD_DELIVERABLE_VALUES = [
|
|
17
|
+
'content_strategy',
|
|
18
|
+
'ppt_presentation',
|
|
19
|
+
'curation_sheet',
|
|
20
|
+
'production_sheet',
|
|
21
|
+
] as const;
|
|
22
|
+
export type LeadDeliverable = (typeof LEAD_DELIVERABLE_VALUES)[number];
|
|
23
|
+
|
|
24
|
+
export const LEAD_GOAL_VALUES = ['awareness', 'consideration', 'intent'] as const;
|
|
25
|
+
export type LeadGoal = (typeof LEAD_GOAL_VALUES)[number];
|
|
26
|
+
|
|
27
|
+
export const LEAD_CHANNEL_VALUES = ['online', 'offline'] as const;
|
|
28
|
+
export type LeadChannel = (typeof LEAD_CHANNEL_VALUES)[number];
|
|
29
|
+
|
|
30
|
+
export const LEAD_RIGHT_VALUES = [
|
|
31
|
+
'influencer_collab',
|
|
32
|
+
'brand_collab',
|
|
33
|
+
'client_boost',
|
|
34
|
+
'influencer_boost',
|
|
35
|
+
'segment_exclusivity',
|
|
36
|
+
'image_rights',
|
|
37
|
+
'dark_post',
|
|
38
|
+
'offline',
|
|
39
|
+
] as const;
|
|
40
|
+
export type LeadRight = (typeof LEAD_RIGHT_VALUES)[number];
|
|
41
|
+
|
|
42
|
+
export const LEAD_FOLLOWER_TIER_VALUES = ['heroes', 'macros', 'medios', 'micros', 'nanos', 'nda'] as const;
|
|
43
|
+
export type LeadFollowerTier = (typeof LEAD_FOLLOWER_TIER_VALUES)[number];
|
|
44
|
+
|
|
45
|
+
export const LEAD_SECTION_KEYS = [
|
|
46
|
+
'general',
|
|
47
|
+
'confidentiality',
|
|
48
|
+
'budget',
|
|
49
|
+
'competition',
|
|
50
|
+
'deliverables',
|
|
51
|
+
'strategicContext',
|
|
52
|
+
'objectives',
|
|
53
|
+
'deliveryScope',
|
|
54
|
+
'audience',
|
|
55
|
+
'curation',
|
|
56
|
+
'logistics',
|
|
57
|
+
'contentGuidelines',
|
|
58
|
+
] as const;
|
|
59
|
+
export type LeadSectionKey = (typeof LEAD_SECTION_KEYS)[number];
|
|
60
|
+
|
|
61
|
+
@Schema({ _id: false })
|
|
62
|
+
export class LeadGeneral {
|
|
63
|
+
@Prop({ trim: true })
|
|
64
|
+
advertiser?: string;
|
|
65
|
+
|
|
66
|
+
@Prop({ trim: true })
|
|
67
|
+
brand?: string;
|
|
68
|
+
|
|
69
|
+
@Prop()
|
|
70
|
+
socialProfiles?: string;
|
|
71
|
+
|
|
72
|
+
@Prop({ trim: true })
|
|
73
|
+
campaignName?: string;
|
|
74
|
+
|
|
75
|
+
@Prop()
|
|
76
|
+
language?: string;
|
|
77
|
+
|
|
78
|
+
@Prop()
|
|
79
|
+
materialsUrl?: string;
|
|
80
|
+
|
|
81
|
+
@Prop()
|
|
82
|
+
presentationDate?: Date;
|
|
83
|
+
|
|
84
|
+
@Prop()
|
|
85
|
+
schedule?: string;
|
|
86
|
+
|
|
87
|
+
@Prop({ type: String, enum: LEAD_PRESENTATION_FORMAT_VALUES })
|
|
88
|
+
presentationFormat?: LeadPresentationFormat;
|
|
89
|
+
|
|
90
|
+
@Prop({ trim: true })
|
|
91
|
+
contactName?: string;
|
|
92
|
+
|
|
93
|
+
@Prop({ trim: true, lowercase: true })
|
|
94
|
+
contactEmail?: string;
|
|
95
|
+
}
|
|
96
|
+
export const LeadGeneralSchema = SchemaFactory.createForClass(LeadGeneral);
|
|
97
|
+
|
|
98
|
+
@Schema({ _id: false })
|
|
99
|
+
export class LeadConfidentiality {
|
|
100
|
+
@Prop()
|
|
101
|
+
hasRestriction?: boolean;
|
|
102
|
+
|
|
103
|
+
@Prop()
|
|
104
|
+
restrictionDetails?: string;
|
|
105
|
+
}
|
|
106
|
+
export const LeadConfidentialitySchema = SchemaFactory.createForClass(LeadConfidentiality);
|
|
107
|
+
|
|
108
|
+
@Schema({ _id: false })
|
|
109
|
+
export class LeadBudget {
|
|
110
|
+
@Prop()
|
|
111
|
+
totalBudget?: number;
|
|
112
|
+
|
|
113
|
+
@Prop()
|
|
114
|
+
creatorsBudget?: number;
|
|
115
|
+
|
|
116
|
+
@Prop({ type: Number, enum: LEAD_PAYMENT_TERM_VALUES })
|
|
117
|
+
paymentTerm?: LeadPaymentTerm;
|
|
118
|
+
|
|
119
|
+
@Prop()
|
|
120
|
+
campaignDurationMonths?: number;
|
|
121
|
+
}
|
|
122
|
+
export const LeadBudgetSchema = SchemaFactory.createForClass(LeadBudget);
|
|
123
|
+
|
|
124
|
+
@Schema({ _id: false })
|
|
125
|
+
export class LeadCompetition {
|
|
126
|
+
@Prop()
|
|
127
|
+
isCompetitive?: boolean;
|
|
128
|
+
|
|
129
|
+
@Prop()
|
|
130
|
+
involveAreaLeaders?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export const LeadCompetitionSchema = SchemaFactory.createForClass(LeadCompetition);
|
|
133
|
+
|
|
134
|
+
@Schema({ _id: false })
|
|
135
|
+
export class LeadDeliverables {
|
|
136
|
+
@Prop({ type: [String], enum: LEAD_DELIVERABLE_VALUES, default: undefined })
|
|
137
|
+
types?: LeadDeliverable[];
|
|
138
|
+
}
|
|
139
|
+
export const LeadDeliverablesSchema = SchemaFactory.createForClass(LeadDeliverables);
|
|
140
|
+
|
|
141
|
+
@Schema({ _id: false })
|
|
142
|
+
export class LeadStrategicContext {
|
|
143
|
+
@Prop()
|
|
144
|
+
brandScenario?: string;
|
|
145
|
+
|
|
146
|
+
@Prop()
|
|
147
|
+
productInfo?: string;
|
|
148
|
+
|
|
149
|
+
@Prop()
|
|
150
|
+
parentCampaign?: string;
|
|
151
|
+
|
|
152
|
+
@Prop()
|
|
153
|
+
message?: string;
|
|
154
|
+
|
|
155
|
+
@Prop()
|
|
156
|
+
callToAction?: string;
|
|
157
|
+
|
|
158
|
+
@Prop()
|
|
159
|
+
highlights?: string;
|
|
160
|
+
|
|
161
|
+
@Prop()
|
|
162
|
+
centralChallenge?: string;
|
|
163
|
+
|
|
164
|
+
@Prop()
|
|
165
|
+
tone?: string;
|
|
166
|
+
}
|
|
167
|
+
export const LeadStrategicContextSchema = SchemaFactory.createForClass(LeadStrategicContext);
|
|
168
|
+
|
|
169
|
+
@Schema({ _id: false })
|
|
170
|
+
export class LeadObjectives {
|
|
171
|
+
@Prop({ type: [String], enum: LEAD_GOAL_VALUES, default: undefined })
|
|
172
|
+
goals?: LeadGoal[];
|
|
173
|
+
|
|
174
|
+
@Prop({ type: String, enum: LEAD_GOAL_VALUES })
|
|
175
|
+
primaryGoal?: LeadGoal;
|
|
176
|
+
}
|
|
177
|
+
export const LeadObjectivesSchema = SchemaFactory.createForClass(LeadObjectives);
|
|
178
|
+
|
|
179
|
+
@Schema({ _id: false })
|
|
180
|
+
export class LeadDeliveryScope {
|
|
181
|
+
@Prop({ type: [String], enum: LEAD_CHANNEL_VALUES, default: undefined })
|
|
182
|
+
channels?: LeadChannel[];
|
|
183
|
+
|
|
184
|
+
@Prop()
|
|
185
|
+
primaryNetworks?: string;
|
|
186
|
+
|
|
187
|
+
@Prop()
|
|
188
|
+
secondaryNetworks?: string;
|
|
189
|
+
|
|
190
|
+
@Prop()
|
|
191
|
+
contentPerNetwork?: string;
|
|
192
|
+
|
|
193
|
+
@Prop({ type: [String], enum: LEAD_RIGHT_VALUES, default: undefined })
|
|
194
|
+
rights?: LeadRight[];
|
|
195
|
+
|
|
196
|
+
@Prop()
|
|
197
|
+
imageRightsMonths?: number;
|
|
198
|
+
|
|
199
|
+
@Prop()
|
|
200
|
+
offlineFormats?: string;
|
|
201
|
+
}
|
|
202
|
+
export const LeadDeliveryScopeSchema = SchemaFactory.createForClass(LeadDeliveryScope);
|
|
203
|
+
|
|
204
|
+
@Schema({ _id: false })
|
|
205
|
+
export class LeadAudience {
|
|
206
|
+
@Prop()
|
|
207
|
+
ageRange?: string;
|
|
208
|
+
|
|
209
|
+
@Prop()
|
|
210
|
+
gender?: string;
|
|
211
|
+
|
|
212
|
+
@Prop()
|
|
213
|
+
region?: string;
|
|
214
|
+
|
|
215
|
+
@Prop()
|
|
216
|
+
attitudinalProfile?: string;
|
|
217
|
+
}
|
|
218
|
+
export const LeadAudienceSchema = SchemaFactory.createForClass(LeadAudience);
|
|
219
|
+
|
|
220
|
+
@Schema({ _id: false })
|
|
221
|
+
export class LeadCuration {
|
|
222
|
+
@Prop()
|
|
223
|
+
influencerProfile?: string;
|
|
224
|
+
|
|
225
|
+
@Prop()
|
|
226
|
+
referenceNames?: string;
|
|
227
|
+
|
|
228
|
+
@Prop()
|
|
229
|
+
namesToAvoid?: string;
|
|
230
|
+
|
|
231
|
+
@Prop()
|
|
232
|
+
approveCount?: number;
|
|
233
|
+
|
|
234
|
+
@Prop()
|
|
235
|
+
analyzeCount?: number;
|
|
236
|
+
|
|
237
|
+
@Prop({ type: [String], enum: LEAD_FOLLOWER_TIER_VALUES, default: undefined })
|
|
238
|
+
followerTiers?: LeadFollowerTier[];
|
|
239
|
+
|
|
240
|
+
@Prop()
|
|
241
|
+
competitorBrands?: string;
|
|
242
|
+
|
|
243
|
+
@Prop()
|
|
244
|
+
competitorCheckPeriod?: string;
|
|
245
|
+
|
|
246
|
+
@Prop()
|
|
247
|
+
requirements?: string;
|
|
248
|
+
}
|
|
249
|
+
export const LeadCurationSchema = SchemaFactory.createForClass(LeadCuration);
|
|
250
|
+
|
|
251
|
+
@Schema({ _id: false })
|
|
252
|
+
export class LeadLogistics {
|
|
253
|
+
@Prop()
|
|
254
|
+
productShipping?: string;
|
|
255
|
+
|
|
256
|
+
@Prop()
|
|
257
|
+
eventPresence?: string;
|
|
258
|
+
|
|
259
|
+
@Prop()
|
|
260
|
+
otherLogistics?: string;
|
|
261
|
+
}
|
|
262
|
+
export const LeadLogisticsSchema = SchemaFactory.createForClass(LeadLogistics);
|
|
263
|
+
|
|
264
|
+
@Schema({ _id: false })
|
|
265
|
+
export class LeadContentGuidelines {
|
|
266
|
+
@Prop()
|
|
267
|
+
productionRequirements?: string;
|
|
268
|
+
|
|
269
|
+
@Prop()
|
|
270
|
+
dos?: string;
|
|
271
|
+
|
|
272
|
+
@Prop()
|
|
273
|
+
donts?: string;
|
|
274
|
+
|
|
275
|
+
@Prop()
|
|
276
|
+
mandatoryWords?: string;
|
|
277
|
+
|
|
278
|
+
@Prop()
|
|
279
|
+
forbiddenTopics?: string;
|
|
280
|
+
|
|
281
|
+
@Prop()
|
|
282
|
+
forbiddenWords?: string;
|
|
283
|
+
|
|
284
|
+
@Prop()
|
|
285
|
+
creatorMessage?: string;
|
|
286
|
+
|
|
287
|
+
@Prop()
|
|
288
|
+
additionalDirections?: string;
|
|
289
|
+
}
|
|
290
|
+
export const LeadContentGuidelinesSchema = SchemaFactory.createForClass(LeadContentGuidelines);
|
|
291
|
+
|
|
292
|
+
export type LeadDocument = HydratedDocument<Lead>;
|
|
293
|
+
|
|
294
|
+
@Schema({ timestamps: true, collection: 'leads' })
|
|
295
|
+
export class Lead {
|
|
296
|
+
// select: false para o token nunca sair numa consulta sem pedir explicitamente.
|
|
297
|
+
@Prop({ required: true, unique: true, select: false })
|
|
298
|
+
accessToken: string;
|
|
299
|
+
|
|
300
|
+
@Prop({ type: String, enum: LEAD_STATUS_VALUES, default: 'draft', index: true })
|
|
301
|
+
status: LeadStatus;
|
|
302
|
+
|
|
303
|
+
@Prop({ type: Types.ObjectId, ref: 'Organization', required: true })
|
|
304
|
+
organization: Types.ObjectId;
|
|
305
|
+
|
|
306
|
+
@Prop()
|
|
307
|
+
submittedAt?: Date;
|
|
308
|
+
|
|
309
|
+
@Prop({ index: true })
|
|
310
|
+
lastEditedAt?: Date;
|
|
311
|
+
|
|
312
|
+
@Prop({ type: LeadGeneralSchema, default: {} })
|
|
313
|
+
general: LeadGeneral;
|
|
314
|
+
|
|
315
|
+
@Prop({ type: LeadConfidentialitySchema, default: {} })
|
|
316
|
+
confidentiality: LeadConfidentiality;
|
|
317
|
+
|
|
318
|
+
@Prop({ type: LeadBudgetSchema, default: {} })
|
|
319
|
+
budget: LeadBudget;
|
|
320
|
+
|
|
321
|
+
@Prop({ type: LeadCompetitionSchema, default: {} })
|
|
322
|
+
competition: LeadCompetition;
|
|
323
|
+
|
|
324
|
+
@Prop({ type: LeadDeliverablesSchema, default: {} })
|
|
325
|
+
deliverables: LeadDeliverables;
|
|
326
|
+
|
|
327
|
+
@Prop({ type: LeadStrategicContextSchema, default: {} })
|
|
328
|
+
strategicContext: LeadStrategicContext;
|
|
329
|
+
|
|
330
|
+
@Prop({ type: LeadObjectivesSchema, default: {} })
|
|
331
|
+
objectives: LeadObjectives;
|
|
332
|
+
|
|
333
|
+
@Prop({ type: LeadDeliveryScopeSchema, default: {} })
|
|
334
|
+
deliveryScope: LeadDeliveryScope;
|
|
335
|
+
|
|
336
|
+
@Prop({ type: LeadAudienceSchema, default: {} })
|
|
337
|
+
audience: LeadAudience;
|
|
338
|
+
|
|
339
|
+
@Prop({ type: LeadCurationSchema, default: {} })
|
|
340
|
+
curation: LeadCuration;
|
|
341
|
+
|
|
342
|
+
@Prop({ type: LeadLogisticsSchema, default: {} })
|
|
343
|
+
logistics: LeadLogistics;
|
|
344
|
+
|
|
345
|
+
@Prop({ type: LeadContentGuidelinesSchema, default: {} })
|
|
346
|
+
contentGuidelines: LeadContentGuidelines;
|
|
347
|
+
|
|
348
|
+
createdAt?: Date;
|
|
349
|
+
updatedAt?: Date;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export const LeadSchema = SchemaFactory.createForClass(Lead);
|
|
353
|
+
|
|
354
|
+
export const LeadModel = MongooseModel('Lead', LeadSchema);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import {
|
|
3
|
+
HydratedDocument,
|
|
4
|
+
Schema as MongooseSchema,
|
|
5
|
+
Types,
|
|
6
|
+
model as MongooseModel,
|
|
7
|
+
} from 'mongoose';
|
|
8
|
+
import { Profile } from './profile.schema';
|
|
9
|
+
|
|
10
|
+
export type ProfileFollowersSnapshotDocument = HydratedDocument<ProfileFollowersSnapshot>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Histórico diário de seguidores por perfil, gravado pelo profile-sync-worker
|
|
14
|
+
* a partir do `audience_size` que a Primetag devolve na captura. Um doc por
|
|
15
|
+
* perfil por dia (`date` truncado em UTC): o trigger roda várias vezes ao dia
|
|
16
|
+
* e cada rodada só sobrescreve o valor do dia.
|
|
17
|
+
*/
|
|
18
|
+
@Schema({ collection: 'profile-followers-snapshots', timestamps: true })
|
|
19
|
+
export class ProfileFollowersSnapshot {
|
|
20
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
21
|
+
_id?: Types.ObjectId;
|
|
22
|
+
|
|
23
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
|
|
24
|
+
profile: Types.ObjectId | Profile;
|
|
25
|
+
|
|
26
|
+
@Prop({ type: String, required: false })
|
|
27
|
+
socialnetwork?: string;
|
|
28
|
+
|
|
29
|
+
@Prop({ type: Number, required: true })
|
|
30
|
+
followers: number;
|
|
31
|
+
|
|
32
|
+
@Prop({ type: Date, required: true })
|
|
33
|
+
date: Date;
|
|
34
|
+
|
|
35
|
+
@Prop({ type: Date, required: true })
|
|
36
|
+
capturedAt: Date;
|
|
37
|
+
|
|
38
|
+
@Prop({ type: String, enum: ['primetag'], required: true, default: 'primetag' })
|
|
39
|
+
source: 'primetag';
|
|
40
|
+
|
|
41
|
+
@Prop({ default: Date.now, required: false })
|
|
42
|
+
createdAt?: Date;
|
|
43
|
+
|
|
44
|
+
@Prop({ default: Date.now, required: false })
|
|
45
|
+
updatedAt?: Date;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const ProfileFollowersSnapshotSchema = SchemaFactory.createForClass(ProfileFollowersSnapshot);
|
|
49
|
+
|
|
50
|
+
ProfileFollowersSnapshotSchema.index({ profile: 1, date: 1 }, { unique: true });
|
|
51
|
+
|
|
52
|
+
export const ProfileFollowersSnapshotModel = MongooseModel(
|
|
53
|
+
'ProfileFollowersSnapshot',
|
|
54
|
+
ProfileFollowersSnapshotSchema,
|
|
55
|
+
);
|
|
@@ -15,9 +15,19 @@ export class Profile {
|
|
|
15
15
|
@Prop()
|
|
16
16
|
followers: number;
|
|
17
17
|
|
|
18
|
+
// Atualizado pelo profile-sync-worker a partir do social_profile da Primetag.
|
|
19
|
+
@Prop({ type: Date, required: false })
|
|
20
|
+
followersUpdatedAt?: Date;
|
|
21
|
+
|
|
18
22
|
@Prop()
|
|
19
23
|
picture: string;
|
|
20
24
|
|
|
25
|
+
@Prop({ type: Date, required: false })
|
|
26
|
+
pictureUpdatedAt?: Date;
|
|
27
|
+
|
|
28
|
+
@Prop({ type: Number, required: false })
|
|
29
|
+
primetagSocialProfileId?: number;
|
|
30
|
+
|
|
21
31
|
@Prop()
|
|
22
32
|
socialnetwork: string;
|
|
23
33
|
|
|
@@ -168,6 +168,51 @@ export class Inbox {
|
|
|
168
168
|
@Prop({ required: true }) receivedAt: Date;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
@Schema({ _id: false })
|
|
172
|
+
export class SaleResponsables {
|
|
173
|
+
@Prop({
|
|
174
|
+
_id: false,
|
|
175
|
+
required: false,
|
|
176
|
+
type: {
|
|
177
|
+
team: String,
|
|
178
|
+
name: String,
|
|
179
|
+
email: String,
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
curation?: {
|
|
183
|
+
team: string;
|
|
184
|
+
name: string;
|
|
185
|
+
email: string;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
@Prop({
|
|
189
|
+
_id: false,
|
|
190
|
+
required: false,
|
|
191
|
+
type: {
|
|
192
|
+
team: String,
|
|
193
|
+
name: String,
|
|
194
|
+
email: String,
|
|
195
|
+
},
|
|
196
|
+
})
|
|
197
|
+
planning?: {
|
|
198
|
+
team: string;
|
|
199
|
+
name: string;
|
|
200
|
+
email: string;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@Schema({ _id: false })
|
|
205
|
+
export class SaleLinks {
|
|
206
|
+
@Prop({ required: false })
|
|
207
|
+
contract?: string;
|
|
208
|
+
|
|
209
|
+
@Prop({ required: false })
|
|
210
|
+
clientSheet?: string;
|
|
211
|
+
|
|
212
|
+
@Prop({ required: false })
|
|
213
|
+
internalSheet?: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
171
216
|
@Schema({ timestamps: true })
|
|
172
217
|
export class Sale {
|
|
173
218
|
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
@@ -260,6 +305,12 @@ export class Sale {
|
|
|
260
305
|
|
|
261
306
|
@Prop({ type: String, required: false })
|
|
262
307
|
omieId?: string;
|
|
308
|
+
|
|
309
|
+
@Prop({ type: SaleResponsables, required: false })
|
|
310
|
+
responsables?: SaleResponsables;
|
|
311
|
+
|
|
312
|
+
@Prop({ type: SaleLinks, required: false })
|
|
313
|
+
links?: SaleLinks;
|
|
263
314
|
}
|
|
264
315
|
|
|
265
316
|
export const SaleSchema = SchemaFactory.createForClass(Sale);
|