@grapadigital/shared-schemas 1.0.222 → 1.0.224

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.
@@ -122,37 +122,19 @@ export declare class Metrics {
122
122
  reachEngagementRate?: number | null;
123
123
  /** Tx. de Engaj. por Seguidores: engagementCount ÷ potentialReach (fração). Ver GD-703. */
124
124
  followersEngagementRate?: number | null;
125
- }
126
- export declare const MetricsSchema: MongooseSchema<Metrics, import("mongoose").Model<Metrics, any, any, any, import("mongoose").Document<unknown, any, Metrics, any, {}> & Metrics & {
127
- _id: Types.ObjectId;
128
- } & {
129
- __v: number;
130
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Metrics, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Metrics>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Metrics> & {
131
- _id: Types.ObjectId;
132
- } & {
133
- __v: number;
134
- }>;
135
- /**
136
- * Métricas que dependem dos seguidores de uma pessoa do post (autor ou
137
- * coautor). As brutas ficam uma vez só em Content.metrics. Ver GD-703.
138
- */
139
- export declare class ContentPersonMetrics {
140
- potentialReach?: number | null;
141
- followersEngagementRate?: number | null;
142
- effectiveReach?: number | null;
143
- reachPerformance?: number | null;
144
- qualifiedEngagementRate?: number | null;
145
- score?: number | null;
146
- /** Nome do Client.tiers da pessoa; null sem Tiers ou fora das faixas. */
125
+ /** Nome do Client.tiers pelo potentialReach do post; null sem Tiers ou fora das faixas. Ver GD-703. */
147
126
  tier?: string | null;
148
- /** reachEngagementRate ≥ meta viralReachEngagementRate do Tier; null sem Tier ou sem a meta. */
127
+ /**
128
+ * followersEngagementRate ≥ meta viralReachEngagementRate do Tier (nome da
129
+ * meta herdado da GD-687); null sem Tier ou sem a meta. Ver GD-703.
130
+ */
149
131
  isViral?: boolean | null;
150
132
  }
151
- export declare const ContentPersonMetricsSchema: MongooseSchema<ContentPersonMetrics, import("mongoose").Model<ContentPersonMetrics, any, any, any, import("mongoose").Document<unknown, any, ContentPersonMetrics, any, {}> & ContentPersonMetrics & {
133
+ export declare const MetricsSchema: MongooseSchema<Metrics, import("mongoose").Model<Metrics, any, any, any, import("mongoose").Document<unknown, any, Metrics, any, {}> & Metrics & {
152
134
  _id: Types.ObjectId;
153
135
  } & {
154
136
  __v: number;
155
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentPersonMetrics, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentPersonMetrics>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentPersonMetrics> & {
137
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Metrics, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Metrics>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Metrics> & {
156
138
  _id: Types.ObjectId;
157
139
  } & {
158
140
  __v: number;
@@ -161,7 +143,6 @@ export declare const ContentPersonMetricsSchema: MongooseSchema<ContentPersonMet
161
143
  export declare class ContentCollab {
162
144
  profile: Types.ObjectId | Profile;
163
145
  followersAtPost?: number | null;
164
- metrics?: ContentPersonMetrics | null;
165
146
  }
166
147
  export declare const ContentCollabSchema: MongooseSchema<ContentCollab, import("mongoose").Model<ContentCollab, any, any, any, import("mongoose").Document<unknown, any, ContentCollab, any, {}> & ContentCollab & {
167
148
  _id: Types.ObjectId;
@@ -311,9 +292,7 @@ export declare class Content {
311
292
  hasAffiliateLink: boolean;
312
293
  /** Coautores do post; isCollab = collabs.length > 0. Ver GD-703. */
313
294
  collabs?: ContentCollab[];
314
- /** Métricas do autor, com os seguidores dele (followersAtPost). Ver GD-703. */
315
- profileMetrics?: ContentPersonMetrics | null;
316
- /** Visão da Ação: brutas uma vez só e derivadas com o potentialReach somado. */
295
+ /** Métricas do post (sem métrica por pessoa): derivadas com o potentialReach somado. Ver GD-703. */
317
296
  metrics: Metrics;
318
297
  metricsBreakdown?: ContentMetricsBreakdown | null;
319
298
  /**
@@ -355,6 +334,18 @@ export declare class Content {
355
334
  * junto. Ver GD-699.
356
335
  */
357
336
  linkKey?: string | null;
337
+ /**
338
+ * Quando a edição pediu o recálculo das métricas (api-campaigns). A tela
339
+ * mostra "Recalculando…" enquanto for mais novo que metricsCalculatedAt.
340
+ * Ver GD-705.
341
+ */
342
+ metricsRequestedAt?: Date | null;
343
+ /**
344
+ * metricsRequestedAt que o metrics-generator-worker atendeu, gravado ao
345
+ * terminar o recálculo (não a hora do fim: um pedido que chegou durante o
346
+ * cálculo continua pendente). Ver GD-705.
347
+ */
348
+ metricsCalculatedAt?: Date | null;
358
349
  }
359
350
  export declare const ContentSchema: MongooseSchema<Content, import("mongoose").Model<Content, any, any, any, import("mongoose").Document<unknown, any, Content, any, {}> & Content & Required<{
360
351
  _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.ContentStatusChangedBySchema = exports.ContentStatusChangedBy = exports.CONTENT_CLASSIFICATION_SOURCE_VALUES = exports.CONTENT_METRICS_SOURCE_VALUES = exports.CONTENT_COMMENT_COUNT_SOURCE_VALUES = exports.CONTENT_REPORTABLE_STATUS_VALUES = exports.CONTENT_STATUS_VALUES = exports.EstimatesSchema = exports.Estimates = exports.ContentMetricsHistoryEntrySchema = exports.ContentMetricsHistoryEntry = exports.ContentVideoSchema = exports.ContentVideo = exports.ContentMetricsBreakdownSchema = exports.ContentMetricsBreakdown = exports.ContentBaseMetricsSchema = exports.ContentBaseMetrics = exports.CONTENT_BASE_METRIC_KEYS = exports.ContentCollabSchema = exports.ContentCollab = exports.ContentPersonMetricsSchema = exports.ContentPersonMetrics = 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.ContentStatusChangedBySchema = exports.ContentStatusChangedBy = exports.CONTENT_CLASSIFICATION_SOURCE_VALUES = exports.CONTENT_METRICS_SOURCE_VALUES = exports.CONTENT_COMMENT_COUNT_SOURCE_VALUES = exports.CONTENT_REPORTABLE_STATUS_VALUES = exports.CONTENT_STATUS_VALUES = exports.EstimatesSchema = exports.Estimates = exports.ContentMetricsHistoryEntrySchema = exports.ContentMetricsHistoryEntry = exports.ContentVideoSchema = exports.ContentVideo = exports.ContentMetricsBreakdownSchema = exports.ContentMetricsBreakdown = exports.ContentBaseMetricsSchema = exports.ContentBaseMetrics = exports.CONTENT_BASE_METRIC_KEYS = exports.ContentCollabSchema = exports.ContentCollab = 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
  const normalize_content_link_util_1 = require("../utils/normalize-content-link.util");
@@ -219,54 +219,19 @@ __decorate([
219
219
  (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
220
220
  __metadata("design:type", Object)
221
221
  ], Metrics.prototype, "followersEngagementRate", void 0);
222
- Metrics = __decorate([
223
- (0, mongoose_1.Schema)({ _id: false })
224
- ], Metrics);
225
- exports.Metrics = Metrics;
226
- exports.MetricsSchema = mongoose_1.SchemaFactory.createForClass(Metrics);
227
- /**
228
- * Métricas que dependem dos seguidores de uma pessoa do post (autor ou
229
- * coautor). As brutas ficam uma vez só em Content.metrics. Ver GD-703.
230
- */
231
- let ContentPersonMetrics = class ContentPersonMetrics {
232
- };
233
- __decorate([
234
- (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
235
- __metadata("design:type", Object)
236
- ], ContentPersonMetrics.prototype, "potentialReach", void 0);
237
- __decorate([
238
- (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
239
- __metadata("design:type", Object)
240
- ], ContentPersonMetrics.prototype, "followersEngagementRate", void 0);
241
- __decorate([
242
- (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
243
- __metadata("design:type", Object)
244
- ], ContentPersonMetrics.prototype, "effectiveReach", void 0);
245
- __decorate([
246
- (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
247
- __metadata("design:type", Object)
248
- ], ContentPersonMetrics.prototype, "reachPerformance", void 0);
249
- __decorate([
250
- (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
251
- __metadata("design:type", Object)
252
- ], ContentPersonMetrics.prototype, "qualifiedEngagementRate", void 0);
253
- __decorate([
254
- (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
255
- __metadata("design:type", Object)
256
- ], ContentPersonMetrics.prototype, "score", void 0);
257
222
  __decorate([
258
223
  (0, mongoose_1.Prop)({ type: String, required: false, default: null }),
259
224
  __metadata("design:type", Object)
260
- ], ContentPersonMetrics.prototype, "tier", void 0);
225
+ ], Metrics.prototype, "tier", void 0);
261
226
  __decorate([
262
227
  (0, mongoose_1.Prop)({ type: Boolean, required: false, default: null }),
263
228
  __metadata("design:type", Object)
264
- ], ContentPersonMetrics.prototype, "isViral", void 0);
265
- ContentPersonMetrics = __decorate([
229
+ ], Metrics.prototype, "isViral", void 0);
230
+ Metrics = __decorate([
266
231
  (0, mongoose_1.Schema)({ _id: false })
267
- ], ContentPersonMetrics);
268
- exports.ContentPersonMetrics = ContentPersonMetrics;
269
- exports.ContentPersonMetricsSchema = mongoose_1.SchemaFactory.createForClass(ContentPersonMetrics);
232
+ ], Metrics);
233
+ exports.Metrics = Metrics;
234
+ exports.MetricsSchema = mongoose_1.SchemaFactory.createForClass(Metrics);
270
235
  /** Coautor do post (Colab), com os seguidores dele no momento do post. Ver GD-703. */
271
236
  let ContentCollab = class ContentCollab {
272
237
  };
@@ -278,10 +243,6 @@ __decorate([
278
243
  (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
279
244
  __metadata("design:type", Object)
280
245
  ], ContentCollab.prototype, "followersAtPost", void 0);
281
- __decorate([
282
- (0, mongoose_1.Prop)({ type: exports.ContentPersonMetricsSchema, required: false, default: null }),
283
- __metadata("design:type", Object)
284
- ], ContentCollab.prototype, "metrics", void 0);
285
246
  ContentCollab = __decorate([
286
247
  (0, mongoose_1.Schema)({ _id: false })
287
248
  ], ContentCollab);
@@ -598,10 +559,6 @@ __decorate([
598
559
  (0, mongoose_1.Prop)({ type: [exports.ContentCollabSchema], required: false, default: [] }),
599
560
  __metadata("design:type", Array)
600
561
  ], Content.prototype, "collabs", void 0);
601
- __decorate([
602
- (0, mongoose_1.Prop)({ type: exports.ContentPersonMetricsSchema, required: false, default: null }),
603
- __metadata("design:type", Object)
604
- ], Content.prototype, "profileMetrics", void 0);
605
562
  __decorate([
606
563
  (0, mongoose_1.Prop)({ type: exports.MetricsSchema, required: true }),
607
564
  __metadata("design:type", Metrics)
@@ -694,6 +651,14 @@ __decorate([
694
651
  (0, mongoose_1.Prop)({ type: String, required: false, default: null }),
695
652
  __metadata("design:type", Object)
696
653
  ], Content.prototype, "linkKey", void 0);
654
+ __decorate([
655
+ (0, mongoose_1.Prop)({ type: Date, required: false, default: null }),
656
+ __metadata("design:type", Object)
657
+ ], Content.prototype, "metricsRequestedAt", void 0);
658
+ __decorate([
659
+ (0, mongoose_1.Prop)({ type: Date, required: false, default: null }),
660
+ __metadata("design:type", Object)
661
+ ], Content.prototype, "metricsCalculatedAt", void 0);
697
662
  Content = __decorate([
698
663
  (0, mongoose_1.Schema)({ timestamps: true })
699
664
  ], Content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.222",
3
+ "version": "1.0.224",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -172,44 +172,20 @@ export class Metrics {
172
172
  /** Tx. de Engaj. por Seguidores: engagementCount ÷ potentialReach (fração). Ver GD-703. */
173
173
  @Prop({ type: Number, required: false, default: null })
174
174
  followersEngagementRate?: number | null;
175
- }
176
-
177
- export const MetricsSchema = SchemaFactory.createForClass(Metrics);
178
-
179
- /**
180
- * Métricas que dependem dos seguidores de uma pessoa do post (autor ou
181
- * coautor). As brutas ficam uma vez só em Content.metrics. Ver GD-703.
182
- */
183
- @Schema({ _id: false })
184
- export class ContentPersonMetrics {
185
- @Prop({ type: Number, required: false, default: null })
186
- potentialReach?: number | null;
187
175
 
188
- @Prop({ type: Number, required: false, default: null })
189
- followersEngagementRate?: number | null;
190
-
191
- @Prop({ type: Number, required: false, default: null })
192
- effectiveReach?: number | null;
193
-
194
- @Prop({ type: Number, required: false, default: null })
195
- reachPerformance?: number | null;
196
-
197
- @Prop({ type: Number, required: false, default: null })
198
- qualifiedEngagementRate?: number | null;
199
-
200
- @Prop({ type: Number, required: false, default: null })
201
- score?: number | null;
202
-
203
- /** Nome do Client.tiers da pessoa; null sem Tiers ou fora das faixas. */
176
+ /** Nome do Client.tiers pelo potentialReach do post; null sem Tiers ou fora das faixas. Ver GD-703. */
204
177
  @Prop({ type: String, required: false, default: null })
205
178
  tier?: string | null;
206
179
 
207
- /** reachEngagementRate ≥ meta viralReachEngagementRate do Tier; null sem Tier ou sem a meta. */
180
+ /**
181
+ * followersEngagementRate ≥ meta viralReachEngagementRate do Tier (nome da
182
+ * meta herdado da GD-687); null sem Tier ou sem a meta. Ver GD-703.
183
+ */
208
184
  @Prop({ type: Boolean, required: false, default: null })
209
185
  isViral?: boolean | null;
210
186
  }
211
187
 
212
- export const ContentPersonMetricsSchema = SchemaFactory.createForClass(ContentPersonMetrics);
188
+ export const MetricsSchema = SchemaFactory.createForClass(Metrics);
213
189
 
214
190
  /** Coautor do post (Colab), com os seguidores dele no momento do post. Ver GD-703. */
215
191
  @Schema({ _id: false })
@@ -219,9 +195,6 @@ export class ContentCollab {
219
195
 
220
196
  @Prop({ type: Number, required: false, default: null })
221
197
  followersAtPost?: number | null;
222
-
223
- @Prop({ type: ContentPersonMetricsSchema, required: false, default: null })
224
- metrics?: ContentPersonMetrics | null;
225
198
  }
226
199
 
227
200
  export const ContentCollabSchema = SchemaFactory.createForClass(ContentCollab);
@@ -506,11 +479,7 @@ export class Content {
506
479
  @Prop({ type: [ContentCollabSchema], required: false, default: [] })
507
480
  collabs?: ContentCollab[];
508
481
 
509
- /** Métricas do autor, com os seguidores dele (followersAtPost). Ver GD-703. */
510
- @Prop({ type: ContentPersonMetricsSchema, required: false, default: null })
511
- profileMetrics?: ContentPersonMetrics | null;
512
-
513
- /** Visão da Ação: brutas uma vez só e derivadas com o potentialReach somado. */
482
+ /** Métricas do post (sem métrica por pessoa): derivadas com o potentialReach somado. Ver GD-703. */
514
483
  @Prop({ type: MetricsSchema, required: true })
515
484
  metrics: Metrics;
516
485
 
@@ -604,6 +573,22 @@ export class Content {
604
573
  */
605
574
  @Prop({ type: String, required: false, default: null })
606
575
  linkKey?: string | null;
576
+
577
+ /**
578
+ * Quando a edição pediu o recálculo das métricas (api-campaigns). A tela
579
+ * mostra "Recalculando…" enquanto for mais novo que metricsCalculatedAt.
580
+ * Ver GD-705.
581
+ */
582
+ @Prop({ type: Date, required: false, default: null })
583
+ metricsRequestedAt?: Date | null;
584
+
585
+ /**
586
+ * metricsRequestedAt que o metrics-generator-worker atendeu, gravado ao
587
+ * terminar o recálculo (não a hora do fim: um pedido que chegou durante o
588
+ * cálculo continua pendente). Ver GD-705.
589
+ */
590
+ @Prop({ type: Date, required: false, default: null })
591
+ metricsCalculatedAt?: Date | null;
607
592
  }
608
593
 
609
594
  export const ContentSchema = SchemaFactory.createForClass(Content);