@grapadigital/shared-schemas 1.0.214 → 1.0.215

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
@@ -1,4 +1,5 @@
1
1
  export * from './schemas/action.schema';
2
+ export * from './schemas/prospect.schema';
2
3
  export * from './schemas/client.schema';
3
4
  export * from './schemas/content.schema';
4
5
  export * from './schemas/comment.schema';
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.NoteMentionSchema = exports.NoteMention = exports.NoteSchema = exports.Note = void 0;
18
18
  __exportStar(require("./schemas/action.schema"), exports);
19
+ __exportStar(require("./schemas/prospect.schema"), exports);
19
20
  __exportStar(require("./schemas/client.schema"), exports);
20
21
  __exportStar(require("./schemas/content.schema"), exports);
21
22
  __exportStar(require("./schemas/comment.schema"), exports);
@@ -45,19 +45,21 @@ export declare const ResponsibleSchema: MongooseSchema<Responsible, import("mong
45
45
  } & {
46
46
  __v: number;
47
47
  }>;
48
- export declare class Responsibles {
49
- service: Responsible;
50
- comercial?: Responsible;
48
+ /**
49
+ * @deprecated Use `Responsible` or `Responsible[]` on Action.responsible
50
+ */
51
+ export declare class ActionResponsible extends Responsible {
51
52
  }
52
- export declare const ResponsiblesSchema: MongooseSchema<Responsibles, import("mongoose").Model<Responsibles, any, any, any, import("mongoose").Document<unknown, any, Responsibles, any, {}> & Responsibles & {
53
+ export declare const ActionResponsibleSchema: MongooseSchema<ActionResponsible, import("mongoose").Model<ActionResponsible, any, any, any, import("mongoose").Document<unknown, any, ActionResponsible, any, {}> & ActionResponsible & {
53
54
  _id: Types.ObjectId;
54
55
  } & {
55
56
  __v: number;
56
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Responsibles, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Responsibles>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Responsibles> & {
57
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ActionResponsible, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ActionResponsible>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ActionResponsible> & {
57
58
  _id: Types.ObjectId;
58
59
  } & {
59
60
  __v: number;
60
61
  }>;
62
+ export { ActionResponsible as Responsibles, ActionResponsibleSchema as ResponsiblesSchema };
61
63
  export declare const ACTION_BUSINESS_UNIT_VALUES: readonly ["service", "comercial", "squad_a", "squad_b"];
62
64
  export type ActionBusinessUnit = (typeof ACTION_BUSINESS_UNIT_VALUES)[number];
63
65
  export declare class ActionPromptConfig {
@@ -103,7 +105,7 @@ export declare class Action {
103
105
  project?: string;
104
106
  sale: Types.ObjectId | Sale;
105
107
  organization: Types.ObjectId;
106
- responsibles: Responsibles;
108
+ responsible: Responsible[];
107
109
  brandUsername?: string;
108
110
  BILink?: string;
109
111
  BISheets?: string;
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ActionModel = exports.ActionSchema = exports.Action = exports.ACTION_STATUS_VALUES = exports.ActionPromptConfigSchema = exports.ActionPromptConfig = exports.ACTION_BUSINESS_UNIT_VALUES = exports.ResponsiblesSchema = exports.Responsibles = exports.ResponsibleSchema = exports.Responsible = void 0;
12
+ exports.ActionModel = exports.ActionSchema = exports.Action = exports.ACTION_STATUS_VALUES = exports.ActionPromptConfigSchema = exports.ActionPromptConfig = exports.ACTION_BUSINESS_UNIT_VALUES = exports.ResponsiblesSchema = exports.Responsibles = exports.ActionResponsibleSchema = exports.ActionResponsible = exports.ResponsibleSchema = exports.Responsible = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const swagger_1 = require("@nestjs/swagger");
15
15
  const mongoose_2 = require("mongoose");
@@ -41,23 +41,15 @@ Responsible = __decorate([
41
41
  ], Responsible);
42
42
  exports.Responsible = Responsible;
43
43
  exports.ResponsibleSchema = mongoose_1.SchemaFactory.createForClass(Responsible);
44
- let Responsibles = class Responsibles {
45
- };
46
- __decorate([
47
- (0, swagger_1.ApiProperty)({ type: () => Responsible }),
48
- (0, mongoose_1.Prop)({ type: exports.ResponsibleSchema }),
49
- __metadata("design:type", Responsible)
50
- ], Responsibles.prototype, "service", void 0);
51
- __decorate([
52
- (0, swagger_1.ApiProperty)({ type: () => Responsible, required: false }),
53
- (0, mongoose_1.Prop)({ type: exports.ResponsibleSchema, required: false }),
54
- __metadata("design:type", Responsible)
55
- ], Responsibles.prototype, "comercial", void 0);
56
- Responsibles = __decorate([
57
- (0, mongoose_1.Schema)({ _id: false })
58
- ], Responsibles);
59
- exports.Responsibles = Responsibles;
60
- exports.ResponsiblesSchema = mongoose_1.SchemaFactory.createForClass(Responsibles);
44
+ /**
45
+ * @deprecated Use `Responsible` or `Responsible[]` on Action.responsible
46
+ */
47
+ class ActionResponsible extends Responsible {
48
+ }
49
+ exports.ActionResponsible = ActionResponsible;
50
+ exports.Responsibles = ActionResponsible;
51
+ exports.ActionResponsibleSchema = mongoose_1.SchemaFactory.createForClass(ActionResponsible);
52
+ exports.ResponsiblesSchema = exports.ActionResponsibleSchema;
61
53
  exports.ACTION_BUSINESS_UNIT_VALUES = [
62
54
  'service',
63
55
  'comercial',
@@ -242,10 +234,10 @@ __decorate([
242
234
  __metadata("design:type", mongoose_2.Types.ObjectId)
243
235
  ], Action.prototype, "organization", void 0);
244
236
  __decorate([
245
- (0, swagger_1.ApiProperty)({ type: () => Responsibles }),
246
- (0, mongoose_1.Prop)({ type: exports.ResponsiblesSchema, required: true }),
247
- __metadata("design:type", Responsibles)
248
- ], Action.prototype, "responsibles", void 0);
237
+ (0, swagger_1.ApiProperty)({ type: () => [Responsible] }),
238
+ (0, mongoose_1.Prop)({ type: [exports.ResponsibleSchema], required: true }),
239
+ __metadata("design:type", Array)
240
+ ], Action.prototype, "responsible", void 0);
249
241
  __decorate([
250
242
  (0, swagger_1.ApiProperty)({ example: '@brand', required: false }),
251
243
  (0, mongoose_1.Prop)({ type: String, required: false }),
@@ -345,6 +337,6 @@ exports.ActionSchema.index({ organization: 1, client: 1 });
345
337
  exports.ActionSchema.index({ organization: 1, sale: 1 });
346
338
  exports.ActionSchema.index({ sale: 1 });
347
339
  exports.ActionSchema.index({ organization: 1, startDate: 1, endDate: 1 });
348
- exports.ActionSchema.index({ 'responsibles.service.email': 1 });
340
+ exports.ActionSchema.index({ 'responsible.email': 1 });
349
341
  exports.ActionSchema.index({ campaign: 1 });
350
342
  exports.ActionModel = (0, mongoose_2.model)('Action', exports.ActionSchema);
@@ -95,16 +95,16 @@ export declare const NicheItemSchema: MongooseSchema<NicheItem, import("mongoose
95
95
  } & {
96
96
  __v: number;
97
97
  }>;
98
- export declare class Responsable {
98
+ export declare class ClientResponsible {
99
99
  name: string;
100
100
  team: string;
101
101
  email: string;
102
102
  }
103
- export declare const ResponsableSchema: MongooseSchema<Responsable, import("mongoose").Model<Responsable, any, any, any, import("mongoose").Document<unknown, any, Responsable, any, {}> & Responsable & {
103
+ export declare const ClientResponsibleSchema: MongooseSchema<ClientResponsible, import("mongoose").Model<ClientResponsible, any, any, any, import("mongoose").Document<unknown, any, ClientResponsible, any, {}> & ClientResponsible & {
104
104
  _id: Types.ObjectId;
105
105
  } & {
106
106
  __v: number;
107
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Responsable, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Responsable>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Responsable> & {
107
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ClientResponsible, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ClientResponsible>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ClientResponsible> & {
108
108
  _id: Types.ObjectId;
109
109
  } & {
110
110
  __v: number;
@@ -113,6 +113,7 @@ export declare class Client extends Party {
113
113
  clusters: Cluster[];
114
114
  companies: Company[];
115
115
  type: string;
116
+ engagement?: 'fixed' | 'punctual';
116
117
  categories: string[];
117
118
  niches?: NicheItem[];
118
119
  hasAgencyCommission: boolean;
@@ -139,8 +140,8 @@ export declare class Client extends Party {
139
140
  * ou `Action.hasGenIAAnalysis`.
140
141
  */
141
142
  organization?: Types.ObjectId;
142
- reportResponsable?: Responsable;
143
- brandResponsable?: string;
143
+ reportResponsible?: ClientResponsible;
144
+ brandResponsible?: string;
144
145
  profiles?: Types.ObjectId[] | Profile[];
145
146
  }
146
147
  export declare const ClientSchema: MongooseSchema<Client, import("mongoose").Model<Client, any, any, any, import("mongoose").Document<unknown, any, Client, any, {}> & Client & Required<{
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ClientModel = exports.ClientSchema = exports.Client = exports.ResponsableSchema = exports.Responsable = exports.NicheItemSchema = exports.NicheItem = exports.AgencyCommissionPeriodSchema = exports.AgencyCommissionPeriod = exports.CommissionRangeSchema = exports.CommissionRange = exports.CompanySchema = exports.Company = exports.ClusterSchema = exports.Cluster = void 0;
12
+ exports.ClientModel = exports.ClientSchema = exports.Client = exports.ClientResponsibleSchema = exports.ClientResponsible = exports.NicheItemSchema = exports.NicheItem = exports.AgencyCommissionPeriodSchema = exports.AgencyCommissionPeriod = exports.CommissionRangeSchema = exports.CommissionRange = exports.CompanySchema = exports.Company = exports.ClusterSchema = exports.Cluster = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const swagger_1 = require("@nestjs/swagger");
15
15
  const mongoose_2 = require("mongoose");
@@ -101,28 +101,28 @@ NicheItem = __decorate([
101
101
  ], NicheItem);
102
102
  exports.NicheItem = NicheItem;
103
103
  exports.NicheItemSchema = mongoose_1.SchemaFactory.createForClass(NicheItem);
104
- let Responsable = class Responsable {
104
+ let ClientResponsible = class ClientResponsible {
105
105
  };
106
106
  __decorate([
107
107
  (0, swagger_1.ApiProperty)({ example: 'Maria Oliveira' }),
108
108
  (0, mongoose_1.Prop)(),
109
109
  __metadata("design:type", String)
110
- ], Responsable.prototype, "name", void 0);
110
+ ], ClientResponsible.prototype, "name", void 0);
111
111
  __decorate([
112
112
  (0, swagger_1.ApiProperty)({ example: 'Comercial' }),
113
113
  (0, mongoose_1.Prop)(),
114
114
  __metadata("design:type", String)
115
- ], Responsable.prototype, "team", void 0);
115
+ ], ClientResponsible.prototype, "team", void 0);
116
116
  __decorate([
117
117
  (0, swagger_1.ApiProperty)({ example: 'maria@empresa.com' }),
118
118
  (0, mongoose_1.Prop)(),
119
119
  __metadata("design:type", String)
120
- ], Responsable.prototype, "email", void 0);
121
- Responsable = __decorate([
120
+ ], ClientResponsible.prototype, "email", void 0);
121
+ ClientResponsible = __decorate([
122
122
  (0, mongoose_1.Schema)({ _id: false })
123
- ], Responsable);
124
- exports.Responsable = Responsable;
125
- exports.ResponsableSchema = mongoose_1.SchemaFactory.createForClass(Responsable);
123
+ ], ClientResponsible);
124
+ exports.ClientResponsible = ClientResponsible;
125
+ exports.ClientResponsibleSchema = mongoose_1.SchemaFactory.createForClass(ClientResponsible);
126
126
  let Client = class Client extends party_schema_1.Party {
127
127
  };
128
128
  __decorate([
@@ -137,6 +137,10 @@ __decorate([
137
137
  (0, mongoose_1.Prop)({ type: String }),
138
138
  __metadata("design:type", String)
139
139
  ], Client.prototype, "type", void 0);
140
+ __decorate([
141
+ (0, mongoose_1.Prop)({ type: String, enum: ['fixed', 'punctual'], required: false }),
142
+ __metadata("design:type", String)
143
+ ], Client.prototype, "engagement", void 0);
140
144
  __decorate([
141
145
  (0, mongoose_1.Prop)({ type: [String], default: [] }),
142
146
  __metadata("design:type", Array)
@@ -170,13 +174,13 @@ __decorate([
170
174
  __metadata("design:type", mongoose_2.Types.ObjectId)
171
175
  ], Client.prototype, "organization", void 0);
172
176
  __decorate([
173
- (0, mongoose_1.Prop)({ type: exports.ResponsableSchema, required: false }),
174
- __metadata("design:type", Responsable)
175
- ], Client.prototype, "reportResponsable", void 0);
177
+ (0, mongoose_1.Prop)({ type: exports.ClientResponsibleSchema, required: false }),
178
+ __metadata("design:type", ClientResponsible)
179
+ ], Client.prototype, "reportResponsible", void 0);
176
180
  __decorate([
177
181
  (0, mongoose_1.Prop)({ type: String, required: false }),
178
182
  __metadata("design:type", String)
179
- ], Client.prototype, "brandResponsable", void 0);
183
+ ], Client.prototype, "brandResponsible", void 0);
180
184
  __decorate([
181
185
  (0, mongoose_1.Prop)([
182
186
  { type: mongoose_2.Schema.Types.ObjectId, ref: 'Profile', required: false },
@@ -108,25 +108,26 @@ export declare const ContentCaptureProcessResponsibleContactSchema: MongooseSche
108
108
  } & {
109
109
  __v: number;
110
110
  }>;
111
- export declare class ContentCaptureProcessResponsibles {
112
- service?: ContentCaptureProcessResponsibleContact;
111
+ export declare class ContentCaptureProcessResponsible {
112
+ service?: ContentCaptureProcessResponsibleContact[];
113
113
  }
114
- export declare const ContentCaptureProcessResponsiblesSchema: MongooseSchema<ContentCaptureProcessResponsibles, import("mongoose").Model<ContentCaptureProcessResponsibles, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessResponsibles, any, {}> & ContentCaptureProcessResponsibles & {
114
+ export declare const ContentCaptureProcessResponsibleSchema: MongooseSchema<ContentCaptureProcessResponsible, import("mongoose").Model<ContentCaptureProcessResponsible, any, any, any, import("mongoose").Document<unknown, any, ContentCaptureProcessResponsible, any, {}> & ContentCaptureProcessResponsible & {
115
115
  _id: Types.ObjectId;
116
116
  } & {
117
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> & {
118
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ContentCaptureProcessResponsible, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ContentCaptureProcessResponsible>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ContentCaptureProcessResponsible> & {
119
119
  _id: Types.ObjectId;
120
120
  } & {
121
121
  __v: number;
122
122
  }>;
123
+ export { ContentCaptureProcessResponsible as ContentCaptureProcessResponsibles, ContentCaptureProcessResponsibleSchema as ContentCaptureProcessResponsiblesSchema, };
123
124
  export declare class ContentCaptureProcess {
124
125
  _id?: Types.ObjectId;
125
126
  actionId: Types.ObjectId | Action;
126
127
  runId: string;
127
128
  actionTitle: string;
128
129
  primetagId?: string;
129
- responsibles?: ContentCaptureProcessResponsibles;
130
+ responsible?: ContentCaptureProcessResponsible;
130
131
  status: 'fetching' | 'awaiting_comments' | 'reported' | 'failed';
131
132
  publicationsFetched: number;
132
133
  contentsMapped: number;
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
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;
12
+ exports.ContentCaptureProcessModel = exports.ContentCaptureProcessSchema = exports.ContentCaptureProcess = exports.ContentCaptureProcessResponsiblesSchema = exports.ContentCaptureProcessResponsibles = exports.ContentCaptureProcessResponsibleSchema = exports.ContentCaptureProcessResponsible = exports.ContentCaptureProcessResponsibleContactSchema = exports.ContentCaptureProcessResponsibleContact = exports.ContentCaptureProcessItemSchema = exports.ContentCaptureProcessItem = exports.ContentCaptureProcessCommentCaptureStatusSchema = exports.ContentCaptureProcessCommentCaptureStatus = exports.ContentCaptureProcessInfluencerSchema = exports.ContentCaptureProcessInfluencer = exports.ContentCaptureProcessMetricsSchema = exports.ContentCaptureProcessMetrics = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
15
  let ContentCaptureProcessMetrics = class ContentCaptureProcessMetrics {
@@ -159,17 +159,19 @@ ContentCaptureProcessResponsibleContact = __decorate([
159
159
  ], ContentCaptureProcessResponsibleContact);
160
160
  exports.ContentCaptureProcessResponsibleContact = ContentCaptureProcessResponsibleContact;
161
161
  exports.ContentCaptureProcessResponsibleContactSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessResponsibleContact);
162
- let ContentCaptureProcessResponsibles = class ContentCaptureProcessResponsibles {
162
+ let ContentCaptureProcessResponsible = class ContentCaptureProcessResponsible {
163
163
  };
164
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([
165
+ (0, mongoose_1.Prop)({ type: [exports.ContentCaptureProcessResponsibleContactSchema], required: false }),
166
+ __metadata("design:type", Array)
167
+ ], ContentCaptureProcessResponsible.prototype, "service", void 0);
168
+ ContentCaptureProcessResponsible = __decorate([
169
169
  (0, mongoose_1.Schema)({ _id: false })
170
- ], ContentCaptureProcessResponsibles);
171
- exports.ContentCaptureProcessResponsibles = ContentCaptureProcessResponsibles;
172
- exports.ContentCaptureProcessResponsiblesSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessResponsibles);
170
+ ], ContentCaptureProcessResponsible);
171
+ exports.ContentCaptureProcessResponsible = ContentCaptureProcessResponsible;
172
+ exports.ContentCaptureProcessResponsibles = ContentCaptureProcessResponsible;
173
+ exports.ContentCaptureProcessResponsibleSchema = mongoose_1.SchemaFactory.createForClass(ContentCaptureProcessResponsible);
174
+ exports.ContentCaptureProcessResponsiblesSchema = exports.ContentCaptureProcessResponsibleSchema;
173
175
  let ContentCaptureProcess = class ContentCaptureProcess {
174
176
  };
175
177
  __decorate([
@@ -193,9 +195,9 @@ __decorate([
193
195
  __metadata("design:type", String)
194
196
  ], ContentCaptureProcess.prototype, "primetagId", void 0);
195
197
  __decorate([
196
- (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessResponsiblesSchema, required: false }),
197
- __metadata("design:type", ContentCaptureProcessResponsibles)
198
- ], ContentCaptureProcess.prototype, "responsibles", void 0);
198
+ (0, mongoose_1.Prop)({ type: exports.ContentCaptureProcessResponsibleSchema, required: false }),
199
+ __metadata("design:type", ContentCaptureProcessResponsible)
200
+ ], ContentCaptureProcess.prototype, "responsible", void 0);
199
201
  __decorate([
200
202
  (0, mongoose_1.Prop)({
201
203
  type: String,
@@ -0,0 +1,88 @@
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 ProspectDocument = HydratedDocument<Prospect>;
28
+ export declare class ProspectResponsible {
29
+ name: string;
30
+ email: string;
31
+ }
32
+ export declare const ProspectResponsibleSchema: MongooseSchema<ProspectResponsible, import("mongoose").Model<ProspectResponsible, any, any, any, import("mongoose").Document<unknown, any, ProspectResponsible, any, {}> & ProspectResponsible & {
33
+ _id: Types.ObjectId;
34
+ } & {
35
+ __v: number;
36
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ProspectResponsible, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ProspectResponsible>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ProspectResponsible> & {
37
+ _id: Types.ObjectId;
38
+ } & {
39
+ __v: number;
40
+ }>;
41
+ export declare class ProspectNote {
42
+ text: string;
43
+ author: string;
44
+ createdAt: Date;
45
+ }
46
+ export declare const ProspectNoteSchema: MongooseSchema<ProspectNote, import("mongoose").Model<ProspectNote, any, any, any, import("mongoose").Document<unknown, any, ProspectNote, any, {}> & ProspectNote & {
47
+ _id: Types.ObjectId;
48
+ } & {
49
+ __v: number;
50
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ProspectNote, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ProspectNote>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ProspectNote> & {
51
+ _id: Types.ObjectId;
52
+ } & {
53
+ __v: number;
54
+ }>;
55
+ export declare class Prospect {
56
+ _id?: Types.ObjectId;
57
+ organization: Types.ObjectId;
58
+ name: string;
59
+ value?: number;
60
+ status: 'open' | 'won' | 'lost';
61
+ hot: boolean;
62
+ responsible: ProspectResponsible;
63
+ lastContactAt: Date;
64
+ lastReminderAt?: Date;
65
+ notes: ProspectNote[];
66
+ }
67
+ export declare const ProspectSchema: MongooseSchema<Prospect, import("mongoose").Model<Prospect, any, any, any, import("mongoose").Document<unknown, any, Prospect, any, {}> & Prospect & Required<{
68
+ _id: Types.ObjectId;
69
+ }> & {
70
+ __v: number;
71
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Prospect, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Prospect>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Prospect> & Required<{
72
+ _id: Types.ObjectId;
73
+ }> & {
74
+ __v: number;
75
+ }>;
76
+ export declare const ProspectModel: import("mongoose").Model<Prospect, {}, {}, {}, import("mongoose").Document<unknown, {}, Prospect, {}, import("mongoose").DefaultSchemaOptions> & Prospect & Required<{
77
+ _id: Types.ObjectId;
78
+ }> & {
79
+ __v: number;
80
+ }, MongooseSchema<Prospect, import("mongoose").Model<Prospect, any, any, any, import("mongoose").Document<unknown, any, Prospect, any, {}> & Prospect & Required<{
81
+ _id: Types.ObjectId;
82
+ }> & {
83
+ __v: number;
84
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Prospect, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Prospect>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Prospect> & Required<{
85
+ _id: Types.ObjectId;
86
+ }> & {
87
+ __v: number;
88
+ }>>;
@@ -0,0 +1,101 @@
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.ProspectModel = exports.ProspectSchema = exports.Prospect = exports.ProspectNoteSchema = exports.ProspectNote = exports.ProspectResponsibleSchema = exports.ProspectResponsible = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const mongoose_2 = require("mongoose");
16
+ let ProspectResponsible = class ProspectResponsible {
17
+ };
18
+ __decorate([
19
+ (0, swagger_1.ApiProperty)({ example: 'João' }),
20
+ (0, mongoose_1.Prop)({ required: true }),
21
+ __metadata("design:type", String)
22
+ ], ProspectResponsible.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, swagger_1.ApiProperty)({ example: 'joao@empresa.com' }),
25
+ (0, mongoose_1.Prop)({ required: true }),
26
+ __metadata("design:type", String)
27
+ ], ProspectResponsible.prototype, "email", void 0);
28
+ ProspectResponsible = __decorate([
29
+ (0, mongoose_1.Schema)({ _id: false })
30
+ ], ProspectResponsible);
31
+ exports.ProspectResponsible = ProspectResponsible;
32
+ exports.ProspectResponsibleSchema = mongoose_1.SchemaFactory.createForClass(ProspectResponsible);
33
+ let ProspectNote = class ProspectNote {
34
+ };
35
+ __decorate([
36
+ (0, mongoose_1.Prop)({ required: true }),
37
+ __metadata("design:type", String)
38
+ ], ProspectNote.prototype, "text", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ required: true }),
41
+ __metadata("design:type", String)
42
+ ], ProspectNote.prototype, "author", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ required: true, default: Date.now }),
45
+ __metadata("design:type", Date)
46
+ ], ProspectNote.prototype, "createdAt", void 0);
47
+ ProspectNote = __decorate([
48
+ (0, mongoose_1.Schema)({ _id: false })
49
+ ], ProspectNote);
50
+ exports.ProspectNote = ProspectNote;
51
+ exports.ProspectNoteSchema = mongoose_1.SchemaFactory.createForClass(ProspectNote);
52
+ let Prospect = class Prospect {
53
+ };
54
+ __decorate([
55
+ (0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345678' }),
56
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
57
+ __metadata("design:type", mongoose_2.Types.ObjectId)
58
+ ], Prospect.prototype, "_id", void 0);
59
+ __decorate([
60
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Organization', required: true }),
61
+ __metadata("design:type", mongoose_2.Types.ObjectId)
62
+ ], Prospect.prototype, "organization", void 0);
63
+ __decorate([
64
+ (0, mongoose_1.Prop)({ required: true }),
65
+ __metadata("design:type", String)
66
+ ], Prospect.prototype, "name", void 0);
67
+ __decorate([
68
+ (0, mongoose_1.Prop)({ required: false }),
69
+ __metadata("design:type", Number)
70
+ ], Prospect.prototype, "value", void 0);
71
+ __decorate([
72
+ (0, mongoose_1.Prop)({ type: String, enum: ['open', 'won', 'lost'], required: true }),
73
+ __metadata("design:type", String)
74
+ ], Prospect.prototype, "status", void 0);
75
+ __decorate([
76
+ (0, mongoose_1.Prop)({ required: true, default: false }),
77
+ __metadata("design:type", Boolean)
78
+ ], Prospect.prototype, "hot", void 0);
79
+ __decorate([
80
+ (0, mongoose_1.Prop)({ type: exports.ProspectResponsibleSchema, required: true }),
81
+ __metadata("design:type", ProspectResponsible)
82
+ ], Prospect.prototype, "responsible", void 0);
83
+ __decorate([
84
+ (0, mongoose_1.Prop)({ required: true }),
85
+ __metadata("design:type", Date)
86
+ ], Prospect.prototype, "lastContactAt", void 0);
87
+ __decorate([
88
+ (0, mongoose_1.Prop)({ required: false }),
89
+ __metadata("design:type", Date)
90
+ ], Prospect.prototype, "lastReminderAt", void 0);
91
+ __decorate([
92
+ (0, mongoose_1.Prop)({ type: [exports.ProspectNoteSchema], default: [] }),
93
+ __metadata("design:type", Array)
94
+ ], Prospect.prototype, "notes", void 0);
95
+ Prospect = __decorate([
96
+ (0, mongoose_1.Schema)({ timestamps: true })
97
+ ], Prospect);
98
+ exports.Prospect = Prospect;
99
+ exports.ProspectSchema = mongoose_1.SchemaFactory.createForClass(Prospect);
100
+ exports.ProspectSchema.index({ organization: 1, status: 1, lastContactAt: 1 });
101
+ exports.ProspectModel = (0, mongoose_2.model)('Prospect', exports.ProspectSchema);
@@ -36,11 +36,11 @@ export declare class Proposal {
36
36
  origin: 'inbound' | 'outbound';
37
37
  profile?: Types.ObjectId | Profile;
38
38
  influencer?: Types.ObjectId | Influencer;
39
- responsable: {
39
+ responsible: {
40
40
  team: string;
41
41
  name: string;
42
42
  email: string;
43
- };
43
+ }[];
44
44
  }
45
45
  export declare class Negotiation {
46
46
  calculatorType: 'withPreDefinedBudget' | 'withoutPreDefinedBudget' | 'byCommission' | 'bourbon';
@@ -117,17 +117,17 @@ export declare class Inbox {
117
117
  bodyHtml?: string;
118
118
  receivedAt: Date;
119
119
  }
120
- export declare class SaleResponsables {
120
+ export declare class SaleResponsible {
121
121
  curation?: {
122
122
  team: string;
123
123
  name: string;
124
124
  email: string;
125
- };
125
+ }[];
126
126
  planning?: {
127
127
  team: string;
128
128
  name: string;
129
129
  email: string;
130
- };
130
+ }[];
131
131
  }
132
132
  export declare class SaleLinks {
133
133
  contract?: string;
@@ -155,7 +155,7 @@ export declare class Sale {
155
155
  createdAt?: Date;
156
156
  updatedAt?: Date;
157
157
  omieId?: string;
158
- responsables?: SaleResponsables;
158
+ responsible?: SaleResponsible;
159
159
  links?: SaleLinks;
160
160
  }
161
161
  export declare const SaleSchema: MongooseSchema<Sale, import("mongoose").Model<Sale, any, any, any, import("mongoose").Document<unknown, any, Sale, any, {}> & Sale & Required<{
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SaleModel = exports.SaleSchema = exports.Sale = exports.SaleLinks = exports.SaleResponsables = exports.Inbox = exports.CommissionInfo = exports.CommissionParticipant = exports.TimelineEntry = exports.Activity = exports.Lost = exports.Formalization = exports.Negotiation = exports.Proposal = void 0;
12
+ exports.SaleModel = exports.SaleSchema = exports.Sale = exports.SaleLinks = exports.SaleResponsible = exports.Inbox = exports.CommissionInfo = exports.CommissionParticipant = exports.TimelineEntry = exports.Activity = exports.Lost = exports.Formalization = exports.Negotiation = exports.Proposal = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
15
  const note_schema_1 = require("./note.schema");
@@ -55,14 +55,14 @@ __decorate([
55
55
  (0, mongoose_1.Prop)({
56
56
  _id: false,
57
57
  required: true,
58
- type: {
59
- team: String,
60
- name: String,
61
- email: String,
62
- },
58
+ type: [{
59
+ team: String,
60
+ name: String,
61
+ email: String,
62
+ }],
63
63
  }),
64
- __metadata("design:type", Object)
65
- ], Proposal.prototype, "responsable", void 0);
64
+ __metadata("design:type", Array)
65
+ ], Proposal.prototype, "responsible", void 0);
66
66
  Proposal = __decorate([
67
67
  (0, mongoose_1.Schema)({ _id: false })
68
68
  ], Proposal);
@@ -351,36 +351,36 @@ Inbox = __decorate([
351
351
  (0, mongoose_1.Schema)({ _id: false })
352
352
  ], Inbox);
353
353
  exports.Inbox = Inbox;
354
- let SaleResponsables = class SaleResponsables {
354
+ let SaleResponsible = class SaleResponsible {
355
355
  };
356
356
  __decorate([
357
357
  (0, mongoose_1.Prop)({
358
358
  _id: false,
359
359
  required: false,
360
- type: {
361
- team: String,
362
- name: String,
363
- email: String,
364
- },
360
+ type: [{
361
+ team: String,
362
+ name: String,
363
+ email: String,
364
+ }],
365
365
  }),
366
- __metadata("design:type", Object)
367
- ], SaleResponsables.prototype, "curation", void 0);
366
+ __metadata("design:type", Array)
367
+ ], SaleResponsible.prototype, "curation", void 0);
368
368
  __decorate([
369
369
  (0, mongoose_1.Prop)({
370
370
  _id: false,
371
371
  required: false,
372
- type: {
373
- team: String,
374
- name: String,
375
- email: String,
376
- },
372
+ type: [{
373
+ team: String,
374
+ name: String,
375
+ email: String,
376
+ }],
377
377
  }),
378
- __metadata("design:type", Object)
379
- ], SaleResponsables.prototype, "planning", void 0);
380
- SaleResponsables = __decorate([
378
+ __metadata("design:type", Array)
379
+ ], SaleResponsible.prototype, "planning", void 0);
380
+ SaleResponsible = __decorate([
381
381
  (0, mongoose_1.Schema)({ _id: false })
382
- ], SaleResponsables);
383
- exports.SaleResponsables = SaleResponsables;
382
+ ], SaleResponsible);
383
+ exports.SaleResponsible = SaleResponsible;
384
384
  let SaleLinks = class SaleLinks {
385
385
  };
386
386
  __decorate([
@@ -510,9 +510,9 @@ __decorate([
510
510
  __metadata("design:type", String)
511
511
  ], Sale.prototype, "omieId", void 0);
512
512
  __decorate([
513
- (0, mongoose_1.Prop)({ type: SaleResponsables, required: false }),
514
- __metadata("design:type", SaleResponsables)
515
- ], Sale.prototype, "responsables", void 0);
513
+ (0, mongoose_1.Prop)({ type: SaleResponsible, required: false }),
514
+ __metadata("design:type", SaleResponsible)
515
+ ], Sale.prototype, "responsible", void 0);
516
516
  __decorate([
517
517
  (0, mongoose_1.Prop)({ type: SaleLinks, required: false }),
518
518
  __metadata("design:type", SaleLinks)
@@ -528,6 +528,6 @@ exports.SaleSchema.index({ organization: 1, 'formalization.brand': 1 });
528
528
  exports.SaleSchema.index({ organization: 1, 'formalization.agency': 1 });
529
529
  exports.SaleSchema.index({ organization: 1, closedAt: 1, phase: 1 });
530
530
  exports.SaleSchema.index({ 'proposal.influencer': 1 });
531
- exports.SaleSchema.index({ 'proposal.responsable.email': 1 });
531
+ exports.SaleSchema.index({ 'proposal.responsible.email': 1 });
532
532
  exports.SaleSchema.index({ tags: 1 });
533
533
  exports.SaleModel = (0, mongoose_2.model)('Sale', exports.SaleSchema);
@@ -35,6 +35,7 @@ export declare enum OrganizationTeam {
35
35
  }
36
36
  export declare enum UserRole {
37
37
  ADMIN = "admin",
38
+ SUPERADMIN = "superadmin",
38
39
  USER = "user",
39
40
  CLIENT = "client",
40
41
  INFLUENCER = "influencer"
@@ -46,6 +47,7 @@ export declare class User {
46
47
  username: string;
47
48
  team?: OrganizationTeam;
48
49
  role?: UserRole;
50
+ squad?: 'squad_a' | 'squad_b';
49
51
  firebaseUid?: string;
50
52
  disabled?: boolean;
51
53
  createdAt?: Date;
@@ -24,6 +24,7 @@ var OrganizationTeam;
24
24
  var UserRole;
25
25
  (function (UserRole) {
26
26
  UserRole["ADMIN"] = "admin";
27
+ UserRole["SUPERADMIN"] = "superadmin";
27
28
  UserRole["USER"] = "user";
28
29
  UserRole["CLIENT"] = "client";
29
30
  UserRole["INFLUENCER"] = "influencer";
@@ -54,6 +55,10 @@ __decorate([
54
55
  (0, mongoose_1.Prop)({ enum: UserRole }),
55
56
  __metadata("design:type", String)
56
57
  ], User.prototype, "role", void 0);
58
+ __decorate([
59
+ (0, mongoose_1.Prop)({ type: String, enum: ['squad_a', 'squad_b'] }),
60
+ __metadata("design:type", String)
61
+ ], User.prototype, "squad", void 0);
57
62
  __decorate([
58
63
  (0, mongoose_1.Prop)({ trim: true }),
59
64
  __metadata("design:type", String)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.214",
3
+ "version": "1.0.215",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './schemas/action.schema';
2
+ export * from './schemas/prospect.schema';
2
3
  export * from './schemas/client.schema';
3
4
  export * from './schemas/content.schema';
4
5
  export * from './schemas/comment.schema';
@@ -34,18 +34,13 @@ export class Responsible {
34
34
 
35
35
  export const ResponsibleSchema = SchemaFactory.createForClass(Responsible);
36
36
 
37
- @Schema({ _id: false })
38
- export class Responsibles {
39
- @ApiProperty({ type: () => Responsible })
40
- @Prop({ type: ResponsibleSchema })
41
- service: Responsible;
42
-
43
- @ApiProperty({ type: () => Responsible, required: false })
44
- @Prop({ type: ResponsibleSchema, required: false })
45
- comercial?: Responsible;
46
- }
37
+ /**
38
+ * @deprecated Use `Responsible` or `Responsible[]` on Action.responsible
39
+ */
40
+ export class ActionResponsible extends Responsible {}
41
+ export const ActionResponsibleSchema = SchemaFactory.createForClass(ActionResponsible);
47
42
 
48
- export const ResponsiblesSchema = SchemaFactory.createForClass(Responsibles);
43
+ export { ActionResponsible as Responsibles, ActionResponsibleSchema as ResponsiblesSchema };
49
44
 
50
45
  export const ACTION_BUSINESS_UNIT_VALUES = [
51
46
  'service',
@@ -203,9 +198,9 @@ export class Action {
203
198
  @Prop({ type: MongooseSchema.Types.ObjectId })
204
199
  organization: Types.ObjectId ;
205
200
 
206
- @ApiProperty({ type: () => Responsibles })
207
- @Prop({ type: ResponsiblesSchema, required: true })
208
- responsibles: Responsibles;
201
+ @ApiProperty({ type: () => [Responsible] })
202
+ @Prop({ type: [ResponsibleSchema], required: true })
203
+ responsible: Responsible[];
209
204
 
210
205
  @ApiProperty({ example: '@brand', required: false })
211
206
  @Prop({ type: String, required: false })
@@ -290,7 +285,7 @@ ActionSchema.index({ organization: 1, client: 1 });
290
285
  ActionSchema.index({ organization: 1, sale: 1 });
291
286
  ActionSchema.index({ sale: 1 });
292
287
  ActionSchema.index({ organization: 1, startDate: 1, endDate: 1 });
293
- ActionSchema.index({ 'responsibles.service.email': 1 });
288
+ ActionSchema.index({ 'responsible.email': 1 });
294
289
  ActionSchema.index({ campaign: 1 });
295
290
 
296
291
  export const ActionModel = MongooseModel('Action', ActionSchema);
@@ -76,7 +76,7 @@ export class NicheItem {
76
76
  export const NicheItemSchema = SchemaFactory.createForClass(NicheItem);
77
77
 
78
78
  @Schema({ _id: false })
79
- export class Responsable {
79
+ export class ClientResponsible {
80
80
  @ApiProperty({ example: 'Maria Oliveira' })
81
81
  @Prop()
82
82
  name: string;
@@ -90,7 +90,7 @@ export class Responsable {
90
90
  email: string;
91
91
  }
92
92
 
93
- export const ResponsableSchema = SchemaFactory.createForClass(Responsable);
93
+ export const ClientResponsibleSchema = SchemaFactory.createForClass(ClientResponsible);
94
94
 
95
95
  @Schema({ timestamps: true })
96
96
  export class Client extends Party {
@@ -103,6 +103,9 @@ export class Client extends Party {
103
103
  @Prop({ type: String })
104
104
  type: string;
105
105
 
106
+ @Prop({ type: String, enum: ['fixed', 'punctual'], required: false })
107
+ engagement?: 'fixed' | 'punctual';
108
+
106
109
  @Prop({ type: [String], default: [] })
107
110
  categories: string[];
108
111
 
@@ -147,11 +150,11 @@ export class Client extends Party {
147
150
  @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Organization', required: false })
148
151
  organization?: Types.ObjectId;
149
152
 
150
- @Prop({ type: ResponsableSchema, required: false })
151
- reportResponsable?: Responsable;
153
+ @Prop({ type: ClientResponsibleSchema, required: false })
154
+ reportResponsible?: ClientResponsible;
152
155
 
153
156
  @Prop({ type: String, required: false })
154
- brandResponsable?: string;
157
+ brandResponsible?: string;
155
158
 
156
159
  // Perfis da marca nas redes sociais (mesmo vínculo de Influencer.profiles).
157
160
  // Usado pelo comment-capture-worker pra reconhecer comentário da própria marca.
@@ -129,15 +129,20 @@ export const ContentCaptureProcessResponsibleContactSchema = SchemaFactory.creat
129
129
  );
130
130
 
131
131
  @Schema({ _id: false })
132
- export class ContentCaptureProcessResponsibles {
133
- @Prop({ type: ContentCaptureProcessResponsibleContactSchema, required: false })
134
- service?: ContentCaptureProcessResponsibleContact;
132
+ export class ContentCaptureProcessResponsible {
133
+ @Prop({ type: [ContentCaptureProcessResponsibleContactSchema], required: false })
134
+ service?: ContentCaptureProcessResponsibleContact[];
135
135
  }
136
136
 
137
- export const ContentCaptureProcessResponsiblesSchema = SchemaFactory.createForClass(
138
- ContentCaptureProcessResponsibles,
137
+ export const ContentCaptureProcessResponsibleSchema = SchemaFactory.createForClass(
138
+ ContentCaptureProcessResponsible,
139
139
  );
140
140
 
141
+ export {
142
+ ContentCaptureProcessResponsible as ContentCaptureProcessResponsibles,
143
+ ContentCaptureProcessResponsibleSchema as ContentCaptureProcessResponsiblesSchema,
144
+ };
145
+
141
146
  @Schema({ collection: 'content-capture-processes', timestamps: true })
142
147
  export class ContentCaptureProcess {
143
148
  @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
@@ -155,8 +160,8 @@ export class ContentCaptureProcess {
155
160
  @Prop({ type: String, required: false })
156
161
  primetagId?: string;
157
162
 
158
- @Prop({ type: ContentCaptureProcessResponsiblesSchema, required: false })
159
- responsibles?: ContentCaptureProcessResponsibles;
163
+ @Prop({ type: ContentCaptureProcessResponsibleSchema, required: false })
164
+ responsible?: ContentCaptureProcessResponsible;
160
165
 
161
166
  @Prop({
162
167
  type: String,
@@ -0,0 +1,72 @@
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
+
5
+ export type ProspectDocument = HydratedDocument<Prospect>;
6
+
7
+ @Schema({ _id: false })
8
+ export class ProspectResponsible {
9
+ @ApiProperty({ example: 'João' })
10
+ @Prop({ required: true })
11
+ name: string;
12
+
13
+ @ApiProperty({ example: 'joao@empresa.com' })
14
+ @Prop({ required: true })
15
+ email: string;
16
+ }
17
+
18
+ export const ProspectResponsibleSchema = SchemaFactory.createForClass(ProspectResponsible);
19
+
20
+ @Schema({ _id: false })
21
+ export class ProspectNote {
22
+ @Prop({ required: true })
23
+ text: string;
24
+
25
+ @Prop({ required: true })
26
+ author: string;
27
+
28
+ @Prop({ required: true, default: Date.now })
29
+ createdAt: Date;
30
+ }
31
+
32
+ export const ProspectNoteSchema = SchemaFactory.createForClass(ProspectNote);
33
+
34
+ @Schema({ timestamps: true })
35
+ export class Prospect {
36
+ @ApiProperty({ example: '64bfc3a78d3f1e2a12345678' })
37
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
38
+ _id?: Types.ObjectId;
39
+
40
+ @Prop({ type: MongooseSchema.Types.ObjectId, ref: 'Organization', required: true })
41
+ organization: Types.ObjectId;
42
+
43
+ @Prop({ required: true })
44
+ name: string;
45
+
46
+ @Prop({ required: false })
47
+ value?: number;
48
+
49
+ @Prop({ type: String, enum: ['open', 'won', 'lost'], required: true })
50
+ status: 'open' | 'won' | 'lost';
51
+
52
+ @Prop({ required: true, default: false })
53
+ hot: boolean;
54
+
55
+ @Prop({ type: ProspectResponsibleSchema, required: true })
56
+ responsible: ProspectResponsible;
57
+
58
+ @Prop({ required: true })
59
+ lastContactAt: Date;
60
+
61
+ @Prop({ required: false })
62
+ lastReminderAt?: Date;
63
+
64
+ @Prop({ type: [ProspectNoteSchema], default: [] })
65
+ notes: ProspectNote[];
66
+ }
67
+
68
+ export const ProspectSchema = SchemaFactory.createForClass(Prospect);
69
+
70
+ ProspectSchema.index({ organization: 1, status: 1, lastContactAt: 1 });
71
+
72
+ export const ProspectModel = MongooseModel('Prospect', ProspectSchema);
@@ -42,17 +42,17 @@ export class Proposal {
42
42
  @Prop({
43
43
  _id: false,
44
44
  required: true,
45
- type: {
45
+ type: [{
46
46
  team: String,
47
47
  name: String,
48
48
  email: String,
49
- },
49
+ }],
50
50
  })
51
- responsable: {
51
+ responsible: {
52
52
  team: string;
53
53
  name: string;
54
54
  email: string;
55
- };
55
+ }[];
56
56
  }
57
57
 
58
58
  @Schema({ _id: false })
@@ -169,36 +169,36 @@ export class Inbox {
169
169
  }
170
170
 
171
171
  @Schema({ _id: false })
172
- export class SaleResponsables {
172
+ export class SaleResponsible {
173
173
  @Prop({
174
174
  _id: false,
175
175
  required: false,
176
- type: {
176
+ type: [{
177
177
  team: String,
178
178
  name: String,
179
179
  email: String,
180
- },
180
+ }],
181
181
  })
182
182
  curation?: {
183
183
  team: string;
184
184
  name: string;
185
185
  email: string;
186
- };
186
+ }[];
187
187
 
188
188
  @Prop({
189
189
  _id: false,
190
190
  required: false,
191
- type: {
191
+ type: [{
192
192
  team: String,
193
193
  name: String,
194
194
  email: String,
195
- },
195
+ }],
196
196
  })
197
197
  planning?: {
198
198
  team: string;
199
199
  name: string;
200
200
  email: string;
201
- };
201
+ }[];
202
202
  }
203
203
 
204
204
  @Schema({ _id: false })
@@ -306,8 +306,8 @@ export class Sale {
306
306
  @Prop({ type: String, required: false })
307
307
  omieId?: string;
308
308
 
309
- @Prop({ type: SaleResponsables, required: false })
310
- responsables?: SaleResponsables;
309
+ @Prop({ type: SaleResponsible, required: false })
310
+ responsible?: SaleResponsible;
311
311
 
312
312
  @Prop({ type: SaleLinks, required: false })
313
313
  links?: SaleLinks;
@@ -321,7 +321,7 @@ SaleSchema.index({ organization: 1, 'formalization.brand': 1 });
321
321
  SaleSchema.index({ organization: 1, 'formalization.agency': 1 });
322
322
  SaleSchema.index({ organization: 1, closedAt: 1, phase: 1 });
323
323
  SaleSchema.index({ 'proposal.influencer': 1 });
324
- SaleSchema.index({ 'proposal.responsable.email': 1 });
324
+ SaleSchema.index({ 'proposal.responsible.email': 1 });
325
325
  SaleSchema.index({ tags: 1 });
326
326
 
327
327
  export const SaleModel = MongooseModel('Sale', SaleSchema);
@@ -14,6 +14,7 @@ export enum OrganizationTeam {
14
14
 
15
15
  export enum UserRole {
16
16
  ADMIN = 'admin',
17
+ SUPERADMIN = 'superadmin',
17
18
  USER = 'user',
18
19
  CLIENT = 'client',
19
20
  INFLUENCER = 'influencer',
@@ -39,6 +40,9 @@ export class User {
39
40
  @Prop({ enum: UserRole })
40
41
  role?: UserRole;
41
42
 
43
+ @Prop({ type: String, enum: ['squad_a', 'squad_b'] })
44
+ squad?: 'squad_a' | 'squad_b';
45
+
42
46
  @Prop({ trim: true })
43
47
  firebaseUid?: string;
44
48