@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.
Files changed (148) hide show
  1. package/dist/index.d.ts +42 -42
  2. package/dist/schemas/action.schema.d.ts +9 -34
  3. package/dist/schemas/action.schema.js +81 -64
  4. package/dist/schemas/assignment.schema.d.ts +3 -28
  5. package/dist/schemas/assignment.schema.js +44 -44
  6. package/dist/schemas/benchmark.schema.d.ts +3 -28
  7. package/dist/schemas/benchmark.schema.js +11 -6
  8. package/dist/schemas/campaign.schema.d.ts +2 -27
  9. package/dist/schemas/campaign.schema.js +4 -4
  10. package/dist/schemas/client.schema.d.ts +18 -79
  11. package/dist/schemas/client.schema.js +73 -71
  12. package/dist/schemas/comment.schema.d.ts +5 -30
  13. package/dist/schemas/comment.schema.js +42 -37
  14. package/dist/schemas/commission.schema.d.ts +5 -30
  15. package/dist/schemas/commission.schema.js +10 -10
  16. package/dist/schemas/content-capture-process.schema.d.ts +6 -31
  17. package/dist/schemas/content-capture-process.schema.js +24 -17
  18. package/dist/schemas/content-draft.schema.d.ts +2 -27
  19. package/dist/schemas/content-draft.schema.js +5 -5
  20. package/dist/schemas/content.schema.d.ts +6 -31
  21. package/dist/schemas/content.schema.js +84 -74
  22. package/dist/schemas/contract.schema.d.ts +3 -28
  23. package/dist/schemas/contract.schema.js +5 -5
  24. package/dist/schemas/creative.schema.d.ts +6 -31
  25. package/dist/schemas/creative.schema.js +22 -31
  26. package/dist/schemas/export-comments-job.schema.d.ts +2 -27
  27. package/dist/schemas/export-comments-job.schema.js +6 -6
  28. package/dist/schemas/group.schema.d.ts +1 -26
  29. package/dist/schemas/group.schema.js +5 -5
  30. package/dist/schemas/influencer.schema.d.ts +6 -31
  31. package/dist/schemas/influencer.schema.js +16 -18
  32. package/dist/schemas/invoice.schema.d.ts +4 -29
  33. package/dist/schemas/invoice.schema.js +42 -32
  34. package/dist/schemas/job.schema.d.ts +2 -27
  35. package/dist/schemas/job.schema.js +14 -14
  36. package/dist/schemas/lead.schema.d.ts +1 -26
  37. package/dist/schemas/lead.schema.js +67 -64
  38. package/dist/schemas/log.schema.d.ts +1 -26
  39. package/dist/schemas/log.schema.js +24 -24
  40. package/dist/schemas/note.schema.d.ts +1 -26
  41. package/dist/schemas/note.schema.js +9 -9
  42. package/dist/schemas/notifications.schema.d.ts +1 -26
  43. package/dist/schemas/notifications.schema.js +8 -8
  44. package/dist/schemas/organization.schema.d.ts +1 -26
  45. package/dist/schemas/organization.schema.js +4 -4
  46. package/dist/schemas/party.schema.d.ts +1 -26
  47. package/dist/schemas/party.schema.js +11 -11
  48. package/dist/schemas/payment.schema.d.ts +10 -35
  49. package/dist/schemas/payment.schema.js +63 -54
  50. package/dist/schemas/profile.schema.d.ts +3 -28
  51. package/dist/schemas/profile.schema.js +6 -6
  52. package/dist/schemas/project.schema.d.ts +4 -29
  53. package/dist/schemas/project.schema.js +13 -13
  54. package/dist/schemas/prospect.schema.d.ts +3 -28
  55. package/dist/schemas/prospect.schema.js +9 -9
  56. package/dist/schemas/recruitment.schema.d.ts +5 -30
  57. package/dist/schemas/recruitment.schema.js +36 -36
  58. package/dist/schemas/responsible.schema.d.ts +0 -26
  59. package/dist/schemas/responsible.schema.js +6 -6
  60. package/dist/schemas/sale.schema.d.ts +16 -41
  61. package/dist/schemas/sale.schema.js +43 -51
  62. package/dist/schemas/script.schema.d.ts +6 -31
  63. package/dist/schemas/script.schema.js +21 -30
  64. package/dist/schemas/snapshot.schema.d.ts +3 -28
  65. package/dist/schemas/snapshot.schema.js +6 -6
  66. package/dist/schemas/store-visit.schema.d.ts +2 -27
  67. package/dist/schemas/store-visit.schema.js +21 -17
  68. package/dist/schemas/store.schema.d.ts +3 -28
  69. package/dist/schemas/store.schema.js +8 -8
  70. package/dist/schemas/supplier.schema.d.ts +2 -27
  71. package/dist/schemas/supplier.schema.js +3 -3
  72. package/dist/schemas/tag.schema.d.ts +1 -26
  73. package/dist/schemas/tag.schema.js +5 -5
  74. package/dist/schemas/task.schema.d.ts +9 -34
  75. package/dist/schemas/task.schema.js +67 -67
  76. package/dist/schemas/token.schema.d.ts +1 -26
  77. package/dist/schemas/token.schema.js +3 -3
  78. package/dist/schemas/trigger.schema.d.ts +2 -27
  79. package/dist/schemas/trigger.schema.js +5 -5
  80. package/dist/schemas/user.schema.d.ts +2 -27
  81. package/dist/schemas/user.schema.js +7 -7
  82. package/dist/schemas/webhook.schema.d.ts +1 -26
  83. package/dist/schemas/webhook.schema.js +10 -10
  84. package/dist/utils/merge-metrics-breakdown.util.d.ts +1 -1
  85. package/dist/utils/merge-metrics-breakdown.util.js +7 -2
  86. package/dist/utils/normalize-content-link.util.js +7 -7
  87. package/package.json +23 -13
  88. package/.eslintrc.json +0 -28
  89. package/.prettierrc +0 -4
  90. package/dist/schemas/profile-followers-snapshot.schema.d.ts +0 -67
  91. package/dist/schemas/profile-followers-snapshot.schema.js +0 -65
  92. package/dist/schemas/schedule.schema.d.ts +0 -73
  93. package/dist/schemas/schedule.schema.js +0 -116
  94. package/dist/utils/cost-per-impact.util.d.ts +0 -37
  95. package/dist/utils/cost-per-impact.util.js +0 -72
  96. package/dist/utils/influencer-contract.util.d.ts +0 -32
  97. package/dist/utils/influencer-contract.util.js +0 -77
  98. package/docs/code-review.md +0 -27
  99. package/docs/constitution.md +0 -75
  100. package/docs/specs/GD-692.md +0 -112
  101. package/docs/specs/GD-761.md +0 -94
  102. package/index.d.ts +0 -3
  103. package/src/index.ts +0 -42
  104. package/src/schemas/action.schema.ts +0 -328
  105. package/src/schemas/assignment.schema.ts +0 -154
  106. package/src/schemas/benchmark.schema.ts +0 -39
  107. package/src/schemas/campaign.schema.ts +0 -38
  108. package/src/schemas/client.schema.ts +0 -319
  109. package/src/schemas/comment.schema.ts +0 -216
  110. package/src/schemas/commission.schema.ts +0 -108
  111. package/src/schemas/content-capture-process.schema.ts +0 -195
  112. package/src/schemas/content-draft.schema.ts +0 -49
  113. package/src/schemas/content.schema.ts +0 -688
  114. package/src/schemas/contract.schema.ts +0 -44
  115. package/src/schemas/creative.schema.ts +0 -256
  116. package/src/schemas/export-comments-job.schema.ts +0 -59
  117. package/src/schemas/group.schema.ts +0 -23
  118. package/src/schemas/influencer.schema.ts +0 -184
  119. package/src/schemas/invoice.schema.ts +0 -164
  120. package/src/schemas/job.schema.ts +0 -111
  121. package/src/schemas/lead.schema.ts +0 -372
  122. package/src/schemas/log.schema.ts +0 -91
  123. package/src/schemas/note.schema.ts +0 -34
  124. package/src/schemas/notifications.schema.ts +0 -61
  125. package/src/schemas/organization.schema.ts +0 -29
  126. package/src/schemas/party.schema.ts +0 -65
  127. package/src/schemas/payment.schema.ts +0 -275
  128. package/src/schemas/profile.schema.ts +0 -77
  129. package/src/schemas/project.schema.ts +0 -116
  130. package/src/schemas/prospect.schema.ts +0 -62
  131. package/src/schemas/recruitment.schema.ts +0 -277
  132. package/src/schemas/responsible.schema.ts +0 -27
  133. package/src/schemas/sale.schema.ts +0 -297
  134. package/src/schemas/script.schema.ts +0 -235
  135. package/src/schemas/snapshot.schema.ts +0 -55
  136. package/src/schemas/store-visit.schema.ts +0 -68
  137. package/src/schemas/store.schema.ts +0 -52
  138. package/src/schemas/supplier.schema.ts +0 -12
  139. package/src/schemas/tag.schema.ts +0 -26
  140. package/src/schemas/task.schema.ts +0 -205
  141. package/src/schemas/token.schema.ts +0 -42
  142. package/src/schemas/trigger.schema.ts +0 -48
  143. package/src/schemas/user.schema.ts +0 -59
  144. package/src/schemas/webhook.schema.ts +0 -81
  145. package/src/utils/merge-metrics-breakdown.util.ts +0 -51
  146. package/src/utils/normalize-content-link.util.ts +0 -31
  147. package/tsconfig.build.json +0 -5
  148. package/tsconfig.json +0 -29
@@ -1,116 +0,0 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { HydratedDocument, model as MongooseModel } from 'mongoose';
3
-
4
- export type ProjectDocument = HydratedDocument<Project>;
5
-
6
- @Schema({ _id: false })
7
- export class FormatItem {
8
- @Prop({ required: true, enum: ['reel', 'carousel', 'image', 'story', 'video'] })
9
- format: 'reel' | 'carousel' | 'image' | 'story' | 'video';
10
-
11
- @Prop({ required: true, type: Number })
12
- qty: number;
13
-
14
- @Prop({ required: true, type: Number })
15
- value: number;
16
-
17
- @Prop({ required: true, type: Number })
18
- impressionCount: number;
19
-
20
- @Prop({ required: true, type: Number })
21
- reachCount: number;
22
-
23
- @Prop({ required: true, type: Number })
24
- engagementRate: number;
25
-
26
- @Prop({ required: true, type: Number })
27
- engagementCount: number;
28
- }
29
-
30
- export const FormatItemSchema = SchemaFactory.createForClass(FormatItem);
31
-
32
- @Schema({ _id: false })
33
- export class ProjectProfile {
34
- @Prop({ required: true })
35
- username: string;
36
-
37
- @Prop({ required: true, type: Number })
38
- followers: number;
39
-
40
- @Prop({ required: true, enum: ['instagram', 'tiktok', 'youtube'] })
41
- socialnetwork: 'instagram' | 'tiktok' | 'youtube';
42
-
43
- @Prop({ required: true, type: Number })
44
- quantity: number;
45
-
46
- @Prop({ required: true, type: Number })
47
- imageUsageRight: number;
48
-
49
- @Prop({ required: true, type: Number })
50
- boostRight: number;
51
-
52
- @Prop({ type: [FormatItemSchema], default: [] })
53
- formats: FormatItem[];
54
- }
55
-
56
- export const ProjectProfileSchema = SchemaFactory.createForClass(ProjectProfile);
57
-
58
- @Schema({ _id: false })
59
- export class ProjectProductionCost {
60
- @Prop({ required: true })
61
- category: string;
62
-
63
- @Prop({ required: true })
64
- description: string;
65
-
66
- @Prop({ required: true, type: Number })
67
- value: number;
68
-
69
- @Prop({ required: false })
70
- link: string;
71
-
72
- @Prop({ required: false })
73
- expectedDate: string;
74
- }
75
-
76
- export const ProjectProductionCostSchema = SchemaFactory.createForClass(ProjectProductionCost);
77
-
78
- export type ProjectPhase =
79
- | 'prospect'
80
- | 'pending'
81
- | 'planning'
82
- | 'inProgress'
83
- | 'inApproval'
84
- | 'done'
85
- | 'cold';
86
-
87
- @Schema({ timestamps: true })
88
- export class Project {
89
- @Prop({ required: true })
90
- title: string;
91
-
92
- @Prop({ required: false })
93
- commissionPercentage: number;
94
-
95
- @Prop({ required: false })
96
- influencerCostType: string;
97
-
98
- @Prop({ required: false })
99
- otherCostType: string;
100
-
101
- @Prop({
102
- required: false,
103
- enum: ['prospect', 'pending', 'planning', 'inProgress', 'inApproval', 'done', 'cold'],
104
- default: 'prospect',
105
- })
106
- phase?: ProjectPhase;
107
-
108
- @Prop({ type: [ProjectProfileSchema], default: [] })
109
- profiles?: ProjectProfile[];
110
-
111
- @Prop({ type: [ProjectProductionCostSchema], default: [] })
112
- productionCosts?: ProjectProductionCost[];
113
- }
114
-
115
- export const ProjectSchema = SchemaFactory.createForClass(Project);
116
- export const ProjectModel = MongooseModel('Project', ProjectSchema);
@@ -1,62 +0,0 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { ApiProperty } from '@nestjs/swagger';
3
- import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
4
- import { Responsible, ResponsibleSchema } from './responsible.schema';
5
-
6
- export type ProspectDocument = HydratedDocument<Prospect>;
7
-
8
- @Schema({ _id: false })
9
- export class ProspectNote {
10
- @Prop({ required: true })
11
- text: string;
12
-
13
- @Prop({ required: true })
14
- author: string;
15
-
16
- @Prop({ required: true, default: Date.now })
17
- createdAt: Date;
18
- }
19
-
20
- export const ProspectNoteSchema = SchemaFactory.createForClass(ProspectNote);
21
-
22
- @Schema({ timestamps: true })
23
- export class Prospect {
24
- @ApiProperty({ example: '64bfc3a78d3f1e2a12345678' })
25
- @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
26
- _id?: Types.ObjectId;
27
-
28
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Organization', required: true })
29
- organization: Types.ObjectId;
30
-
31
- @Prop({ required: true })
32
- name: string;
33
-
34
- @Prop({ required: false })
35
- value?: number;
36
-
37
- @Prop({ type: String, enum: ['open', 'won', 'lost'], required: true })
38
- status: 'open' | 'won' | 'lost';
39
-
40
- @Prop({ required: true, default: false })
41
- hot: boolean;
42
-
43
- @ApiProperty({ type: () => [Responsible] })
44
- @Prop({ type: [ResponsibleSchema], required: true })
45
- responsible: Responsible[];
46
-
47
- @Prop({ required: true })
48
- lastContactAt: Date;
49
-
50
- @Prop({ required: false })
51
- lastReminderAt?: Date;
52
-
53
- @Prop({ type: [ProspectNoteSchema], default: [] })
54
- notes: ProspectNote[];
55
- }
56
-
57
- export const ProspectSchema = SchemaFactory.createForClass(Prospect);
58
-
59
- ProspectSchema.index({ organization: 1, status: 1, lastContactAt: 1 });
60
- ProspectSchema.index({ 'responsible.email': 1 });
61
-
62
- export const ProspectModel = MongooseModel('Prospect', ProspectSchema);
@@ -1,277 +0,0 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { HydratedDocument, Schema as MongooseSchema, Types, model as MongooseModel } from 'mongoose';
3
- import { Action } from './action.schema';
4
- import type { Influencer } from './influencer.schema';
5
- import { Profile } from './profile.schema';
6
-
7
- export type RecruitmentDocument = HydratedDocument<Recruitment>;
8
-
9
- @Schema({ _id: false })
10
- export class Delivery {
11
- @Prop({ required: false })
12
- reels?: number;
13
-
14
- @Prop({ required: false })
15
- images?: number;
16
-
17
- @Prop({ required: false })
18
- carousels?: number;
19
-
20
- @Prop({ required: false })
21
- stories?: number;
22
-
23
- @Prop({ required: false })
24
- tiktok?: number;
25
-
26
- @Prop({ required: false })
27
- youtube?: number;
28
-
29
- @Prop({ required: false })
30
- linkedin?: number;
31
-
32
- @Prop({ required: false })
33
- pinterest?: number;
34
-
35
- @Prop({ required: false })
36
- dayAllocation?: number;
37
- }
38
-
39
- export const DeliverySchema = SchemaFactory.createForClass(Delivery);
40
-
41
- @Schema({ _id: false })
42
- export class Right {
43
- @Prop()
44
- granted: boolean;
45
-
46
- @Prop()
47
- period: string;
48
- }
49
-
50
- export const RightSchema = SchemaFactory.createForClass(Right);
51
- @Schema({ _id: false })
52
- export class Rights {
53
- @Prop({ type: RightSchema })
54
- repost: Right;
55
-
56
- @Prop({ type: RightSchema })
57
- boost: Right;
58
-
59
- @Prop({ type: RightSchema })
60
- imageUsage: Right;
61
- }
62
-
63
- export const RightsSchema = SchemaFactory.createForClass(Rights);
64
-
65
- @Schema({ _id: false })
66
- export class InstallmentInfo {
67
- @Prop()
68
- number: number;
69
-
70
- @Prop()
71
- value: number;
72
- }
73
-
74
- export const InstallmentInfoSchema =
75
- SchemaFactory.createForClass(InstallmentInfo);
76
-
77
- @Schema({ _id: false })
78
- class Payment {
79
- @Prop()
80
- hasPayment: boolean;
81
-
82
- @Prop()
83
- hasInstallment: boolean;
84
-
85
- @Prop()
86
- value: number;
87
-
88
- @Prop([{ type: InstallmentInfoSchema }])
89
- installmentInfo: InstallmentInfo[];
90
-
91
- @Prop()
92
- deadline: number;
93
- }
94
-
95
- const PaymentSchema = SchemaFactory.createForClass(Payment);
96
-
97
- @Schema({ _id: false })
98
- export class Exchange {
99
- @Prop()
100
- hasExchange: boolean;
101
-
102
- @Prop()
103
- description: string;
104
- }
105
-
106
- export const ExchangeSchema = SchemaFactory.createForClass(Exchange);
107
-
108
- @Schema({ _id: false })
109
- export class Collab {
110
- @Prop()
111
- hasCollab: boolean;
112
-
113
- @Prop()
114
- description: string;
115
- }
116
-
117
- export const CollabSchema = SchemaFactory.createForClass(Collab);
118
-
119
- @Schema({ _id: false })
120
- export class OptIn {
121
- @Prop()
122
- hasOptIn: boolean;
123
- }
124
-
125
- export const OptInSchema = SchemaFactory.createForClass(OptIn);
126
-
127
-
128
- @Schema({ _id: false })
129
- export class ScopeEstimateMetrics {
130
- @Prop() impressionCount: number;
131
- @Prop() reachCount: number;
132
- @Prop() engagementCount: number;
133
- @Prop() engagementRate: number;
134
- }
135
-
136
- export const ScopeEstimateMetricsSchema = SchemaFactory.createForClass(ScopeEstimateMetrics);
137
-
138
- @Schema({ _id: false })
139
- export class ScopeEstimateBreakdown {
140
- @Prop() formatId: string;
141
- @Prop() label: string;
142
- @Prop() platform: string;
143
- @Prop() quantity: number;
144
- @Prop({ type: ScopeEstimateMetricsSchema }) estimates: ScopeEstimateMetrics;
145
- }
146
-
147
- export const ScopeEstimateBreakdownSchema = SchemaFactory.createForClass(ScopeEstimateBreakdown);
148
-
149
- @Schema({ _id: false })
150
- export class ScopeEstimates {
151
- @Prop() impressionCount: number;
152
- @Prop() reachCount: number;
153
- @Prop() engagementCount: number;
154
- @Prop() engagementRate: number;
155
- @Prop({ type: ScopeEstimateMetricsSchema, required: false }) perPost?: ScopeEstimateMetrics | null;
156
- @Prop({ type: [ScopeEstimateBreakdownSchema] }) breakdown: ScopeEstimateBreakdown[];
157
- }
158
-
159
- export const ScopeEstimatesSchema = SchemaFactory.createForClass(ScopeEstimates);
160
-
161
- @Schema({ _id: false })
162
- export class Scope {
163
- @Prop({ type: DeliverySchema })
164
- delivery: Delivery;
165
-
166
- @Prop({ type: RightsSchema, required: false })
167
- rights?: Rights;
168
-
169
- @Prop({ type: PaymentSchema, required: false })
170
- payment?: Payment;
171
-
172
- @Prop({ type: PaymentSchema, required: false })
173
- advisorPayment?: Payment;
174
-
175
- @Prop({ type: CollabSchema, required: false })
176
- collab?: Collab;
177
-
178
- @Prop({ type: OptInSchema, required: false })
179
- optIn?: OptIn;
180
-
181
- @Prop({ type: ExchangeSchema, required: false })
182
- exchange?: Exchange;
183
-
184
- @Prop({ required: false })
185
- exclusivity?: boolean;
186
-
187
- /**
188
- * Squad do Influenciador nesta Ação: chave de `Client.squads` (ex.:
189
- * `team_galaxy`). Nasce com o Squad do Contrato e é editável no escopo; a aba
190
- * Squads do Hub e os filtros de Squad da Samsung usam este valor. Ver GD-770.
191
- */
192
- @Prop({ type: String, required: false, default: null })
193
- squad?: string | null;
194
-
195
- @Prop({ type: ScopeEstimatesSchema, required: false })
196
- estimates?: ScopeEstimates;
197
- }
198
-
199
- export const ScopeSchema = SchemaFactory.createForClass(Scope);
200
-
201
- // Perfil participante do recrutamento — cada um tem a sua collaboration na
202
- // Primetag (primetagId = collaboration_id), criada quando o recrutamento vira
203
- // 'recruited'.
204
- @Schema({ _id: false })
205
- export class RecruitmentProfile {
206
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Profile', required: true })
207
- profile: Types.ObjectId | Profile;
208
-
209
- @Prop({ type: String, required: false })
210
- primetagId?: string;
211
- }
212
-
213
- export const RecruitmentProfileSchema = SchemaFactory.createForClass(RecruitmentProfile);
214
-
215
- // 1 por (action, influencer): o scope (entregas + pagamento) é do influenciador
216
- // na campanha inteira, dividido entre todos os perfis de `profiles`.
217
- @Schema({ timestamps: true })
218
- export class Recruitment {
219
- @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
220
- _id?: Types.ObjectId;
221
-
222
- @Prop()
223
- username: string;
224
-
225
- @Prop()
226
- picture: string;
227
-
228
- @Prop({
229
- type: String,
230
- default: 'selected',
231
- enum: ['selected', 'inContact', 'inApproval', 'recruited', 'removed'],
232
- })
233
- status: 'selected' | 'inContact' | 'inApproval' | 'recruited' | 'removed';
234
-
235
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Action' })
236
- action: Types.ObjectId | Action;
237
-
238
- @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Influencer', required: true })
239
- influencer: Types.ObjectId | Influencer;
240
-
241
- @Prop({ type: [RecruitmentProfileSchema], default: [] })
242
- profiles: RecruitmentProfile[];
243
-
244
- @Prop({ type: ScopeSchema })
245
- scope?: Scope;
246
-
247
- @Prop({ default: Date.now, required: false })
248
- createdAt?: Date;
249
-
250
- @Prop({ default: Date.now, required: false })
251
- updatedAt?: Date;
252
-
253
- // Toggle: paga via contrato de embaixador do influenciador (valor fixo
254
- // recorrente, ver Influencer.contracts) em vez de scope.payment/advisorPayment.
255
- // Só pode haver 1 contrato ativo por (influencer, client) ao mesmo tempo,
256
- // então não precisa referenciar um contrato específico por _id.
257
- @Prop({ type: Boolean, required: false, default: false })
258
- useAmbassadorContract?: boolean;
259
- }
260
-
261
- export const RecruitmentSchema = SchemaFactory.createForClass(Recruitment);
262
-
263
- RecruitmentSchema.index({ action: 1, status: 1 });
264
- RecruitmentSchema.index({ action: 1 });
265
- // Parcial: recrutamentos legados cujo perfil não tem influenciador ficaram no
266
- // formato antigo (sem `influencer`) e não entram na unicidade.
267
- RecruitmentSchema.index(
268
- { action: 1, influencer: 1 },
269
- { unique: true, partialFilterExpression: { influencer: { $type: 'objectId' } } },
270
- );
271
- RecruitmentSchema.index({ 'profiles.profile': 1, status: 1 });
272
- RecruitmentSchema.index({ influencer: 1, status: 1, 'scope.exclusivity': 1 });
273
- RecruitmentSchema.index({ action: 1, 'profiles.primetagId': 1 });
274
- RecruitmentSchema.index({ username: 1, _id: 1 });
275
-
276
- export const RecruitmentModel = MongooseModel('Recruitment', RecruitmentSchema);
277
-
@@ -1,27 +0,0 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { ApiProperty } from '@nestjs/swagger';
3
-
4
- /**
5
- * Formato único de responsável em todas as entidades (`responsible`).
6
- * `username` vem de `User.username` (api-admin).
7
- */
8
- @Schema({ _id: false })
9
- export class Responsible {
10
- @ApiProperty({ example: 'Maria Oliveira' })
11
- @Prop({ type: String, required: true })
12
- name: string;
13
-
14
- @ApiProperty({ example: 'maria@empresa.com' })
15
- @Prop({ type: String, required: true })
16
- email: string;
17
-
18
- @ApiProperty({ example: 'maria.oliveira' })
19
- @Prop({ type: String, required: true })
20
- username: string;
21
-
22
- @ApiProperty({ example: 'service', required: false })
23
- @Prop({ type: String, required: false })
24
- team?: string;
25
- }
26
-
27
- export const ResponsibleSchema = SchemaFactory.createForClass(Responsible);