@grapadigital/shared-schemas 1.0.206 → 1.0.207

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.
@@ -199,6 +199,7 @@ export declare class Content {
199
199
  createdAt?: Date;
200
200
  updatedAt?: Date;
201
201
  primetagId?: string;
202
+ captureRunId?: string;
202
203
  sentimentAnalysis?: SentimentAnalysis | null;
203
204
  thumbnailUrl?: string;
204
205
  mediaUrl?: string;
@@ -417,6 +417,10 @@ __decorate([
417
417
  (0, mongoose_1.Prop)({ type: String, required: false }),
418
418
  __metadata("design:type", String)
419
419
  ], Content.prototype, "primetagId", void 0);
420
+ __decorate([
421
+ (0, mongoose_1.Prop)({ type: String, required: false }),
422
+ __metadata("design:type", String)
423
+ ], Content.prototype, "captureRunId", void 0);
420
424
  __decorate([
421
425
  (0, mongoose_1.Prop)({ type: exports.SentimentAnalysisSchema, required: false, default: null }),
422
426
  __metadata("design:type", Object)
@@ -110,4 +110,9 @@ exports.JobSchema = mongoose_1.SchemaFactory.createForClass(Job);
110
110
  exports.JobSchema.index({ runId: 1, requestId: 1, worker: 1, contentId: 1, primetagId: 1 }, { unique: true });
111
111
  // Trava do trigger: última rodada de uma action.
112
112
  exports.JobSchema.index({ actionId: 1, worker: 1, origin: 1, startedAt: -1 });
113
+ // A trilha guarda o payload bruto de cada rodada e cresce rápido: o Mongo
114
+ // apaga sozinho as linhas com mais de 180 dias.
115
+ exports.JobSchema.index({ createdAt: 1 }, { expireAfterSeconds: 180 * 24 * 60 * 60 });
116
+ // Raw mais recente de uma publication (linhas do content-capture).
117
+ exports.JobSchema.index({ actionId: 1, worker: 1, primetagId: 1, startedAt: -1 });
113
118
  exports.JobModel = (0, mongoose_2.model)('Job', exports.JobSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.206",
3
+ "version": "1.0.207",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -348,6 +348,12 @@ export class Content {
348
348
  @Prop({ type: String, required: false })
349
349
  primetagId?: string;
350
350
 
351
+ // runId da última captura que tocou o conteúdo (não o da rodada que o
352
+ // criou) — a aprovação e a reclassificação reaproveitam esse runId pra
353
+ // continuar na mesma trilha da coleção `jobs`.
354
+ @Prop({ type: String, required: false })
355
+ captureRunId?: string;
356
+
351
357
  @Prop({ type: SentimentAnalysisSchema, required: false, default: null })
352
358
  sentimentAnalysis?: SentimentAnalysis | null;
353
359
 
@@ -97,5 +97,10 @@ JobSchema.index(
97
97
  );
98
98
  // Trava do trigger: última rodada de uma action.
99
99
  JobSchema.index({ actionId: 1, worker: 1, origin: 1, startedAt: -1 });
100
+ // A trilha guarda o payload bruto de cada rodada e cresce rápido: o Mongo
101
+ // apaga sozinho as linhas com mais de 180 dias.
102
+ JobSchema.index({ createdAt: 1 }, { expireAfterSeconds: 180 * 24 * 60 * 60 });
103
+ // Raw mais recente de uma publication (linhas do content-capture).
104
+ JobSchema.index({ actionId: 1, worker: 1, primetagId: 1, startedAt: -1 });
100
105
 
101
106
  export const JobModel = MongooseModel('Job', JobSchema);