@grapadigital/shared-schemas 1.0.217 → 1.0.219

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.
@@ -9,6 +9,7 @@ import { Profile } from './profile.schema';
9
9
  import { Client } from './client.schema';
10
10
  import { Influencer } from './influencer.schema';
11
11
  import { Note } from './note.schema';
12
+ import { Responsible, ResponsibleSchema } from './responsible.schema';
12
13
 
13
14
  export type SaleDocument = HydratedDocument<Sale>;
14
15
 
@@ -38,21 +39,6 @@ export class Proposal {
38
39
  required: false,
39
40
  })
40
41
  influencer?: Types.ObjectId | Influencer;
41
-
42
- @Prop({
43
- _id: false,
44
- required: true,
45
- type: [{
46
- team: String,
47
- name: String,
48
- email: String,
49
- }],
50
- })
51
- responsible: {
52
- team: string;
53
- name: string;
54
- email: string;
55
- }[];
56
42
  }
57
43
 
58
44
  @Schema({ _id: false })
@@ -168,39 +154,23 @@ export class Inbox {
168
154
  @Prop({ required: true }) receivedAt: Date;
169
155
  }
170
156
 
157
+ /**
158
+ * Responsáveis da venda por papel: comercial (proposta), curadoria e planejamento.
159
+ */
171
160
  @Schema({ _id: false })
172
161
  export class SaleResponsible {
173
- @Prop({
174
- _id: false,
175
- required: false,
176
- type: [{
177
- team: String,
178
- name: String,
179
- email: String,
180
- }],
181
- })
182
- curation?: {
183
- team: string;
184
- name: string;
185
- email: string;
186
- }[];
162
+ @Prop({ type: [ResponsibleSchema], required: false, default: [] })
163
+ proposal?: Responsible[];
187
164
 
188
- @Prop({
189
- _id: false,
190
- required: false,
191
- type: [{
192
- team: String,
193
- name: String,
194
- email: String,
195
- }],
196
- })
197
- planning?: {
198
- team: string;
199
- name: string;
200
- email: string;
201
- }[];
165
+ @Prop({ type: [ResponsibleSchema], required: false, default: [] })
166
+ curation?: Responsible[];
167
+
168
+ @Prop({ type: [ResponsibleSchema], required: false, default: [] })
169
+ planning?: Responsible[];
202
170
  }
203
171
 
172
+ export const SaleResponsibleSchema = SchemaFactory.createForClass(SaleResponsible);
173
+
204
174
  @Schema({ _id: false })
205
175
  export class SaleLinks {
206
176
  @Prop({ required: false })
@@ -306,7 +276,7 @@ export class Sale {
306
276
  @Prop({ type: String, required: false })
307
277
  omieId?: string;
308
278
 
309
- @Prop({ type: SaleResponsible, required: false })
279
+ @Prop({ type: SaleResponsibleSchema, required: false })
310
280
  responsible?: SaleResponsible;
311
281
 
312
282
  @Prop({ type: SaleLinks, required: false })
@@ -321,7 +291,7 @@ SaleSchema.index({ organization: 1, 'formalization.brand': 1 });
321
291
  SaleSchema.index({ organization: 1, 'formalization.agency': 1 });
322
292
  SaleSchema.index({ organization: 1, closedAt: 1, phase: 1 });
323
293
  SaleSchema.index({ 'proposal.influencer': 1 });
324
- SaleSchema.index({ 'proposal.responsible.email': 1 });
294
+ SaleSchema.index({ 'responsible.proposal.email': 1 });
325
295
  SaleSchema.index({ tags: 1 });
326
296
 
327
297
  export const SaleModel = MongooseModel('Sale', SaleSchema);