@grapadigital/shared-schemas 1.0.187 → 1.0.189

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,70 @@
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 ContentDraftDocument = HydratedDocument<ContentDraft>;
29
+ /**
30
+ * Registro bruto de auditoria de uma publication devolvida pela Primetag —
31
+ * sem nenhum mapeamento de campo de negócio (isso só acontece no
32
+ * metrics-generator-worker, no momento da promoção pra `Content`). Guarda o
33
+ * payload exato da Primetag em `raw`; `action`+`primetagId` é só a chave de
34
+ * dedupe, nada mais é derivado/persistido aqui (nem `profile` — quem precisar
35
+ * saber se a publication tem `Recruitment` correspondente resolve isso na
36
+ * hora, em memória, sem gravar no draft). O acesso downstream (metrics-
37
+ * generator-worker) é sempre por `_id` (reaproveitado como `Comment.content`
38
+ * e depois como `Content._id` na promoção), então nenhum índice além do
39
+ * `{action, primetagId}` de dedupe é necessário.
40
+ */
41
+ export declare class ContentDraft {
42
+ _id?: Types.ObjectId;
43
+ action: Types.ObjectId | Action;
44
+ primetagId: string;
45
+ raw: Record<string, unknown>;
46
+ createdAt?: Date;
47
+ updatedAt?: Date;
48
+ }
49
+ export declare const ContentDraftSchema: MongooseSchema<ContentDraft, import("mongoose").Model<ContentDraft, any, any, any, import("mongoose").Document<unknown, any, ContentDraft, any, {}> & ContentDraft & Required<{
50
+ _id: Types.ObjectId;
51
+ }> & {
52
+ __v: number;
53
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentDraft, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentDraft>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentDraft> & Required<{
54
+ _id: Types.ObjectId;
55
+ }> & {
56
+ __v: number;
57
+ }>;
58
+ export declare const ContentDraftModel: import("mongoose").Model<ContentDraft, {}, {}, {}, import("mongoose").Document<unknown, {}, ContentDraft, {}, import("mongoose").DefaultSchemaOptions> & ContentDraft & Required<{
59
+ _id: Types.ObjectId;
60
+ }> & {
61
+ __v: number;
62
+ }, MongooseSchema<ContentDraft, import("mongoose").Model<ContentDraft, any, any, any, import("mongoose").Document<unknown, any, ContentDraft, any, {}> & ContentDraft & Required<{
63
+ _id: Types.ObjectId;
64
+ }> & {
65
+ __v: number;
66
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentDraft, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentDraft>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentDraft> & Required<{
67
+ _id: Types.ObjectId;
68
+ }> & {
69
+ __v: number;
70
+ }>>;
@@ -0,0 +1,59 @@
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
+ /**
16
+ * Registro bruto de auditoria de uma publication devolvida pela Primetag —
17
+ * sem nenhum mapeamento de campo de negócio (isso só acontece no
18
+ * metrics-generator-worker, no momento da promoção pra `Content`). Guarda o
19
+ * payload exato da Primetag em `raw`; `action`+`primetagId` é só a chave de
20
+ * dedupe, nada mais é derivado/persistido aqui (nem `profile` — quem precisar
21
+ * saber se a publication tem `Recruitment` correspondente resolve isso na
22
+ * hora, em memória, sem gravar no draft). O acesso downstream (metrics-
23
+ * generator-worker) é sempre por `_id` (reaproveitado como `Comment.content`
24
+ * e depois como `Content._id` na promoção), então nenhum índice além do
25
+ * `{action, primetagId}` de dedupe é necessário.
26
+ */
27
+ let ContentDraft = class ContentDraft {
28
+ };
29
+ __decorate([
30
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
31
+ __metadata("design:type", mongoose_2.Types.ObjectId)
32
+ ], ContentDraft.prototype, "_id", void 0);
33
+ __decorate([
34
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Action', required: true }),
35
+ __metadata("design:type", Object)
36
+ ], ContentDraft.prototype, "action", void 0);
37
+ __decorate([
38
+ (0, mongoose_1.Prop)({ type: String, required: true }),
39
+ __metadata("design:type", String)
40
+ ], ContentDraft.prototype, "primetagId", void 0);
41
+ __decorate([
42
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.Mixed, required: true }),
43
+ __metadata("design:type", Object)
44
+ ], ContentDraft.prototype, "raw", void 0);
45
+ __decorate([
46
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
47
+ __metadata("design:type", Date)
48
+ ], ContentDraft.prototype, "createdAt", void 0);
49
+ __decorate([
50
+ (0, mongoose_1.Prop)({ default: Date.now, required: false }),
51
+ __metadata("design:type", Date)
52
+ ], ContentDraft.prototype, "updatedAt", void 0);
53
+ ContentDraft = __decorate([
54
+ (0, mongoose_1.Schema)({ collection: 'content-drafts', timestamps: true })
55
+ ], ContentDraft);
56
+ exports.ContentDraft = ContentDraft;
57
+ exports.ContentDraftSchema = mongoose_1.SchemaFactory.createForClass(ContentDraft);
58
+ exports.ContentDraftSchema.index({ action: 1, primetagId: 1 }, { unique: true });
59
+ 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.189",
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,49 @@
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 ContentDraftDocument = HydratedDocument<ContentDraft>;
11
+
12
+ /**
13
+ * Registro bruto de auditoria de uma publication devolvida pela Primetag —
14
+ * sem nenhum mapeamento de campo de negócio (isso só acontece no
15
+ * metrics-generator-worker, no momento da promoção pra `Content`). Guarda o
16
+ * payload exato da Primetag em `raw`; `action`+`primetagId` é só a chave de
17
+ * dedupe, nada mais é derivado/persistido aqui (nem `profile` — quem precisar
18
+ * saber se a publication tem `Recruitment` correspondente resolve isso na
19
+ * hora, em memória, sem gravar no draft). O acesso downstream (metrics-
20
+ * generator-worker) é sempre por `_id` (reaproveitado como `Comment.content`
21
+ * e depois como `Content._id` na promoção), então nenhum índice além do
22
+ * `{action, primetagId}` de dedupe é necessário.
23
+ */
24
+ @Schema({ collection: 'content-drafts', timestamps: true })
25
+ export class ContentDraft {
26
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
27
+ _id?: Types.ObjectId;
28
+
29
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
30
+ action: Types.ObjectId | Action;
31
+
32
+ @Prop({ type: String, required: true })
33
+ primetagId: string;
34
+
35
+ @Prop({ type: MongooseSchema.Types.Mixed, required: true })
36
+ raw: Record<string, unknown>;
37
+
38
+ @Prop({ default: Date.now, required: false })
39
+ createdAt?: Date;
40
+
41
+ @Prop({ default: Date.now, required: false })
42
+ updatedAt?: Date;
43
+ }
44
+
45
+ export const ContentDraftSchema = SchemaFactory.createForClass(ContentDraft);
46
+
47
+ ContentDraftSchema.index({ action: 1, primetagId: 1 }, { unique: true });
48
+
49
+ 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);