@grapadigital/shared-schemas 1.0.186 → 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 +4 -0
- package/dist/index.js +4 -0
- package/dist/schemas/comment.schema.d.ts +72 -0
- package/dist/schemas/comment.schema.js +117 -0
- package/dist/schemas/content-capture-process.schema.d.ts +167 -0
- package/dist/schemas/content-capture-process.schema.js +271 -0
- package/dist/schemas/content-draft.schema.d.ts +82 -0
- package/dist/schemas/content-draft.schema.js +128 -0
- package/dist/schemas/export-comments-job.schema.d.ts +64 -0
- package/dist/schemas/export-comments-job.schema.js +65 -0
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/schemas/comment.schema.ts +95 -0
- package/src/schemas/content-capture-process.schema.ts +220 -0
- package/src/schemas/content-draft.schema.ts +111 -0
- package/src/schemas/export-comments-job.schema.ts +52 -0
|
@@ -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
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './schemas/action.schema';
|
|
2
2
|
export * from './schemas/client.schema';
|
|
3
3
|
export * from './schemas/content.schema';
|
|
4
|
+
export * from './schemas/comment.schema';
|
|
4
5
|
export * from './schemas/influencer.schema';
|
|
5
6
|
export * from './schemas/supplier.schema';
|
|
6
7
|
export * from './schemas/campaign.schema';
|
|
@@ -27,3 +28,6 @@ export * from './schemas/group.schema';
|
|
|
27
28
|
export * from './schemas/tag.schema';
|
|
28
29
|
export * from './schemas/trigger.schema';
|
|
29
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,95 @@
|
|
|
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 { Content } from './content.schema';
|
|
9
|
+
import { Action } from './action.schema';
|
|
10
|
+
|
|
11
|
+
export type CommentDocument = HydratedDocument<Comment>;
|
|
12
|
+
|
|
13
|
+
@Schema({ timestamps: true })
|
|
14
|
+
export class Comment {
|
|
15
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
16
|
+
_id?: Types.ObjectId;
|
|
17
|
+
|
|
18
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Content', required: true })
|
|
19
|
+
content: Types.ObjectId | Content;
|
|
20
|
+
|
|
21
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
|
|
22
|
+
action: Types.ObjectId | Action;
|
|
23
|
+
|
|
24
|
+
@Prop({ type: String, required: true })
|
|
25
|
+
externalId: string;
|
|
26
|
+
|
|
27
|
+
@Prop({ type: String, required: true })
|
|
28
|
+
author: string;
|
|
29
|
+
|
|
30
|
+
@Prop({ type: String, required: false, default: null })
|
|
31
|
+
authorProfileUrl?: string | null;
|
|
32
|
+
|
|
33
|
+
@Prop({ type: String, required: false, default: null })
|
|
34
|
+
authorThumbnailUrl?: string | null;
|
|
35
|
+
|
|
36
|
+
@Prop({ type: String, required: true })
|
|
37
|
+
text: string;
|
|
38
|
+
|
|
39
|
+
@Prop({ type: String, required: false, default: null })
|
|
40
|
+
url?: string | null;
|
|
41
|
+
|
|
42
|
+
@Prop({ type: Date, required: true })
|
|
43
|
+
postedAt: Date;
|
|
44
|
+
|
|
45
|
+
@Prop({ type: Number, required: false, default: 0 })
|
|
46
|
+
likeCount?: number;
|
|
47
|
+
|
|
48
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Comment', required: false, default: null })
|
|
49
|
+
parent?: Types.ObjectId | Comment | null;
|
|
50
|
+
|
|
51
|
+
@Prop({
|
|
52
|
+
type: [String],
|
|
53
|
+
enum: ['brand', 'influencer', 'content', 'emoji', 'spam'],
|
|
54
|
+
required: false,
|
|
55
|
+
default: [],
|
|
56
|
+
})
|
|
57
|
+
target?: ('brand' | 'influencer' | 'content' | 'emoji' | 'spam')[];
|
|
58
|
+
|
|
59
|
+
@Prop({
|
|
60
|
+
type: String,
|
|
61
|
+
enum: ['positive', 'negative', 'neutral'],
|
|
62
|
+
required: false,
|
|
63
|
+
default: null,
|
|
64
|
+
})
|
|
65
|
+
polarity?: 'positive' | 'negative' | 'neutral' | null;
|
|
66
|
+
|
|
67
|
+
@Prop({
|
|
68
|
+
type: String,
|
|
69
|
+
enum: ['awareness', 'consideration', 'conversion'],
|
|
70
|
+
required: false,
|
|
71
|
+
default: null,
|
|
72
|
+
})
|
|
73
|
+
funnel?: 'awareness' | 'consideration' | 'conversion' | null;
|
|
74
|
+
|
|
75
|
+
@Prop({ type: Boolean, required: false, default: false })
|
|
76
|
+
isEmojiOnly?: boolean;
|
|
77
|
+
|
|
78
|
+
@Prop({ type: Boolean, required: false, default: false })
|
|
79
|
+
isSpam?: boolean;
|
|
80
|
+
|
|
81
|
+
@Prop({ default: Date.now, required: false })
|
|
82
|
+
createdAt?: Date;
|
|
83
|
+
|
|
84
|
+
@Prop({ default: Date.now, required: false })
|
|
85
|
+
updatedAt?: Date;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const CommentSchema = SchemaFactory.createForClass(Comment);
|
|
89
|
+
|
|
90
|
+
CommentSchema.index({ content: 1, externalId: 1 }, { unique: true });
|
|
91
|
+
CommentSchema.index({ action: 1, funnel: 1 });
|
|
92
|
+
CommentSchema.index({ action: 1, target: 1 });
|
|
93
|
+
CommentSchema.index({ content: 1, parent: 1 });
|
|
94
|
+
|
|
95
|
+
export const CommentModel = MongooseModel('Comment', CommentSchema);
|