@grapadigital/shared-schemas 1.0.187 → 1.0.188

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 CHANGED
@@ -28,3 +28,6 @@ export * from './schemas/group.schema';
28
28
  export * from './schemas/tag.schema';
29
29
  export * from './schemas/trigger.schema';
30
30
  export { Note, NoteSchema, NoteMention, NoteMentionSchema } from './schemas/note.schema';
31
+ export * from './schemas/content-capture-process.schema';
32
+ export * from './schemas/content-draft.schema';
33
+ export * from './schemas/export-comments-job.schema';
package/dist/index.js CHANGED
@@ -49,3 +49,6 @@ Object.defineProperty(exports, "Note", { enumerable: true, get: function () { re
49
49
  Object.defineProperty(exports, "NoteSchema", { enumerable: true, get: function () { return note_schema_1.NoteSchema; } });
50
50
  Object.defineProperty(exports, "NoteMention", { enumerable: true, get: function () { return note_schema_1.NoteMention; } });
51
51
  Object.defineProperty(exports, "NoteMentionSchema", { enumerable: true, get: function () { return note_schema_1.NoteMentionSchema; } });
52
+ __exportStar(require("./schemas/content-capture-process.schema"), exports);
53
+ __exportStar(require("./schemas/content-draft.schema"), exports);
54
+ __exportStar(require("./schemas/export-comments-job.schema"), exports);
@@ -0,0 +1,167 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
+ import { Action } from './action.schema';
28
+ export type ContentCaptureProcessDocument = HydratedDocument<ContentCaptureProcess>;
29
+ export declare class ContentCaptureProcessMetrics {
30
+ impressionCount?: number | null;
31
+ reachCount?: number | null;
32
+ engagementCount?: number | null;
33
+ engagementRate?: number | null;
34
+ sentimentPositive?: number | null;
35
+ sentimentNegative?: number | null;
36
+ sentimentNeutral?: number | null;
37
+ emv?: number | null;
38
+ }
39
+ export declare const ContentCaptureProcessMetricsSchema: MongooseSchema<ContentCaptureProcessMetrics, import("mongoose").Model<ContentCaptureProcessMetrics, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessMetrics, any, {}> & ContentCaptureProcessMetrics & {
40
+ _id: Types.ObjectId;
41
+ } & {
42
+ __v: number;
43
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcessMetrics, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcessMetrics>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcessMetrics> & {
44
+ _id: Types.ObjectId;
45
+ } & {
46
+ __v: number;
47
+ }>;
48
+ export declare class ContentCaptureProcessInfluencer {
49
+ username?: string;
50
+ displayName?: string;
51
+ platform?: string;
52
+ }
53
+ export declare const ContentCaptureProcessInfluencerSchema: MongooseSchema<ContentCaptureProcessInfluencer, import("mongoose").Model<ContentCaptureProcessInfluencer, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessInfluencer, any, {}> & ContentCaptureProcessInfluencer & {
54
+ _id: Types.ObjectId;
55
+ } & {
56
+ __v: number;
57
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcessInfluencer, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcessInfluencer>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcessInfluencer> & {
58
+ _id: Types.ObjectId;
59
+ } & {
60
+ __v: number;
61
+ }>;
62
+ export declare class ContentCaptureProcessCommentCaptureStatus {
63
+ status: 'captured' | 'skipped_cooldown' | 'skipped_network' | 'out_of_scope' | 'failed';
64
+ commentsCaptured?: number;
65
+ error?: string;
66
+ }
67
+ export declare const ContentCaptureProcessCommentCaptureStatusSchema: MongooseSchema<ContentCaptureProcessCommentCaptureStatus, import("mongoose").Model<ContentCaptureProcessCommentCaptureStatus, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessCommentCaptureStatus, any, {}> & ContentCaptureProcessCommentCaptureStatus & {
68
+ _id: Types.ObjectId;
69
+ } & {
70
+ __v: number;
71
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcessCommentCaptureStatus, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcessCommentCaptureStatus>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcessCommentCaptureStatus> & {
72
+ _id: Types.ObjectId;
73
+ } & {
74
+ __v: number;
75
+ }>;
76
+ export declare class ContentCaptureProcessItem {
77
+ primetagId?: string;
78
+ contentId?: Types.ObjectId;
79
+ link?: string;
80
+ type?: string;
81
+ socialnetwork?: string;
82
+ status?: 'created' | 'updated';
83
+ metrics?: ContentCaptureProcessMetrics;
84
+ previousMetrics?: ContentCaptureProcessMetrics;
85
+ influencer?: ContentCaptureProcessInfluencer;
86
+ commentCapture?: ContentCaptureProcessCommentCaptureStatus;
87
+ }
88
+ export declare const ContentCaptureProcessItemSchema: MongooseSchema<ContentCaptureProcessItem, import("mongoose").Model<ContentCaptureProcessItem, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessItem, any, {}> & ContentCaptureProcessItem & {
89
+ _id: Types.ObjectId;
90
+ } & {
91
+ __v: number;
92
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcessItem, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcessItem>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcessItem> & {
93
+ _id: Types.ObjectId;
94
+ } & {
95
+ __v: number;
96
+ }>;
97
+ export declare class ContentCaptureProcessResponsibleContact {
98
+ name?: string;
99
+ team?: string;
100
+ email?: string;
101
+ }
102
+ export declare const ContentCaptureProcessResponsibleContactSchema: MongooseSchema<ContentCaptureProcessResponsibleContact, import("mongoose").Model<ContentCaptureProcessResponsibleContact, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessResponsibleContact, any, {}> & ContentCaptureProcessResponsibleContact & {
103
+ _id: Types.ObjectId;
104
+ } & {
105
+ __v: number;
106
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcessResponsibleContact, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcessResponsibleContact>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcessResponsibleContact> & {
107
+ _id: Types.ObjectId;
108
+ } & {
109
+ __v: number;
110
+ }>;
111
+ export declare class ContentCaptureProcessResponsibles {
112
+ service?: ContentCaptureProcessResponsibleContact;
113
+ }
114
+ export declare const ContentCaptureProcessResponsiblesSchema: MongooseSchema<ContentCaptureProcessResponsibles, import("mongoose").Model<ContentCaptureProcessResponsibles, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessResponsibles, any, {}> & ContentCaptureProcessResponsibles & {
115
+ _id: Types.ObjectId;
116
+ } & {
117
+ __v: number;
118
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcessResponsibles, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcessResponsibles>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcessResponsibles> & {
119
+ _id: Types.ObjectId;
120
+ } & {
121
+ __v: number;
122
+ }>;
123
+ export declare class ContentCaptureProcess {
124
+ _id?: Types.ObjectId;
125
+ actionId: Types.ObjectId | Action;
126
+ runId: string;
127
+ actionTitle: string;
128
+ primetagId?: string;
129
+ responsibles?: ContentCaptureProcessResponsibles;
130
+ status: 'fetching' | 'awaiting_comments' | 'reported' | 'failed';
131
+ publicationsFetched: number;
132
+ contentsMapped: number;
133
+ contentsCreated: number;
134
+ contentsUpdated: number;
135
+ expectedCommentCaptureCount: number;
136
+ processedContentIds: Types.ObjectId[];
137
+ contents: ContentCaptureProcessItem[];
138
+ error?: string;
139
+ startedAt: Date;
140
+ fetchFinishedAt?: Date;
141
+ commentsFinishedAt?: Date;
142
+ reportedAt?: Date;
143
+ createdAt?: Date;
144
+ updatedAt?: Date;
145
+ }
146
+ export declare const ContentCaptureProcessSchema: MongooseSchema<ContentCaptureProcess, import("mongoose").Model<ContentCaptureProcess, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcess, any, {}> & ContentCaptureProcess & Required<{
147
+ _id: Types.ObjectId;
148
+ }> & {
149
+ __v: number;
150
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcess, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcess>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcess> & Required<{
151
+ _id: Types.ObjectId;
152
+ }> & {
153
+ __v: number;
154
+ }>;
155
+ export declare const ContentCaptureProcessModel: import("mongoose").Model<ContentCaptureProcess, {}, {}, {}, import("mongoose").Document<unknown, {}, ContentCaptureProcess, {}, import("mongoose").DefaultSchemaOptions> & ContentCaptureProcess & Required<{
156
+ _id: Types.ObjectId;
157
+ }> & {
158
+ __v: number;
159
+ }, MongooseSchema<ContentCaptureProcess, import("mongoose").Model<ContentCaptureProcess, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcess, any, {}> & ContentCaptureProcess & Required<{
160
+ _id: Types.ObjectId;
161
+ }> & {
162
+ __v: number;
163
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcess, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcess>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcess> & Required<{
164
+ _id: Types.ObjectId;
165
+ }> & {
166
+ __v: number;
167
+ }>>;
@@ -0,0 +1,271 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ContentCaptureProcessModel = exports.ContentCaptureProcessSchema = exports.ContentCaptureProcess = exports.ContentCaptureProcessResponsiblesSchema = exports.ContentCaptureProcessResponsibles = exports.ContentCaptureProcessResponsibleContactSchema = exports.ContentCaptureProcessResponsibleContact = exports.ContentCaptureProcessItemSchema = exports.ContentCaptureProcessItem = exports.ContentCaptureProcessCommentCaptureStatusSchema = exports.ContentCaptureProcessCommentCaptureStatus = exports.ContentCaptureProcessInfluencerSchema = exports.ContentCaptureProcessInfluencer = exports.ContentCaptureProcessMetricsSchema = exports.ContentCaptureProcessMetrics = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ let ContentCaptureProcessMetrics = class ContentCaptureProcessMetrics {
16
+ };
17
+ __decorate([
18
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
19
+ __metadata("design:type", Object)
20
+ ], ContentCaptureProcessMetrics.prototype, "impressionCount", void 0);
21
+ __decorate([
22
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
23
+ __metadata("design:type", Object)
24
+ ], ContentCaptureProcessMetrics.prototype, "reachCount", void 0);
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
27
+ __metadata("design:type", Object)
28
+ ], ContentCaptureProcessMetrics.prototype, "engagementCount", void 0);
29
+ __decorate([
30
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
31
+ __metadata("design:type", Object)
32
+ ], ContentCaptureProcessMetrics.prototype, "engagementRate", void 0);
33
+ __decorate([
34
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
35
+ __metadata("design:type", Object)
36
+ ], ContentCaptureProcessMetrics.prototype, "sentimentPositive", void 0);
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
39
+ __metadata("design:type", Object)
40
+ ], ContentCaptureProcessMetrics.prototype, "sentimentNegative", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
43
+ __metadata("design:type", Object)
44
+ ], ContentCaptureProcessMetrics.prototype, "sentimentNeutral", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)({ type: Number, required: false, default: null }),
47
+ __metadata("design:type", Object)
48
+ ], ContentCaptureProcessMetrics.prototype, "emv", void 0);
49
+ ContentCaptureProcessMetrics = __decorate([
50
+ (0, mongoose_1.Schema)({ _id: false })
51
+ ], ContentCaptureProcessMetrics);
52
+ exports.ContentCaptureProcessMetrics = ContentCaptureProcessMetrics;
53
+ exports.ContentCaptureProcessMetricsSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessMetrics);
54
+ let ContentCaptureProcessInfluencer = class ContentCaptureProcessInfluencer {
55
+ };
56
+ __decorate([
57
+ (0, mongoose_1.Prop)({ type: String, required: false }),
58
+ __metadata("design:type", String)
59
+ ], ContentCaptureProcessInfluencer.prototype, "username", void 0);
60
+ __decorate([
61
+ (0, mongoose_1.Prop)({ type: String, required: false }),
62
+ __metadata("design:type", String)
63
+ ], ContentCaptureProcessInfluencer.prototype, "displayName", void 0);
64
+ __decorate([
65
+ (0, mongoose_1.Prop)({ type: String, required: false }),
66
+ __metadata("design:type", String)
67
+ ], ContentCaptureProcessInfluencer.prototype, "platform", void 0);
68
+ ContentCaptureProcessInfluencer = __decorate([
69
+ (0, mongoose_1.Schema)({ _id: false })
70
+ ], ContentCaptureProcessInfluencer);
71
+ exports.ContentCaptureProcessInfluencer = ContentCaptureProcessInfluencer;
72
+ exports.ContentCaptureProcessInfluencerSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessInfluencer);
73
+ let ContentCaptureProcessCommentCaptureStatus = class ContentCaptureProcessCommentCaptureStatus {
74
+ };
75
+ __decorate([
76
+ (0, mongoose_1.Prop)({
77
+ type: String,
78
+ enum: ['captured', 'skipped_cooldown', 'skipped_network', 'out_of_scope', 'failed'],
79
+ required: true,
80
+ }),
81
+ __metadata("design:type", String)
82
+ ], ContentCaptureProcessCommentCaptureStatus.prototype, "status", void 0);
83
+ __decorate([
84
+ (0, mongoose_1.Prop)({ type: Number, required: false }),
85
+ __metadata("design:type", Number)
86
+ ], ContentCaptureProcessCommentCaptureStatus.prototype, "commentsCaptured", void 0);
87
+ __decorate([
88
+ (0, mongoose_1.Prop)({ type: String, required: false }),
89
+ __metadata("design:type", String)
90
+ ], ContentCaptureProcessCommentCaptureStatus.prototype, "error", void 0);
91
+ ContentCaptureProcessCommentCaptureStatus = __decorate([
92
+ (0, mongoose_1.Schema)({ _id: false })
93
+ ], ContentCaptureProcessCommentCaptureStatus);
94
+ exports.ContentCaptureProcessCommentCaptureStatus = ContentCaptureProcessCommentCaptureStatus;
95
+ exports.ContentCaptureProcessCommentCaptureStatusSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessCommentCaptureStatus);
96
+ let ContentCaptureProcessItem = class ContentCaptureProcessItem {
97
+ };
98
+ __decorate([
99
+ (0, mongoose_1.Prop)({ type: String, required: false }),
100
+ __metadata("design:type", String)
101
+ ], ContentCaptureProcessItem.prototype, "primetagId", void 0);
102
+ __decorate([
103
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: false }),
104
+ __metadata("design:type", mongoose_2.Types.ObjectId)
105
+ ], ContentCaptureProcessItem.prototype, "contentId", void 0);
106
+ __decorate([
107
+ (0, mongoose_1.Prop)({ type: String, required: false }),
108
+ __metadata("design:type", String)
109
+ ], ContentCaptureProcessItem.prototype, "link", void 0);
110
+ __decorate([
111
+ (0, mongoose_1.Prop)({ type: String, required: false }),
112
+ __metadata("design:type", String)
113
+ ], ContentCaptureProcessItem.prototype, "type", void 0);
114
+ __decorate([
115
+ (0, mongoose_1.Prop)({ type: String, required: false }),
116
+ __metadata("design:type", String)
117
+ ], ContentCaptureProcessItem.prototype, "socialnetwork", void 0);
118
+ __decorate([
119
+ (0, mongoose_1.Prop)({ type: String, enum: ['created', 'updated'], required: false }),
120
+ __metadata("design:type", String)
121
+ ], ContentCaptureProcessItem.prototype, "status", void 0);
122
+ __decorate([
123
+ (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessMetricsSchema, required: false }),
124
+ __metadata("design:type", ContentCaptureProcessMetrics)
125
+ ], ContentCaptureProcessItem.prototype, "metrics", void 0);
126
+ __decorate([
127
+ (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessMetricsSchema, required: false }),
128
+ __metadata("design:type", ContentCaptureProcessMetrics)
129
+ ], ContentCaptureProcessItem.prototype, "previousMetrics", void 0);
130
+ __decorate([
131
+ (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessInfluencerSchema, required: false }),
132
+ __metadata("design:type", ContentCaptureProcessInfluencer)
133
+ ], ContentCaptureProcessItem.prototype, "influencer", void 0);
134
+ __decorate([
135
+ (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessCommentCaptureStatusSchema, required: false }),
136
+ __metadata("design:type", ContentCaptureProcessCommentCaptureStatus)
137
+ ], ContentCaptureProcessItem.prototype, "commentCapture", void 0);
138
+ ContentCaptureProcessItem = __decorate([
139
+ (0, mongoose_1.Schema)({ _id: false })
140
+ ], ContentCaptureProcessItem);
141
+ exports.ContentCaptureProcessItem = ContentCaptureProcessItem;
142
+ exports.ContentCaptureProcessItemSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessItem);
143
+ let ContentCaptureProcessResponsibleContact = class ContentCaptureProcessResponsibleContact {
144
+ };
145
+ __decorate([
146
+ (0, mongoose_1.Prop)({ type: String, required: false }),
147
+ __metadata("design:type", String)
148
+ ], ContentCaptureProcessResponsibleContact.prototype, "name", void 0);
149
+ __decorate([
150
+ (0, mongoose_1.Prop)({ type: String, required: false }),
151
+ __metadata("design:type", String)
152
+ ], ContentCaptureProcessResponsibleContact.prototype, "team", void 0);
153
+ __decorate([
154
+ (0, mongoose_1.Prop)({ type: String, required: false }),
155
+ __metadata("design:type", String)
156
+ ], ContentCaptureProcessResponsibleContact.prototype, "email", void 0);
157
+ ContentCaptureProcessResponsibleContact = __decorate([
158
+ (0, mongoose_1.Schema)({ _id: false })
159
+ ], ContentCaptureProcessResponsibleContact);
160
+ exports.ContentCaptureProcessResponsibleContact = ContentCaptureProcessResponsibleContact;
161
+ exports.ContentCaptureProcessResponsibleContactSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessResponsibleContact);
162
+ let ContentCaptureProcessResponsibles = class ContentCaptureProcessResponsibles {
163
+ };
164
+ __decorate([
165
+ (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessResponsibleContactSchema, required: false }),
166
+ __metadata("design:type", ContentCaptureProcessResponsibleContact)
167
+ ], ContentCaptureProcessResponsibles.prototype, "service", void 0);
168
+ ContentCaptureProcessResponsibles = __decorate([
169
+ (0, mongoose_1.Schema)({ _id: false })
170
+ ], ContentCaptureProcessResponsibles);
171
+ exports.ContentCaptureProcessResponsibles = ContentCaptureProcessResponsibles;
172
+ exports.ContentCaptureProcessResponsiblesSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessResponsibles);
173
+ let ContentCaptureProcess = class ContentCaptureProcess {
174
+ };
175
+ __decorate([
176
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
177
+ __metadata("design:type", mongoose_2.Types.ObjectId)
178
+ ], ContentCaptureProcess.prototype, "_id", void 0);
179
+ __decorate([
180
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: true }),
181
+ __metadata("design:type", Object)
182
+ ], ContentCaptureProcess.prototype, "actionId", void 0);
183
+ __decorate([
184
+ (0, mongoose_1.Prop)({ type: String, required: true }),
185
+ __metadata("design:type", String)
186
+ ], ContentCaptureProcess.prototype, "runId", void 0);
187
+ __decorate([
188
+ (0, mongoose_1.Prop)({ type: String, required: true }),
189
+ __metadata("design:type", String)
190
+ ], ContentCaptureProcess.prototype, "actionTitle", void 0);
191
+ __decorate([
192
+ (0, mongoose_1.Prop)({ type: String, required: false }),
193
+ __metadata("design:type", String)
194
+ ], ContentCaptureProcess.prototype, "primetagId", void 0);
195
+ __decorate([
196
+ (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessResponsiblesSchema, required: false }),
197
+ __metadata("design:type", ContentCaptureProcessResponsibles)
198
+ ], ContentCaptureProcess.prototype, "responsibles", void 0);
199
+ __decorate([
200
+ (0, mongoose_1.Prop)({
201
+ type: String,
202
+ enum: ['fetching', 'awaiting_comments', 'reported', 'failed'],
203
+ required: true,
204
+ default: 'fetching',
205
+ }),
206
+ __metadata("design:type", String)
207
+ ], ContentCaptureProcess.prototype, "status", void 0);
208
+ __decorate([
209
+ (0, mongoose_1.Prop)({ type: Number, required: true, default: 0 }),
210
+ __metadata("design:type", Number)
211
+ ], ContentCaptureProcess.prototype, "publicationsFetched", void 0);
212
+ __decorate([
213
+ (0, mongoose_1.Prop)({ type: Number, required: true, default: 0 }),
214
+ __metadata("design:type", Number)
215
+ ], ContentCaptureProcess.prototype, "contentsMapped", void 0);
216
+ __decorate([
217
+ (0, mongoose_1.Prop)({ type: Number, required: true, default: 0 }),
218
+ __metadata("design:type", Number)
219
+ ], ContentCaptureProcess.prototype, "contentsCreated", void 0);
220
+ __decorate([
221
+ (0, mongoose_1.Prop)({ type: Number, required: true, default: 0 }),
222
+ __metadata("design:type", Number)
223
+ ], ContentCaptureProcess.prototype, "contentsUpdated", void 0);
224
+ __decorate([
225
+ (0, mongoose_1.Prop)({ type: Number, required: true, default: 0 }),
226
+ __metadata("design:type", Number)
227
+ ], ContentCaptureProcess.prototype, "expectedCommentCaptureCount", void 0);
228
+ __decorate([
229
+ (0, mongoose_1.Prop)({ type: [mongoose_2.Schema.Types.ObjectId], required: true, default: [] }),
230
+ __metadata("design:type", Array)
231
+ ], ContentCaptureProcess.prototype, "processedContentIds", void 0);
232
+ __decorate([
233
+ (0, mongoose_1.Prop)({ type: [exports.ContentCaptureProcessItemSchema], required: true, default: [] }),
234
+ __metadata("design:type", Array)
235
+ ], ContentCaptureProcess.prototype, "contents", void 0);
236
+ __decorate([
237
+ (0, mongoose_1.Prop)({ type: String, required: false }),
238
+ __metadata("design:type", String)
239
+ ], ContentCaptureProcess.prototype, "error", void 0);
240
+ __decorate([
241
+ (0, mongoose_1.Prop)({ type: Date, required: true, default: Date.now }),
242
+ __metadata("design:type", Date)
243
+ ], ContentCaptureProcess.prototype, "startedAt", void 0);
244
+ __decorate([
245
+ (0, mongoose_1.Prop)({ type: Date, required: false }),
246
+ __metadata("design:type", Date)
247
+ ], ContentCaptureProcess.prototype, "fetchFinishedAt", void 0);
248
+ __decorate([
249
+ (0, mongoose_1.Prop)({ type: Date, required: false }),
250
+ __metadata("design:type", Date)
251
+ ], ContentCaptureProcess.prototype, "commentsFinishedAt", void 0);
252
+ __decorate([
253
+ (0, mongoose_1.Prop)({ type: Date, required: false }),
254
+ __metadata("design:type", Date)
255
+ ], ContentCaptureProcess.prototype, "reportedAt", void 0);
256
+ __decorate([
257
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
258
+ __metadata("design:type", Date)
259
+ ], ContentCaptureProcess.prototype, "createdAt", void 0);
260
+ __decorate([
261
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
262
+ __metadata("design:type", Date)
263
+ ], ContentCaptureProcess.prototype, "updatedAt", void 0);
264
+ ContentCaptureProcess = __decorate([
265
+ (0, mongoose_1.Schema)({ collection: 'content-capture-processes', timestamps: true })
266
+ ], ContentCaptureProcess);
267
+ exports.ContentCaptureProcess = ContentCaptureProcess;
268
+ exports.ContentCaptureProcessSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcess);
269
+ exports.ContentCaptureProcessSchema.index({ actionId: 1, runId: 1 }, { unique: true });
270
+ exports.ContentCaptureProcessSchema.index({ status: 1 });
271
+ exports.ContentCaptureProcessModel = (0, mongoose_2.model)('ContentCaptureProcess', exports.ContentCaptureProcessSchema);
@@ -0,0 +1,82 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
+ import { Profile } from './profile.schema';
28
+ import { Action } from './action.schema';
29
+ import { Metrics, Estimates, SentimentAnalysis } from './content.schema';
30
+ export type ContentDraftDocument = HydratedDocument<ContentDraft>;
31
+ /**
32
+ * Resultado do fetch+map da Primetag, antes de ser promovido para `Content`
33
+ * (promoção feita pelo metrics-generator-worker, que agrega métricas e
34
+ * reaproveita o mesmo _id). Mesma forma de `Content`, sem os campos que só
35
+ * fazem sentido depois de promovido (status de moderação, linha do Google
36
+ * Sheets, flags de edição).
37
+ */
38
+ export declare class ContentDraft {
39
+ _id?: Types.ObjectId;
40
+ caption?: string;
41
+ link: string;
42
+ type: 'reel' | 'carousel' | 'image' | 'story' | 'video' | 'post' | 'pin' | 'tweet';
43
+ tagType: 'withTag' | 'withoutTag' | 'brandExposure';
44
+ socialnetwork: 'instagram' | 'tiktok' | 'youtube' | 'pinterest' | 'linkedin' | 'twitter';
45
+ profile: Types.ObjectId | Profile;
46
+ action: Types.ObjectId | Action;
47
+ postedAt: Date;
48
+ isCollab: boolean;
49
+ isBoosted: boolean;
50
+ hasAffiliateLink: boolean;
51
+ collabs?: Types.ObjectId[] | Profile[];
52
+ metrics: Metrics;
53
+ estimates: Estimates;
54
+ primetagId?: string;
55
+ sentimentAnalysis?: SentimentAnalysis | null;
56
+ thumbnailUrl?: string;
57
+ mediaUrl?: string;
58
+ createdAt?: Date;
59
+ updatedAt?: Date;
60
+ }
61
+ export declare const ContentDraftSchema: MongooseSchema<ContentDraft, import("mongoose").Model<ContentDraft, any, any, any, import("mongoose").Document<unknown, any, ContentDraft, any, {}> & ContentDraft & Required<{
62
+ _id: Types.ObjectId;
63
+ }> & {
64
+ __v: number;
65
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentDraft, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentDraft>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentDraft> & Required<{
66
+ _id: Types.ObjectId;
67
+ }> & {
68
+ __v: number;
69
+ }>;
70
+ export declare const ContentDraftModel: import("mongoose").Model<ContentDraft, {}, {}, {}, import("mongoose").Document<unknown, {}, ContentDraft, {}, import("mongoose").DefaultSchemaOptions> & ContentDraft & Required<{
71
+ _id: Types.ObjectId;
72
+ }> & {
73
+ __v: number;
74
+ }, MongooseSchema<ContentDraft, import("mongoose").Model<ContentDraft, any, any, any, import("mongoose").Document<unknown, any, ContentDraft, any, {}> & ContentDraft & Required<{
75
+ _id: Types.ObjectId;
76
+ }> & {
77
+ __v: number;
78
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentDraft, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentDraft>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentDraft> & Required<{
79
+ _id: Types.ObjectId;
80
+ }> & {
81
+ __v: number;
82
+ }>>;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ContentDraftModel = exports.ContentDraftSchema = exports.ContentDraft = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const content_schema_1 = require("./content.schema");
16
+ /**
17
+ * Resultado do fetch+map da Primetag, antes de ser promovido para `Content`
18
+ * (promoção feita pelo metrics-generator-worker, que agrega métricas e
19
+ * reaproveita o mesmo _id). Mesma forma de `Content`, sem os campos que só
20
+ * fazem sentido depois de promovido (status de moderação, linha do Google
21
+ * Sheets, flags de edição).
22
+ */
23
+ let ContentDraft = class ContentDraft {
24
+ };
25
+ __decorate([
26
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
27
+ __metadata("design:type", mongoose_2.Types.ObjectId)
28
+ ], ContentDraft.prototype, "_id", void 0);
29
+ __decorate([
30
+ (0, mongoose_1.Prop)({ type: String, required: false, default: '' }),
31
+ __metadata("design:type", String)
32
+ ], ContentDraft.prototype, "caption", void 0);
33
+ __decorate([
34
+ (0, mongoose_1.Prop)({ type: String, required: true }),
35
+ __metadata("design:type", String)
36
+ ], ContentDraft.prototype, "link", void 0);
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({
39
+ type: String,
40
+ enum: ['reel', 'image', 'carousel', 'story', 'video', 'post', 'pin', 'tweet'],
41
+ required: true,
42
+ }),
43
+ __metadata("design:type", String)
44
+ ], ContentDraft.prototype, "type", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)({
47
+ type: String,
48
+ enum: ['withTag', 'withoutTag', 'brandExposure'],
49
+ required: true,
50
+ }),
51
+ __metadata("design:type", String)
52
+ ], ContentDraft.prototype, "tagType", void 0);
53
+ __decorate([
54
+ (0, mongoose_1.Prop)({
55
+ type: String,
56
+ enum: ['instagram', 'tiktok', 'youtube', 'pinterest', 'linkedin', 'twitter'],
57
+ required: true,
58
+ }),
59
+ __metadata("design:type", String)
60
+ ], ContentDraft.prototype, "socialnetwork", void 0);
61
+ __decorate([
62
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: true }),
63
+ __metadata("design:type", Object)
64
+ ], ContentDraft.prototype, "profile", void 0);
65
+ __decorate([
66
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: true }),
67
+ __metadata("design:type", Object)
68
+ ], ContentDraft.prototype, "action", void 0);
69
+ __decorate([
70
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
71
+ __metadata("design:type", Date)
72
+ ], ContentDraft.prototype, "postedAt", void 0);
73
+ __decorate([
74
+ (0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
75
+ __metadata("design:type", Boolean)
76
+ ], ContentDraft.prototype, "isCollab", void 0);
77
+ __decorate([
78
+ (0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
79
+ __metadata("design:type", Boolean)
80
+ ], ContentDraft.prototype, "isBoosted", void 0);
81
+ __decorate([
82
+ (0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
83
+ __metadata("design:type", Boolean)
84
+ ], ContentDraft.prototype, "hasAffiliateLink", void 0);
85
+ __decorate([
86
+ (0, mongoose_1.Prop)([{ type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: false }]),
87
+ __metadata("design:type", Array)
88
+ ], ContentDraft.prototype, "collabs", void 0);
89
+ __decorate([
90
+ (0, mongoose_1.Prop)({ type: content_schema_1.MetricsSchema, required: true }),
91
+ __metadata("design:type", content_schema_1.Metrics)
92
+ ], ContentDraft.prototype, "metrics", void 0);
93
+ __decorate([
94
+ (0, mongoose_1.Prop)({ type: content_schema_1.EstimatesSchema, required: true }),
95
+ __metadata("design:type", content_schema_1.Estimates)
96
+ ], ContentDraft.prototype, "estimates", void 0);
97
+ __decorate([
98
+ (0, mongoose_1.Prop)({ type: String, required: false }),
99
+ __metadata("design:type", String)
100
+ ], ContentDraft.prototype, "primetagId", void 0);
101
+ __decorate([
102
+ (0, mongoose_1.Prop)({ type: content_schema_1.SentimentAnalysisSchema, required: false, default: null }),
103
+ __metadata("design:type", Object)
104
+ ], ContentDraft.prototype, "sentimentAnalysis", void 0);
105
+ __decorate([
106
+ (0, mongoose_1.Prop)({ type: String, required: false }),
107
+ __metadata("design:type", String)
108
+ ], ContentDraft.prototype, "thumbnailUrl", void 0);
109
+ __decorate([
110
+ (0, mongoose_1.Prop)({ type: String, required: false }),
111
+ __metadata("design:type", String)
112
+ ], ContentDraft.prototype, "mediaUrl", void 0);
113
+ __decorate([
114
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
115
+ __metadata("design:type", Date)
116
+ ], ContentDraft.prototype, "createdAt", void 0);
117
+ __decorate([
118
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
119
+ __metadata("design:type", Date)
120
+ ], ContentDraft.prototype, "updatedAt", void 0);
121
+ ContentDraft = __decorate([
122
+ (0, mongoose_1.Schema)({ collection: 'content-drafts', timestamps: true })
123
+ ], ContentDraft);
124
+ exports.ContentDraft = ContentDraft;
125
+ exports.ContentDraftSchema = mongoose_1.SchemaFactory.createForClass(ContentDraft);
126
+ exports.ContentDraftSchema.index({ action: 1, primetagId: 1 });
127
+ exports.ContentDraftSchema.index({ action: 1, link: 1 });
128
+ exports.ContentDraftModel = (0, mongoose_2.model)('ContentDraft', exports.ContentDraftSchema);
@@ -0,0 +1,64 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
+ export type ExportCommentsJobDocument = HydratedDocument<ExportCommentsJob>;
28
+ /**
29
+ * Checkpoint de idempotência para o job assíncrono de captura de comentários
30
+ * na exportcomments.com: garante que um crash no meio do polling não crie um
31
+ * job duplicado na API externa ao reprocessar a mensagem.
32
+ */
33
+ export declare class ExportCommentsJob {
34
+ _id?: Types.ObjectId;
35
+ contentId: Types.ObjectId;
36
+ guid?: string;
37
+ jsonUrl?: string;
38
+ status: 'creating' | 'polling' | 'done' | 'error' | 'timeout';
39
+ error?: string;
40
+ createdAt?: Date;
41
+ updatedAt?: Date;
42
+ }
43
+ export declare const ExportCommentsJobSchema: MongooseSchema<ExportCommentsJob, import("mongoose").Model<ExportCommentsJob, any, any, any, import("mongoose").Document<unknown, any, ExportCommentsJob, any, {}> & ExportCommentsJob & Required<{
44
+ _id: Types.ObjectId;
45
+ }> & {
46
+ __v: number;
47
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ExportCommentsJob, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ExportCommentsJob>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ExportCommentsJob> & Required<{
48
+ _id: Types.ObjectId;
49
+ }> & {
50
+ __v: number;
51
+ }>;
52
+ export declare const ExportCommentsJobModel: import("mongoose").Model<ExportCommentsJob, {}, {}, {}, import("mongoose").Document<unknown, {}, ExportCommentsJob, {}, import("mongoose").DefaultSchemaOptions> & ExportCommentsJob & Required<{
53
+ _id: Types.ObjectId;
54
+ }> & {
55
+ __v: number;
56
+ }, MongooseSchema<ExportCommentsJob, import("mongoose").Model<ExportCommentsJob, any, any, any, import("mongoose").Document<unknown, any, ExportCommentsJob, any, {}> & ExportCommentsJob & Required<{
57
+ _id: Types.ObjectId;
58
+ }> & {
59
+ __v: number;
60
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ExportCommentsJob, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ExportCommentsJob>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ExportCommentsJob> & Required<{
61
+ _id: Types.ObjectId;
62
+ }> & {
63
+ __v: number;
64
+ }>>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ExportCommentsJobModel = exports.ExportCommentsJobSchema = exports.ExportCommentsJob = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ /**
16
+ * Checkpoint de idempotência para o job assíncrono de captura de comentários
17
+ * na exportcomments.com: garante que um crash no meio do polling não crie um
18
+ * job duplicado na API externa ao reprocessar a mensagem.
19
+ */
20
+ let ExportCommentsJob = class ExportCommentsJob {
21
+ };
22
+ __decorate([
23
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
24
+ __metadata("design:type", mongoose_2.Types.ObjectId)
25
+ ], ExportCommentsJob.prototype, "_id", void 0);
26
+ __decorate([
27
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, required: true }),
28
+ __metadata("design:type", mongoose_2.Types.ObjectId)
29
+ ], ExportCommentsJob.prototype, "contentId", void 0);
30
+ __decorate([
31
+ (0, mongoose_1.Prop)({ type: String, required: false }),
32
+ __metadata("design:type", String)
33
+ ], ExportCommentsJob.prototype, "guid", void 0);
34
+ __decorate([
35
+ (0, mongoose_1.Prop)({ type: String, required: false }),
36
+ __metadata("design:type", String)
37
+ ], ExportCommentsJob.prototype, "jsonUrl", void 0);
38
+ __decorate([
39
+ (0, mongoose_1.Prop)({
40
+ type: String,
41
+ enum: ['creating', 'polling', 'done', 'error', 'timeout'],
42
+ required: true,
43
+ default: 'creating',
44
+ }),
45
+ __metadata("design:type", String)
46
+ ], ExportCommentsJob.prototype, "status", void 0);
47
+ __decorate([
48
+ (0, mongoose_1.Prop)({ type: String, required: false }),
49
+ __metadata("design:type", String)
50
+ ], ExportCommentsJob.prototype, "error", void 0);
51
+ __decorate([
52
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
53
+ __metadata("design:type", Date)
54
+ ], ExportCommentsJob.prototype, "createdAt", void 0);
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
57
+ __metadata("design:type", Date)
58
+ ], ExportCommentsJob.prototype, "updatedAt", void 0);
59
+ ExportCommentsJob = __decorate([
60
+ (0, mongoose_1.Schema)({ collection: 'export-comments-jobs', timestamps: true })
61
+ ], ExportCommentsJob);
62
+ exports.ExportCommentsJob = ExportCommentsJob;
63
+ exports.ExportCommentsJobSchema = mongoose_1.SchemaFactory.createForClass(ExportCommentsJob);
64
+ exports.ExportCommentsJobSchema.index({ contentId: 1 }, { unique: true });
65
+ exports.ExportCommentsJobModel = (0, mongoose_2.model)('ExportCommentsJob', exports.ExportCommentsJobSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.187",
3
+ "version": "1.0.188",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -28,3 +28,6 @@ export * from './schemas/group.schema';
28
28
  export * from './schemas/tag.schema';
29
29
  export * from './schemas/trigger.schema';
30
30
  export { Note, NoteSchema, NoteMention, NoteMentionSchema } from './schemas/note.schema';
31
+ export * from './schemas/content-capture-process.schema';
32
+ export * from './schemas/content-draft.schema';
33
+ export * from './schemas/export-comments-job.schema';
@@ -0,0 +1,220 @@
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 { Action } from './action.schema';
9
+
10
+ export type ContentCaptureProcessDocument = HydratedDocument<ContentCaptureProcess>;
11
+
12
+ @Schema({ _id: false })
13
+ export class ContentCaptureProcessMetrics {
14
+ @Prop({ type: Number, required: false, default: null })
15
+ impressionCount?: number | null;
16
+
17
+ @Prop({ type: Number, required: false, default: null })
18
+ reachCount?: number | null;
19
+
20
+ @Prop({ type: Number, required: false, default: null })
21
+ engagementCount?: number | null;
22
+
23
+ @Prop({ type: Number, required: false, default: null })
24
+ engagementRate?: number | null;
25
+
26
+ @Prop({ type: Number, required: false, default: null })
27
+ sentimentPositive?: number | null;
28
+
29
+ @Prop({ type: Number, required: false, default: null })
30
+ sentimentNegative?: number | null;
31
+
32
+ @Prop({ type: Number, required: false, default: null })
33
+ sentimentNeutral?: number | null;
34
+
35
+ @Prop({ type: Number, required: false, default: null })
36
+ emv?: number | null;
37
+ }
38
+
39
+ export const ContentCaptureProcessMetricsSchema = SchemaFactory.createForClass(
40
+ ContentCaptureProcessMetrics,
41
+ );
42
+
43
+ @Schema({ _id: false })
44
+ export class ContentCaptureProcessInfluencer {
45
+ @Prop({ type: String, required: false })
46
+ username?: string;
47
+
48
+ @Prop({ type: String, required: false })
49
+ displayName?: string;
50
+
51
+ @Prop({ type: String, required: false })
52
+ platform?: string;
53
+ }
54
+
55
+ export const ContentCaptureProcessInfluencerSchema = SchemaFactory.createForClass(
56
+ ContentCaptureProcessInfluencer,
57
+ );
58
+
59
+ @Schema({ _id: false })
60
+ export class ContentCaptureProcessCommentCaptureStatus {
61
+ @Prop({
62
+ type: String,
63
+ enum: ['captured', 'skipped_cooldown', 'skipped_network', 'out_of_scope', 'failed'],
64
+ required: true,
65
+ })
66
+ status: 'captured' | 'skipped_cooldown' | 'skipped_network' | 'out_of_scope' | 'failed';
67
+
68
+ @Prop({ type: Number, required: false })
69
+ commentsCaptured?: number;
70
+
71
+ @Prop({ type: String, required: false })
72
+ error?: string;
73
+ }
74
+
75
+ export const ContentCaptureProcessCommentCaptureStatusSchema = SchemaFactory.createForClass(
76
+ ContentCaptureProcessCommentCaptureStatus,
77
+ );
78
+
79
+ @Schema({ _id: false })
80
+ export class ContentCaptureProcessItem {
81
+ @Prop({ type: String, required: false })
82
+ primetagId?: string;
83
+
84
+ @Prop({ type: MongooseSchema.Types.ObjectId, required: false })
85
+ contentId?: Types.ObjectId;
86
+
87
+ @Prop({ type: String, required: false })
88
+ link?: string;
89
+
90
+ @Prop({ type: String, required: false })
91
+ type?: string;
92
+
93
+ @Prop({ type: String, required: false })
94
+ socialnetwork?: string;
95
+
96
+ @Prop({ type: String, enum: ['created', 'updated'], required: false })
97
+ status?: 'created' | 'updated';
98
+
99
+ @Prop({ type: ContentCaptureProcessMetricsSchema, required: false })
100
+ metrics?: ContentCaptureProcessMetrics;
101
+
102
+ @Prop({ type: ContentCaptureProcessMetricsSchema, required: false })
103
+ previousMetrics?: ContentCaptureProcessMetrics;
104
+
105
+ @Prop({ type: ContentCaptureProcessInfluencerSchema, required: false })
106
+ influencer?: ContentCaptureProcessInfluencer;
107
+
108
+ @Prop({ type: ContentCaptureProcessCommentCaptureStatusSchema, required: false })
109
+ commentCapture?: ContentCaptureProcessCommentCaptureStatus;
110
+ }
111
+
112
+ export const ContentCaptureProcessItemSchema =
113
+ SchemaFactory.createForClass(ContentCaptureProcessItem);
114
+
115
+ @Schema({ _id: false })
116
+ export class ContentCaptureProcessResponsibleContact {
117
+ @Prop({ type: String, required: false })
118
+ name?: string;
119
+
120
+ @Prop({ type: String, required: false })
121
+ team?: string;
122
+
123
+ @Prop({ type: String, required: false })
124
+ email?: string;
125
+ }
126
+
127
+ export const ContentCaptureProcessResponsibleContactSchema = SchemaFactory.createForClass(
128
+ ContentCaptureProcessResponsibleContact,
129
+ );
130
+
131
+ @Schema({ _id: false })
132
+ export class ContentCaptureProcessResponsibles {
133
+ @Prop({ type: ContentCaptureProcessResponsibleContactSchema, required: false })
134
+ service?: ContentCaptureProcessResponsibleContact;
135
+ }
136
+
137
+ export const ContentCaptureProcessResponsiblesSchema = SchemaFactory.createForClass(
138
+ ContentCaptureProcessResponsibles,
139
+ );
140
+
141
+ @Schema({ collection: 'content-capture-processes', timestamps: true })
142
+ export class ContentCaptureProcess {
143
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
144
+ _id?: Types.ObjectId;
145
+
146
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
147
+ actionId: Types.ObjectId | Action;
148
+
149
+ @Prop({ type: String, required: true })
150
+ runId: string;
151
+
152
+ @Prop({ type: String, required: true })
153
+ actionTitle: string;
154
+
155
+ @Prop({ type: String, required: false })
156
+ primetagId?: string;
157
+
158
+ @Prop({ type: ContentCaptureProcessResponsiblesSchema, required: false })
159
+ responsibles?: ContentCaptureProcessResponsibles;
160
+
161
+ @Prop({
162
+ type: String,
163
+ enum: ['fetching', 'awaiting_comments', 'reported', 'failed'],
164
+ required: true,
165
+ default: 'fetching',
166
+ })
167
+ status: 'fetching' | 'awaiting_comments' | 'reported' | 'failed';
168
+
169
+ @Prop({ type: Number, required: true, default: 0 })
170
+ publicationsFetched: number;
171
+
172
+ @Prop({ type: Number, required: true, default: 0 })
173
+ contentsMapped: number;
174
+
175
+ @Prop({ type: Number, required: true, default: 0 })
176
+ contentsCreated: number;
177
+
178
+ @Prop({ type: Number, required: true, default: 0 })
179
+ contentsUpdated: number;
180
+
181
+ @Prop({ type: Number, required: true, default: 0 })
182
+ expectedCommentCaptureCount: number;
183
+
184
+ @Prop({ type: [MongooseSchema.Types.ObjectId], required: true, default: [] })
185
+ processedContentIds: Types.ObjectId[];
186
+
187
+ @Prop({ type: [ContentCaptureProcessItemSchema], required: true, default: [] })
188
+ contents: ContentCaptureProcessItem[];
189
+
190
+ @Prop({ type: String, required: false })
191
+ error?: string;
192
+
193
+ @Prop({ type: Date, required: true, default: Date.now })
194
+ startedAt: Date;
195
+
196
+ @Prop({ type: Date, required: false })
197
+ fetchFinishedAt?: Date;
198
+
199
+ @Prop({ type: Date, required: false })
200
+ commentsFinishedAt?: Date;
201
+
202
+ @Prop({ type: Date, required: false })
203
+ reportedAt?: Date;
204
+
205
+ @Prop({ default: Date.now, required: false })
206
+ createdAt?: Date;
207
+
208
+ @Prop({ default: Date.now, required: false })
209
+ updatedAt?: Date;
210
+ }
211
+
212
+ export const ContentCaptureProcessSchema = SchemaFactory.createForClass(ContentCaptureProcess);
213
+
214
+ ContentCaptureProcessSchema.index({ actionId: 1, runId: 1 }, { unique: true });
215
+ ContentCaptureProcessSchema.index({ status: 1 });
216
+
217
+ export const ContentCaptureProcessModel = MongooseModel(
218
+ 'ContentCaptureProcess',
219
+ ContentCaptureProcessSchema,
220
+ );
@@ -0,0 +1,111 @@
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
+ import { Action } from './action.schema';
10
+ import {
11
+ Metrics,
12
+ MetricsSchema,
13
+ Estimates,
14
+ EstimatesSchema,
15
+ SentimentAnalysis,
16
+ SentimentAnalysisSchema,
17
+ } from './content.schema';
18
+
19
+ export type ContentDraftDocument = HydratedDocument<ContentDraft>;
20
+
21
+ /**
22
+ * Resultado do fetch+map da Primetag, antes de ser promovido para `Content`
23
+ * (promoção feita pelo metrics-generator-worker, que agrega métricas e
24
+ * reaproveita o mesmo _id). Mesma forma de `Content`, sem os campos que só
25
+ * fazem sentido depois de promovido (status de moderação, linha do Google
26
+ * Sheets, flags de edição).
27
+ */
28
+ @Schema({ collection: 'content-drafts', timestamps: true })
29
+ export class ContentDraft {
30
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
31
+ _id?: Types.ObjectId;
32
+
33
+ @Prop({ type: String, required: false, default: '' })
34
+ caption?: string;
35
+
36
+ @Prop({ type: String, required: true })
37
+ link: string;
38
+
39
+ @Prop({
40
+ type: String,
41
+ enum: ['reel', 'image', 'carousel', 'story', 'video', 'post', 'pin', 'tweet'],
42
+ required: true,
43
+ })
44
+ type: 'reel' | 'carousel' | 'image' | 'story' | 'video' | 'post' | 'pin' | 'tweet';
45
+
46
+ @Prop({
47
+ type: String,
48
+ enum: ['withTag', 'withoutTag', 'brandExposure'],
49
+ required: true,
50
+ })
51
+ tagType: 'withTag' | 'withoutTag' | 'brandExposure';
52
+
53
+ @Prop({
54
+ type: String,
55
+ enum: ['instagram', 'tiktok', 'youtube', 'pinterest', 'linkedin', 'twitter'],
56
+ required: true,
57
+ })
58
+ socialnetwork: 'instagram' | 'tiktok' | 'youtube' | 'pinterest' | 'linkedin' | 'twitter';
59
+
60
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
61
+ profile: Types.ObjectId | Profile;
62
+
63
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
64
+ action: Types.ObjectId | Action;
65
+
66
+ @Prop({ type: Date, required: true })
67
+ postedAt: Date;
68
+
69
+ @Prop({ type: Boolean, required: true, default: false })
70
+ isCollab: boolean;
71
+
72
+ @Prop({ type: Boolean, required: true, default: false })
73
+ isBoosted: boolean;
74
+
75
+ @Prop({ type: Boolean, required: true, default: false })
76
+ hasAffiliateLink: boolean;
77
+
78
+ @Prop([{ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: false }])
79
+ collabs?: Types.ObjectId[] | Profile[];
80
+
81
+ @Prop({ type: MetricsSchema, required: true })
82
+ metrics: Metrics;
83
+
84
+ @Prop({ type: EstimatesSchema, required: true })
85
+ estimates: Estimates;
86
+
87
+ @Prop({ type: String, required: false })
88
+ primetagId?: string;
89
+
90
+ @Prop({ type: SentimentAnalysisSchema, required: false, default: null })
91
+ sentimentAnalysis?: SentimentAnalysis | null;
92
+
93
+ @Prop({ type: String, required: false })
94
+ thumbnailUrl?: string;
95
+
96
+ @Prop({ type: String, required: false })
97
+ mediaUrl?: string;
98
+
99
+ @Prop({ default: Date.now, required: false })
100
+ createdAt?: Date;
101
+
102
+ @Prop({ default: Date.now, required: false })
103
+ updatedAt?: Date;
104
+ }
105
+
106
+ export const ContentDraftSchema = SchemaFactory.createForClass(ContentDraft);
107
+
108
+ ContentDraftSchema.index({ action: 1, primetagId: 1 });
109
+ ContentDraftSchema.index({ action: 1, link: 1 });
110
+
111
+ export const ContentDraftModel = MongooseModel('ContentDraft', ContentDraftSchema);
@@ -0,0 +1,52 @@
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
+
9
+ export type ExportCommentsJobDocument = HydratedDocument<ExportCommentsJob>;
10
+
11
+ /**
12
+ * Checkpoint de idempotência para o job assíncrono de captura de comentários
13
+ * na exportcomments.com: garante que um crash no meio do polling não crie um
14
+ * job duplicado na API externa ao reprocessar a mensagem.
15
+ */
16
+ @Schema({ collection: 'export-comments-jobs', timestamps: true })
17
+ export class ExportCommentsJob {
18
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
19
+ _id?: Types.ObjectId;
20
+
21
+ @Prop({ type: MongooseSchema.Types.ObjectId, required: true })
22
+ contentId: Types.ObjectId;
23
+
24
+ @Prop({ type: String, required: false })
25
+ guid?: string;
26
+
27
+ @Prop({ type: String, required: false })
28
+ jsonUrl?: string;
29
+
30
+ @Prop({
31
+ type: String,
32
+ enum: ['creating', 'polling', 'done', 'error', 'timeout'],
33
+ required: true,
34
+ default: 'creating',
35
+ })
36
+ status: 'creating' | 'polling' | 'done' | 'error' | 'timeout';
37
+
38
+ @Prop({ type: String, required: false })
39
+ error?: string;
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 ExportCommentsJobSchema = SchemaFactory.createForClass(ExportCommentsJob);
49
+
50
+ ExportCommentsJobSchema.index({ contentId: 1 }, { unique: true });
51
+
52
+ export const ExportCommentsJobModel = MongooseModel('ExportCommentsJob', ExportCommentsJobSchema);