@grapadigital/shared-schemas 1.0.242 → 1.1.0
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 +42 -42
- package/dist/schemas/action.schema.d.ts +9 -34
- package/dist/schemas/action.schema.js +81 -64
- package/dist/schemas/assignment.schema.d.ts +3 -28
- package/dist/schemas/assignment.schema.js +44 -44
- package/dist/schemas/benchmark.schema.d.ts +3 -28
- package/dist/schemas/benchmark.schema.js +11 -6
- package/dist/schemas/campaign.schema.d.ts +2 -27
- package/dist/schemas/campaign.schema.js +4 -4
- package/dist/schemas/client.schema.d.ts +18 -79
- package/dist/schemas/client.schema.js +73 -71
- package/dist/schemas/comment.schema.d.ts +5 -30
- package/dist/schemas/comment.schema.js +42 -37
- package/dist/schemas/commission.schema.d.ts +5 -30
- package/dist/schemas/commission.schema.js +10 -10
- package/dist/schemas/content-capture-process.schema.d.ts +6 -31
- package/dist/schemas/content-capture-process.schema.js +24 -17
- package/dist/schemas/content-draft.schema.d.ts +2 -27
- package/dist/schemas/content-draft.schema.js +5 -5
- package/dist/schemas/content.schema.d.ts +6 -31
- package/dist/schemas/content.schema.js +84 -74
- package/dist/schemas/contract.schema.d.ts +3 -28
- package/dist/schemas/contract.schema.js +5 -5
- package/dist/schemas/creative.schema.d.ts +6 -31
- package/dist/schemas/creative.schema.js +22 -31
- package/dist/schemas/export-comments-job.schema.d.ts +2 -27
- package/dist/schemas/export-comments-job.schema.js +6 -6
- package/dist/schemas/group.schema.d.ts +1 -26
- package/dist/schemas/group.schema.js +5 -5
- package/dist/schemas/influencer.schema.d.ts +6 -31
- package/dist/schemas/influencer.schema.js +16 -18
- package/dist/schemas/invoice.schema.d.ts +4 -29
- package/dist/schemas/invoice.schema.js +42 -32
- package/dist/schemas/job.schema.d.ts +2 -27
- package/dist/schemas/job.schema.js +14 -14
- package/dist/schemas/lead.schema.d.ts +1 -26
- package/dist/schemas/lead.schema.js +67 -64
- package/dist/schemas/log.schema.d.ts +1 -26
- package/dist/schemas/log.schema.js +24 -24
- package/dist/schemas/note.schema.d.ts +1 -26
- package/dist/schemas/note.schema.js +9 -9
- package/dist/schemas/notifications.schema.d.ts +1 -26
- package/dist/schemas/notifications.schema.js +8 -8
- package/dist/schemas/organization.schema.d.ts +1 -26
- package/dist/schemas/organization.schema.js +4 -4
- package/dist/schemas/party.schema.d.ts +1 -26
- package/dist/schemas/party.schema.js +11 -11
- package/dist/schemas/payment.schema.d.ts +10 -35
- package/dist/schemas/payment.schema.js +63 -54
- package/dist/schemas/profile.schema.d.ts +3 -28
- package/dist/schemas/profile.schema.js +6 -6
- package/dist/schemas/project.schema.d.ts +4 -29
- package/dist/schemas/project.schema.js +13 -13
- package/dist/schemas/prospect.schema.d.ts +3 -28
- package/dist/schemas/prospect.schema.js +9 -9
- package/dist/schemas/recruitment.schema.d.ts +5 -30
- package/dist/schemas/recruitment.schema.js +36 -36
- package/dist/schemas/responsible.schema.d.ts +0 -26
- package/dist/schemas/responsible.schema.js +6 -6
- package/dist/schemas/sale.schema.d.ts +16 -41
- package/dist/schemas/sale.schema.js +43 -51
- package/dist/schemas/script.schema.d.ts +6 -31
- package/dist/schemas/script.schema.js +21 -30
- package/dist/schemas/snapshot.schema.d.ts +3 -28
- package/dist/schemas/snapshot.schema.js +6 -6
- package/dist/schemas/store-visit.schema.d.ts +2 -27
- package/dist/schemas/store-visit.schema.js +21 -17
- package/dist/schemas/store.schema.d.ts +3 -28
- package/dist/schemas/store.schema.js +8 -8
- package/dist/schemas/supplier.schema.d.ts +2 -27
- package/dist/schemas/supplier.schema.js +3 -3
- package/dist/schemas/tag.schema.d.ts +1 -26
- package/dist/schemas/tag.schema.js +5 -5
- package/dist/schemas/task.schema.d.ts +9 -34
- package/dist/schemas/task.schema.js +67 -67
- package/dist/schemas/token.schema.d.ts +1 -26
- package/dist/schemas/token.schema.js +3 -3
- package/dist/schemas/trigger.schema.d.ts +2 -27
- package/dist/schemas/trigger.schema.js +5 -5
- package/dist/schemas/user.schema.d.ts +2 -27
- package/dist/schemas/user.schema.js +7 -7
- package/dist/schemas/webhook.schema.d.ts +1 -26
- package/dist/schemas/webhook.schema.js +10 -10
- package/dist/utils/merge-metrics-breakdown.util.d.ts +1 -1
- package/dist/utils/merge-metrics-breakdown.util.js +7 -2
- package/dist/utils/normalize-content-link.util.js +7 -7
- package/package.json +23 -13
- package/.eslintrc.json +0 -28
- package/.prettierrc +0 -4
- package/dist/schemas/profile-followers-snapshot.schema.d.ts +0 -67
- package/dist/schemas/profile-followers-snapshot.schema.js +0 -65
- package/dist/schemas/schedule.schema.d.ts +0 -73
- package/dist/schemas/schedule.schema.js +0 -116
- package/dist/utils/cost-per-impact.util.d.ts +0 -37
- package/dist/utils/cost-per-impact.util.js +0 -72
- package/dist/utils/influencer-contract.util.d.ts +0 -32
- package/dist/utils/influencer-contract.util.js +0 -77
- package/docs/code-review.md +0 -27
- package/docs/constitution.md +0 -75
- package/docs/specs/GD-692.md +0 -112
- package/docs/specs/GD-761.md +0 -94
- package/index.d.ts +0 -3
- package/src/index.ts +0 -42
- package/src/schemas/action.schema.ts +0 -328
- package/src/schemas/assignment.schema.ts +0 -154
- package/src/schemas/benchmark.schema.ts +0 -39
- package/src/schemas/campaign.schema.ts +0 -38
- package/src/schemas/client.schema.ts +0 -319
- package/src/schemas/comment.schema.ts +0 -216
- package/src/schemas/commission.schema.ts +0 -108
- package/src/schemas/content-capture-process.schema.ts +0 -195
- package/src/schemas/content-draft.schema.ts +0 -49
- package/src/schemas/content.schema.ts +0 -688
- package/src/schemas/contract.schema.ts +0 -44
- package/src/schemas/creative.schema.ts +0 -256
- package/src/schemas/export-comments-job.schema.ts +0 -59
- package/src/schemas/group.schema.ts +0 -23
- package/src/schemas/influencer.schema.ts +0 -184
- package/src/schemas/invoice.schema.ts +0 -164
- package/src/schemas/job.schema.ts +0 -111
- package/src/schemas/lead.schema.ts +0 -372
- package/src/schemas/log.schema.ts +0 -91
- package/src/schemas/note.schema.ts +0 -34
- package/src/schemas/notifications.schema.ts +0 -61
- package/src/schemas/organization.schema.ts +0 -29
- package/src/schemas/party.schema.ts +0 -65
- package/src/schemas/payment.schema.ts +0 -275
- package/src/schemas/profile.schema.ts +0 -77
- package/src/schemas/project.schema.ts +0 -116
- package/src/schemas/prospect.schema.ts +0 -62
- package/src/schemas/recruitment.schema.ts +0 -277
- package/src/schemas/responsible.schema.ts +0 -27
- package/src/schemas/sale.schema.ts +0 -297
- package/src/schemas/script.schema.ts +0 -235
- package/src/schemas/snapshot.schema.ts +0 -55
- package/src/schemas/store-visit.schema.ts +0 -68
- package/src/schemas/store.schema.ts +0 -52
- package/src/schemas/supplier.schema.ts +0 -12
- package/src/schemas/tag.schema.ts +0 -26
- package/src/schemas/task.schema.ts +0 -205
- package/src/schemas/token.schema.ts +0 -42
- package/src/schemas/trigger.schema.ts +0 -48
- package/src/schemas/user.schema.ts +0 -59
- package/src/schemas/webhook.schema.ts +0 -81
- package/src/utils/merge-metrics-breakdown.util.ts +0 -51
- package/src/utils/normalize-content-link.util.ts +0 -31
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -29
|
@@ -1,195 +0,0 @@
|
|
|
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
|
-
import { Responsible, ResponsibleSchema } from './responsible.schema';
|
|
10
|
-
|
|
11
|
-
export type ContentCaptureProcessDocument = HydratedDocument<ContentCaptureProcess>;
|
|
12
|
-
|
|
13
|
-
@Schema({ _id: false })
|
|
14
|
-
export class ContentCaptureProcessMetrics {
|
|
15
|
-
@Prop({ type: Number, required: false, default: null })
|
|
16
|
-
impressionCount?: number | null;
|
|
17
|
-
|
|
18
|
-
@Prop({ type: Number, required: false, default: null })
|
|
19
|
-
reachCount?: number | null;
|
|
20
|
-
|
|
21
|
-
@Prop({ type: Number, required: false, default: null })
|
|
22
|
-
engagementCount?: number | null;
|
|
23
|
-
|
|
24
|
-
@Prop({ type: Number, required: false, default: null })
|
|
25
|
-
engagementRate?: number | null;
|
|
26
|
-
|
|
27
|
-
@Prop({ type: Number, required: false, default: null })
|
|
28
|
-
sentimentPositive?: number | null;
|
|
29
|
-
|
|
30
|
-
@Prop({ type: Number, required: false, default: null })
|
|
31
|
-
sentimentNegative?: number | null;
|
|
32
|
-
|
|
33
|
-
@Prop({ type: Number, required: false, default: null })
|
|
34
|
-
sentimentNeutral?: number | null;
|
|
35
|
-
|
|
36
|
-
@Prop({ type: Number, required: false, default: null })
|
|
37
|
-
earnedMediaValue?: number | null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const ContentCaptureProcessMetricsSchema = SchemaFactory.createForClass(
|
|
41
|
-
ContentCaptureProcessMetrics,
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
@Schema({ _id: false })
|
|
45
|
-
export class ContentCaptureProcessInfluencer {
|
|
46
|
-
@Prop({ type: String, required: false })
|
|
47
|
-
username?: string;
|
|
48
|
-
|
|
49
|
-
@Prop({ type: String, required: false })
|
|
50
|
-
displayName?: string;
|
|
51
|
-
|
|
52
|
-
@Prop({ type: String, required: false })
|
|
53
|
-
platform?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const ContentCaptureProcessInfluencerSchema = SchemaFactory.createForClass(
|
|
57
|
-
ContentCaptureProcessInfluencer,
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
@Schema({ _id: false })
|
|
61
|
-
export class ContentCaptureProcessCommentCaptureStatus {
|
|
62
|
-
@Prop({
|
|
63
|
-
type: String,
|
|
64
|
-
enum: ['captured', 'skipped_cooldown', 'skipped_network', 'skipped_no_comments', 'out_of_scope', 'failed'],
|
|
65
|
-
required: true,
|
|
66
|
-
})
|
|
67
|
-
status: 'captured' | 'skipped_cooldown' | 'skipped_network' | 'skipped_no_comments' | 'out_of_scope' | 'failed';
|
|
68
|
-
|
|
69
|
-
@Prop({ type: Number, required: false })
|
|
70
|
-
commentsCaptured?: number;
|
|
71
|
-
|
|
72
|
-
@Prop({ type: String, required: false })
|
|
73
|
-
error?: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const ContentCaptureProcessCommentCaptureStatusSchema = SchemaFactory.createForClass(
|
|
77
|
-
ContentCaptureProcessCommentCaptureStatus,
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
@Schema({ _id: false })
|
|
81
|
-
export class ContentCaptureProcessItem {
|
|
82
|
-
@Prop({ type: String, required: false })
|
|
83
|
-
primetagId?: string;
|
|
84
|
-
|
|
85
|
-
@Prop({ type: MongooseSchema.Types.ObjectId, required: false })
|
|
86
|
-
contentId?: Types.ObjectId;
|
|
87
|
-
|
|
88
|
-
@Prop({ type: String, required: false })
|
|
89
|
-
link?: string;
|
|
90
|
-
|
|
91
|
-
@Prop({ type: String, required: false })
|
|
92
|
-
type?: string;
|
|
93
|
-
|
|
94
|
-
@Prop({ type: String, required: false })
|
|
95
|
-
socialnetwork?: string;
|
|
96
|
-
|
|
97
|
-
@Prop({ type: String, enum: ['created', 'updated'], required: false })
|
|
98
|
-
status?: 'created' | 'updated';
|
|
99
|
-
|
|
100
|
-
@Prop({ type: ContentCaptureProcessMetricsSchema, required: false })
|
|
101
|
-
metrics?: ContentCaptureProcessMetrics;
|
|
102
|
-
|
|
103
|
-
@Prop({ type: ContentCaptureProcessMetricsSchema, required: false })
|
|
104
|
-
previousMetrics?: ContentCaptureProcessMetrics;
|
|
105
|
-
|
|
106
|
-
@Prop({ type: ContentCaptureProcessInfluencerSchema, required: false })
|
|
107
|
-
influencer?: ContentCaptureProcessInfluencer;
|
|
108
|
-
|
|
109
|
-
@Prop({ type: ContentCaptureProcessCommentCaptureStatusSchema, required: false })
|
|
110
|
-
commentCapture?: ContentCaptureProcessCommentCaptureStatus;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export const ContentCaptureProcessItemSchema =
|
|
114
|
-
SchemaFactory.createForClass(ContentCaptureProcessItem);
|
|
115
|
-
|
|
116
|
-
@Schema({ collection: 'content-capture-processes', timestamps: true })
|
|
117
|
-
export class ContentCaptureProcess {
|
|
118
|
-
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
119
|
-
_id?: Types.ObjectId;
|
|
120
|
-
|
|
121
|
-
@Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action', required: true })
|
|
122
|
-
actionId: Types.ObjectId | Action;
|
|
123
|
-
|
|
124
|
-
@Prop({ type: String, required: true })
|
|
125
|
-
runId: string;
|
|
126
|
-
|
|
127
|
-
@Prop({ type: String, required: true })
|
|
128
|
-
actionTitle: string;
|
|
129
|
-
|
|
130
|
-
@Prop({ type: String, required: false })
|
|
131
|
-
primetagId?: string;
|
|
132
|
-
|
|
133
|
-
@Prop({ type: [ResponsibleSchema], required: false, default: [] })
|
|
134
|
-
responsible?: Responsible[];
|
|
135
|
-
|
|
136
|
-
@Prop({
|
|
137
|
-
type: String,
|
|
138
|
-
enum: ['fetching', 'awaiting_comments', 'reported', 'failed'],
|
|
139
|
-
required: true,
|
|
140
|
-
default: 'fetching',
|
|
141
|
-
})
|
|
142
|
-
status: 'fetching' | 'awaiting_comments' | 'reported' | 'failed';
|
|
143
|
-
|
|
144
|
-
@Prop({ type: Number, required: true, default: 0 })
|
|
145
|
-
publicationsFetched: number;
|
|
146
|
-
|
|
147
|
-
@Prop({ type: Number, required: true, default: 0 })
|
|
148
|
-
contentsMapped: number;
|
|
149
|
-
|
|
150
|
-
@Prop({ type: Number, required: true, default: 0 })
|
|
151
|
-
contentsCreated: number;
|
|
152
|
-
|
|
153
|
-
@Prop({ type: Number, required: true, default: 0 })
|
|
154
|
-
contentsUpdated: number;
|
|
155
|
-
|
|
156
|
-
@Prop({ type: Number, required: true, default: 0 })
|
|
157
|
-
expectedCommentCaptureCount: number;
|
|
158
|
-
|
|
159
|
-
@Prop({ type: [MongooseSchema.Types.ObjectId], required: true, default: [] })
|
|
160
|
-
processedContentIds: Types.ObjectId[];
|
|
161
|
-
|
|
162
|
-
@Prop({ type: [ContentCaptureProcessItemSchema], required: true, default: [] })
|
|
163
|
-
contents: ContentCaptureProcessItem[];
|
|
164
|
-
|
|
165
|
-
@Prop({ type: String, required: false })
|
|
166
|
-
error?: string;
|
|
167
|
-
|
|
168
|
-
@Prop({ type: Date, required: true, default: Date.now })
|
|
169
|
-
startedAt: Date;
|
|
170
|
-
|
|
171
|
-
@Prop({ type: Date, required: false })
|
|
172
|
-
fetchFinishedAt?: Date;
|
|
173
|
-
|
|
174
|
-
@Prop({ type: Date, required: false })
|
|
175
|
-
commentsFinishedAt?: Date;
|
|
176
|
-
|
|
177
|
-
@Prop({ type: Date, required: false })
|
|
178
|
-
reportedAt?: Date;
|
|
179
|
-
|
|
180
|
-
@Prop({ default: Date.now, required: false })
|
|
181
|
-
createdAt?: Date;
|
|
182
|
-
|
|
183
|
-
@Prop({ default: Date.now, required: false })
|
|
184
|
-
updatedAt?: Date;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export const ContentCaptureProcessSchema = SchemaFactory.createForClass(ContentCaptureProcess);
|
|
188
|
-
|
|
189
|
-
ContentCaptureProcessSchema.index({ actionId: 1, runId: 1 }, { unique: true });
|
|
190
|
-
ContentCaptureProcessSchema.index({ status: 1 });
|
|
191
|
-
|
|
192
|
-
export const ContentCaptureProcessModel = MongooseModel(
|
|
193
|
-
'ContentCaptureProcess',
|
|
194
|
-
ContentCaptureProcessSchema,
|
|
195
|
-
);
|
|
@@ -1,49 +0,0 @@
|
|
|
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);
|