easywork-common-lib 1.0.302 → 1.0.303

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.
@@ -3,3 +3,4 @@ export * from "./h_lead_types.entity";
3
3
  export * from "./lead_email.entity";
4
4
  export * from "./lead_phone.entity";
5
5
  export * from "./h_lead_stage.entity";
6
+ export * from "./lead_cancel_reazon.entity";
@@ -19,4 +19,5 @@ __exportStar(require("./h_lead_types.entity"), exports);
19
19
  __exportStar(require("./lead_email.entity"), exports);
20
20
  __exportStar(require("./lead_phone.entity"), exports);
21
21
  __exportStar(require("./h_lead_stage.entity"), exports);
22
+ __exportStar(require("./lead_cancel_reazon.entity"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/helpers/sales/lead/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,wDAAsC;AACtC,sDAAoC;AACpC,sDAAoC;AACpC,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/entities/helpers/sales/lead/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,wDAAsC;AACtC,sDAAoC;AACpC,sDAAoC;AACpC,wDAAsC;AACtC,8DAA4C"}
@@ -0,0 +1,4 @@
1
+ import { BaseEntitySimple } from "../../../../common/database";
2
+ export declare class LeadCancelReazon extends BaseEntitySimple {
3
+ name: string;
4
+ }
@@ -0,0 +1,29 @@
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.LeadCancelReazon = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const database_1 = require("../../../../common/database");
15
+ const typeorm_1 = require("typeorm");
16
+ let LeadCancelReazon = class LeadCancelReazon extends database_1.BaseEntitySimple {
17
+ name;
18
+ };
19
+ exports.LeadCancelReazon = LeadCancelReazon;
20
+ __decorate([
21
+ (0, swagger_1.ApiProperty)({ type: String, description: 'name of the reazon' }),
22
+ (0, typeorm_1.Column)({ length: 255 }),
23
+ __metadata("design:type", String)
24
+ ], LeadCancelReazon.prototype, "name", void 0);
25
+ exports.LeadCancelReazon = LeadCancelReazon = __decorate([
26
+ (0, typeorm_1.Index)('sub_agente_unique', ['name', "cua"], { unique: true }),
27
+ (0, typeorm_1.Entity)()
28
+ ], LeadCancelReazon);
29
+ //# sourceMappingURL=lead_cancel_reazon.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lead_cancel_reazon.entity.js","sourceRoot":"","sources":["../../../../../src/entities/helpers/sales/lead/lead_cancel_reazon.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,0DAA+D;AAC/D,qCAAgD;AAIzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAgB;IAGpD,IAAI,CAAS;CACd,CAAA;AAJY,4CAAgB;AAG3B;IAFC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAChE,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;8CACX;2BAHF,gBAAgB;IAF5B,IAAA,eAAK,EAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC7D,IAAA,gBAAM,GAAE;GACI,gBAAgB,CAI5B"}
@@ -1,49 +1,40 @@
1
- import { BaseEntity } from "../../common/database";
2
- import { LeadEmail } from "../helpers/sales/lead/lead_email.entity";
3
- import { LeadPhone } from "../helpers/sales/lead/lead_phone.entity";
1
+ import { BaseEntityWithUser } from "../../common/database";
2
+ import { ClientSource } from "../helpers/sales/common/client_sources.entity";
3
+ import { ClientType } from "../helpers/sales/common/client_types.entity";
4
4
  import { User } from "../user.entity";
5
+ import { PersonType } from "../../common";
5
6
  import { Contact } from "./contact.entity";
6
- import { LeadSource, LeadStage, LeadType } from "../helpers";
7
- export declare class Lead extends BaseEntity {
8
- curp: string;
9
- idBitrix: number;
10
- cua: string;
11
- fullName: string;
12
- name: string;
13
- lastName: string;
14
- secondName: string;
15
- photo: string;
16
- opportunity: number;
17
- post: string;
18
- address: string;
19
- comments: string;
20
- lead: string;
21
- export: boolean;
22
- originatorId: string;
23
- originId: string;
24
- originVersion: string;
25
- birthdate: Date;
26
- honorific: string;
27
- hasPhone: boolean;
28
- hasEmail: boolean;
29
- hasImol: boolean;
30
- faceId: string;
31
- opened: boolean;
32
- company: string;
33
- statusId: string;
34
- companyTitle: string;
35
- accountCurrencyId: string;
36
- title: string;
37
- sourceDescription: string;
38
- isReturnCustomer: boolean;
39
- isManualOpportunity: boolean;
40
- assignedBy: User;
41
- createdBy: User;
42
- observador: User;
43
- contact: Contact;
44
- type: LeadType;
45
- stage: LeadStage;
46
- source: LeadSource;
7
+ import { LeadCancelReazon, LeadEmail, LeadPhone } from "entities/helpers";
8
+ import { LeadStage } from "../helpers";
9
+ export declare class Lead extends BaseEntityWithUser {
10
+ idBitrix?: number;
11
+ typePerson: PersonType;
12
+ codigo?: string;
13
+ fullName?: string;
14
+ name?: string;
15
+ lastName?: string;
16
+ secondName?: string;
17
+ rfc?: string;
18
+ address?: string;
47
19
  phones?: LeadPhone[];
48
20
  emails?: LeadEmail[];
21
+ cargo?: string;
22
+ birthdate?: Date;
23
+ gender?: string;
24
+ type?: ClientType;
25
+ source?: ClientSource;
26
+ assignedBy?: User;
27
+ observador?: User;
28
+ lead?: Lead;
29
+ relations?: Contact[];
30
+ curp?: string;
31
+ cua?: string;
32
+ photo?: string;
33
+ post?: string;
34
+ comments?: string;
35
+ company?: string;
36
+ export?: boolean;
37
+ sourceDescription?: string;
38
+ cancelReazon: LeadCancelReazon;
39
+ stage: LeadStage;
49
40
  }
@@ -11,237 +11,165 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Lead = void 0;
13
13
  const database_1 = require("../../common/database");
14
- const lead_email_entity_1 = require("../helpers/sales/lead/lead_email.entity");
15
- const lead_phone_entity_1 = require("../helpers/sales/lead/lead_phone.entity");
14
+ const client_sources_entity_1 = require("../helpers/sales/common/client_sources.entity");
15
+ const client_types_entity_1 = require("../helpers/sales/common/client_types.entity");
16
16
  const user_entity_1 = require("../user.entity");
17
17
  const typeorm_1 = require("typeorm");
18
- const contact_entity_1 = require("./contact.entity");
19
- const helpers_1 = require("../helpers");
20
18
  const swagger_1 = require("@nestjs/swagger");
21
- let Lead = class Lead extends database_1.BaseEntity {
22
- curp;
19
+ const common_1 = require("../../common");
20
+ const contact_entity_1 = require("./contact.entity");
21
+ const helpers_1 = require("entities/helpers");
22
+ const helpers_2 = require("../helpers");
23
+ let Lead = class Lead extends database_1.BaseEntityWithUser {
23
24
  idBitrix;
24
- cua;
25
+ typePerson;
26
+ codigo;
25
27
  fullName;
26
28
  name;
27
29
  lastName;
28
30
  secondName;
31
+ rfc;
32
+ address;
33
+ phones;
34
+ emails;
35
+ cargo;
36
+ birthdate;
37
+ gender;
38
+ type;
39
+ source;
40
+ assignedBy;
41
+ observador;
42
+ lead;
43
+ relations;
44
+ curp;
45
+ cua;
29
46
  photo;
30
- opportunity;
31
47
  post;
32
- address;
33
48
  comments;
34
- lead;
35
- export;
36
- originatorId;
37
- originId;
38
- originVersion;
39
- birthdate;
40
- honorific;
41
- hasPhone;
42
- hasEmail;
43
- hasImol;
44
- faceId;
45
- opened;
46
49
  company;
47
- statusId;
48
- companyTitle;
49
- accountCurrencyId;
50
- title;
50
+ export;
51
51
  sourceDescription;
52
- isReturnCustomer;
53
- isManualOpportunity;
54
- assignedBy;
55
- createdBy;
56
- observador;
57
- contact;
58
- type;
52
+ cancelReazon;
59
53
  stage;
60
- source;
61
- phones;
62
- emails;
63
54
  };
64
55
  exports.Lead = Lead;
65
- __decorate([
66
- (0, swagger_1.ApiProperty)({ type: String, description: 'CURP of the lead', required: false }),
67
- (0, typeorm_1.Column)({ name: "curp", length: 50, nullable: true }),
68
- __metadata("design:type", String)
69
- ], Lead.prototype, "curp", void 0);
70
56
  __decorate([
71
57
  (0, swagger_1.ApiProperty)({ type: Number, description: 'Bitrix ID of the lead', required: false }),
72
58
  (0, typeorm_1.Column)({ name: "id_bitrix", nullable: true }),
73
59
  __metadata("design:type", Number)
74
60
  ], Lead.prototype, "idBitrix", void 0);
75
61
  __decorate([
76
- (0, swagger_1.ApiProperty)({ type: String, description: 'CUA of the lead', required: false }),
77
- (0, typeorm_1.Column)({ name: "cua", length: 50, nullable: true }),
62
+ (0, swagger_1.ApiProperty)({
63
+ enum: common_1.PersonType,
64
+ description: 'Type of person',
65
+ default: common_1.PersonType.FISICA
66
+ }),
67
+ (0, typeorm_1.Column)({
68
+ type: "enum",
69
+ enum: common_1.PersonType,
70
+ default: common_1.PersonType.FISICA
71
+ }),
78
72
  __metadata("design:type", String)
79
- ], Lead.prototype, "cua", void 0);
73
+ ], Lead.prototype, "typePerson", void 0);
74
+ __decorate([
75
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Code of the lead', required: false }),
76
+ (0, typeorm_1.Column)({ name: "codigo", length: 100, nullable: true }),
77
+ __metadata("design:type", String)
78
+ ], Lead.prototype, "codigo", void 0);
80
79
  __decorate([
81
80
  (0, swagger_1.ApiProperty)({ type: String, description: 'Full name of the lead', required: false }),
82
- (0, typeorm_1.Column)({ name: "full_name", length: 100, nullable: true }),
81
+ (0, typeorm_1.Column)({ name: "full_name", length: 255, nullable: true }),
83
82
  __metadata("design:type", String)
84
83
  ], Lead.prototype, "fullName", void 0);
85
84
  __decorate([
86
85
  (0, swagger_1.ApiProperty)({ type: String, description: 'First name of the lead', required: false }),
87
- (0, typeorm_1.Column)({ name: "name", length: 50, nullable: true }),
86
+ (0, typeorm_1.Column)({ name: "name", length: 150, nullable: true }),
88
87
  __metadata("design:type", String)
89
88
  ], Lead.prototype, "name", void 0);
90
89
  __decorate([
91
90
  (0, swagger_1.ApiProperty)({ type: String, description: 'Last name of the lead', required: false }),
92
- (0, typeorm_1.Column)({ name: "last_name", length: 50, nullable: true }),
91
+ (0, typeorm_1.Column)({ name: "last_name", length: 150, nullable: true }),
93
92
  __metadata("design:type", String)
94
93
  ], Lead.prototype, "lastName", void 0);
95
94
  __decorate([
96
95
  (0, swagger_1.ApiProperty)({ type: String, description: 'Second name of the lead', required: false }),
97
- (0, typeorm_1.Column)({ name: "second_name", length: 50, nullable: true }),
96
+ (0, typeorm_1.Column)({ name: "second_name", length: 150, nullable: true }),
98
97
  __metadata("design:type", String)
99
98
  ], Lead.prototype, "secondName", void 0);
100
99
  __decorate([
101
- (0, swagger_1.ApiProperty)({ type: String, description: 'Photo URL of the lead', required: false }),
102
- (0, typeorm_1.Column)({ name: "photo", length: 255, nullable: true }),
103
- __metadata("design:type", String)
104
- ], Lead.prototype, "photo", void 0);
105
- __decorate([
106
- (0, swagger_1.ApiProperty)({ type: Number, description: 'Opportunity amount', required: false }),
107
- (0, typeorm_1.Column)({ type: "decimal", nullable: true }),
108
- __metadata("design:type", Number)
109
- ], Lead.prototype, "opportunity", void 0);
110
- __decorate([
111
- (0, swagger_1.ApiProperty)({ type: String, description: 'Post of the lead', required: false }),
112
- (0, typeorm_1.Column)({ name: "post", type: "text", nullable: true }),
100
+ (0, swagger_1.ApiProperty)({ type: String, description: 'RFC of the lead', required: false }),
101
+ (0, typeorm_1.Column)({ name: "rfc", length: 100, nullable: true }),
113
102
  __metadata("design:type", String)
114
- ], Lead.prototype, "post", void 0);
103
+ ], Lead.prototype, "rfc", void 0);
115
104
  __decorate([
116
105
  (0, swagger_1.ApiProperty)({ type: String, description: 'Address of the lead', required: false }),
117
106
  (0, typeorm_1.Column)({ name: "address", type: "text", nullable: true }),
118
107
  __metadata("design:type", String)
119
108
  ], Lead.prototype, "address", void 0);
120
109
  __decorate([
121
- (0, swagger_1.ApiProperty)({ type: String, description: 'Comments about the lead', required: false }),
122
- (0, typeorm_1.Column)({ name: "comments", type: "text", nullable: true }),
123
- __metadata("design:type", String)
124
- ], Lead.prototype, "comments", void 0);
125
- __decorate([
126
- (0, swagger_1.ApiProperty)({ type: String, description: 'Lead reference', required: false }),
127
- (0, typeorm_1.Column)({ name: "lead", nullable: true }),
128
- __metadata("design:type", String)
129
- ], Lead.prototype, "lead", void 0);
130
- __decorate([
131
- (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Is the lead exported?', default: false }),
132
- (0, typeorm_1.Column)({ name: "export", default: false }),
133
- __metadata("design:type", Boolean)
134
- ], Lead.prototype, "export", void 0);
135
- __decorate([
136
- (0, swagger_1.ApiProperty)({ type: String, description: 'Originator ID of the lead', required: false }),
137
- (0, typeorm_1.Column)({ name: "originator_id", length: 255, nullable: true }),
138
- __metadata("design:type", String)
139
- ], Lead.prototype, "originatorId", void 0);
110
+ (0, swagger_1.ApiProperty)({ type: () => [helpers_1.LeadPhone], description: 'Phones associated with the lead' }),
111
+ (0, typeorm_1.OneToMany)(() => helpers_1.LeadPhone, (leadPhone) => leadPhone.lead, {
112
+ onDelete: "CASCADE",
113
+ onUpdate: "CASCADE",
114
+ eager: true,
115
+ }),
116
+ __metadata("design:type", Array)
117
+ ], Lead.prototype, "phones", void 0);
140
118
  __decorate([
141
- (0, swagger_1.ApiProperty)({ type: String, description: 'Origin ID of the lead', required: false }),
142
- (0, typeorm_1.Column)({ name: "origin_id", length: 255, nullable: true }),
143
- __metadata("design:type", String)
144
- ], Lead.prototype, "originId", void 0);
119
+ (0, swagger_1.ApiProperty)({ type: () => [helpers_1.LeadEmail], description: 'Emails associated with the lead' }),
120
+ (0, typeorm_1.OneToMany)(() => helpers_1.LeadEmail, (leadEmail) => leadEmail.lead, {
121
+ onDelete: "CASCADE",
122
+ onUpdate: "CASCADE",
123
+ eager: true,
124
+ }),
125
+ __metadata("design:type", Array)
126
+ ], Lead.prototype, "emails", void 0);
145
127
  __decorate([
146
- (0, swagger_1.ApiProperty)({ type: String, description: 'Origin version of the lead', required: false }),
147
- (0, typeorm_1.Column)({ name: "origin_version", length: 255, nullable: true }),
128
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Cargo of the lead', required: false }),
129
+ (0, typeorm_1.Column)({ name: "cargo", length: 150, nullable: true }),
148
130
  __metadata("design:type", String)
149
- ], Lead.prototype, "originVersion", void 0);
131
+ ], Lead.prototype, "cargo", void 0);
150
132
  __decorate([
151
133
  (0, swagger_1.ApiProperty)({ type: Date, description: 'Birthdate of the lead', required: false }),
152
134
  (0, typeorm_1.Column)({ name: "birthdate", nullable: true }),
153
135
  __metadata("design:type", Date)
154
136
  ], Lead.prototype, "birthdate", void 0);
155
137
  __decorate([
156
- (0, swagger_1.ApiProperty)({ type: String, description: 'Honorific of the lead', required: false }),
157
- (0, typeorm_1.Column)({ name: "honorific", length: 128, nullable: true }),
158
- __metadata("design:type", String)
159
- ], Lead.prototype, "honorific", void 0);
160
- __decorate([
161
- (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Does the lead have a phone?', default: false }),
162
- (0, typeorm_1.Column)({ name: "has_phone", default: false }),
163
- __metadata("design:type", Boolean)
164
- ], Lead.prototype, "hasPhone", void 0);
165
- __decorate([
166
- (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Does the lead have an email?', default: false }),
167
- (0, typeorm_1.Column)({ name: "has_email", default: false }),
168
- __metadata("design:type", Boolean)
169
- ], Lead.prototype, "hasEmail", void 0);
170
- __decorate([
171
- (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Does the lead have IMOL?', default: false }),
172
- (0, typeorm_1.Column)({ name: "has_imol", default: false }),
173
- __metadata("design:type", Boolean)
174
- ], Lead.prototype, "hasImol", void 0);
175
- __decorate([
176
- (0, swagger_1.ApiProperty)({ type: String, description: 'Face ID of the lead', required: false }),
177
- (0, typeorm_1.Column)({ name: "face_id", nullable: true }),
178
- __metadata("design:type", String)
179
- ], Lead.prototype, "faceId", void 0);
180
- __decorate([
181
- (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Is the lead opened?', default: false }),
182
- (0, typeorm_1.Column)({ name: "opened", default: false }),
183
- __metadata("design:type", Boolean)
184
- ], Lead.prototype, "opened", void 0);
185
- __decorate([
186
- (0, swagger_1.ApiProperty)({ type: String, description: 'Company associated with the lead', required: false }),
187
- (0, typeorm_1.Column)({ name: "company", nullable: true }),
188
- __metadata("design:type", String)
189
- ], Lead.prototype, "company", void 0);
190
- __decorate([
191
- (0, swagger_1.ApiProperty)({ type: String, description: 'Status ID of the lead', required: false }),
192
- (0, typeorm_1.Column)({ name: "status_id", nullable: true }),
138
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Gender of the lead', required: false }),
139
+ (0, typeorm_1.Column)({ name: "gender", length: 10, nullable: true }),
193
140
  __metadata("design:type", String)
194
- ], Lead.prototype, "statusId", void 0);
141
+ ], Lead.prototype, "gender", void 0);
195
142
  __decorate([
196
- (0, swagger_1.ApiProperty)({ type: String, description: 'Company title associated with the lead', required: false }),
197
- (0, typeorm_1.Column)({ name: "company_title", length: 255, nullable: true }),
198
- __metadata("design:type", String)
199
- ], Lead.prototype, "companyTitle", void 0);
200
- __decorate([
201
- (0, swagger_1.ApiProperty)({ type: String, description: 'Account currency ID of the lead', required: false }),
202
- (0, typeorm_1.Column)({ name: "account_currency_id", nullable: true }),
203
- __metadata("design:type", String)
204
- ], Lead.prototype, "accountCurrencyId", void 0);
205
- __decorate([
206
- (0, swagger_1.ApiProperty)({ type: String, description: 'Title of the lead', required: false }),
207
- (0, typeorm_1.Column)({ nullable: true }),
208
- __metadata("design:type", String)
209
- ], Lead.prototype, "title", void 0);
210
- __decorate([
211
- (0, swagger_1.ApiProperty)({ type: String, description: 'Source description of the lead', required: false }),
212
- (0, typeorm_1.Column)({ name: "source_description", type: "text", nullable: true }),
213
- __metadata("design:type", String)
214
- ], Lead.prototype, "sourceDescription", void 0);
215
- __decorate([
216
- (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Is the lead a return customer?', required: false }),
217
- (0, typeorm_1.Column)({ name: "is_return_customer", nullable: true }),
218
- __metadata("design:type", Boolean)
219
- ], Lead.prototype, "isReturnCustomer", void 0);
220
- __decorate([
221
- (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Is the opportunity manual?', required: false }),
222
- (0, typeorm_1.Column)({ name: "is_manual_opportunity", nullable: true }),
223
- __metadata("design:type", Boolean)
224
- ], Lead.prototype, "isManualOpportunity", void 0);
143
+ (0, swagger_1.ApiProperty)({ type: () => client_types_entity_1.ClientType, description: 'Lead type', required: true }),
144
+ (0, typeorm_1.ManyToOne)(() => client_types_entity_1.ClientType, {
145
+ onDelete: "SET NULL",
146
+ onUpdate: "CASCADE",
147
+ nullable: true,
148
+ eager: true,
149
+ }),
150
+ __metadata("design:type", client_types_entity_1.ClientType)
151
+ ], Lead.prototype, "type", void 0);
225
152
  __decorate([
226
- (0, swagger_1.ApiProperty)({ type: () => user_entity_1.User, description: 'User assigned to the lead', required: false }),
227
- (0, typeorm_1.ManyToOne)(() => user_entity_1.User, {
153
+ (0, swagger_1.ApiProperty)({ type: () => client_sources_entity_1.ClientSource, description: 'Lead source', required: true }),
154
+ (0, typeorm_1.ManyToOne)(() => client_sources_entity_1.ClientSource, {
228
155
  onDelete: "SET NULL",
229
156
  onUpdate: "CASCADE",
230
157
  nullable: true,
158
+ eager: true,
231
159
  }),
232
- __metadata("design:type", user_entity_1.User)
233
- ], Lead.prototype, "assignedBy", void 0);
160
+ __metadata("design:type", client_sources_entity_1.ClientSource)
161
+ ], Lead.prototype, "source", void 0);
234
162
  __decorate([
235
- (0, swagger_1.ApiProperty)({ type: () => user_entity_1.User, description: 'User who created the lead', required: false }),
163
+ (0, swagger_1.ApiProperty)({ type: () => user_entity_1.User, description: 'User assigned to the lead', required: false }),
236
164
  (0, typeorm_1.ManyToOne)(() => user_entity_1.User, {
237
165
  onDelete: "SET NULL",
238
166
  onUpdate: "CASCADE",
239
167
  nullable: true,
240
168
  }),
241
169
  __metadata("design:type", user_entity_1.User)
242
- ], Lead.prototype, "createdBy", void 0);
170
+ ], Lead.prototype, "assignedBy", void 0);
243
171
  __decorate([
244
- (0, swagger_1.ApiProperty)({ type: () => user_entity_1.User, description: 'Observer of the lead', required: false }),
172
+ (0, swagger_1.ApiProperty)({ type: () => user_entity_1.User, description: 'User observing the lead', required: false }),
245
173
  (0, typeorm_1.ManyToOne)(() => user_entity_1.User, {
246
174
  onDelete: "SET NULL",
247
175
  onUpdate: "CASCADE",
@@ -250,62 +178,81 @@ __decorate([
250
178
  __metadata("design:type", user_entity_1.User)
251
179
  ], Lead.prototype, "observador", void 0);
252
180
  __decorate([
253
- (0, swagger_1.ApiProperty)({ type: () => contact_entity_1.Contact, description: 'Contact associated with the lead', required: false }),
254
- (0, typeorm_1.OneToOne)(() => contact_entity_1.Contact, {
181
+ (0, swagger_1.ApiProperty)({ type: () => Lead, description: 'Lead', required: false }),
182
+ (0, typeorm_1.ManyToOne)(() => Lead, {
255
183
  onDelete: "SET NULL",
256
184
  onUpdate: "CASCADE",
257
185
  nullable: true,
258
186
  }),
259
- __metadata("design:type", contact_entity_1.Contact)
260
- ], Lead.prototype, "contact", void 0);
187
+ __metadata("design:type", Lead)
188
+ ], Lead.prototype, "lead", void 0);
261
189
  __decorate([
262
- (0, swagger_1.ApiProperty)({ type: () => helpers_1.LeadType, description: 'Type of the lead', required: true }),
263
- (0, typeorm_1.ManyToOne)(() => helpers_1.LeadType, {
264
- onDelete: "SET NULL",
190
+ (0, swagger_1.ApiProperty)({ type: () => [contact_entity_1.Contact], description: 'Contacts related' }),
191
+ (0, typeorm_1.ManyToMany)(() => contact_entity_1.Contact, {
192
+ onDelete: "CASCADE",
265
193
  onUpdate: "CASCADE",
266
- nullable: true,
267
- eager: true,
268
194
  }),
269
- __metadata("design:type", helpers_1.LeadType)
270
- ], Lead.prototype, "type", void 0);
195
+ (0, typeorm_1.JoinTable)(),
196
+ __metadata("design:type", Array)
197
+ ], Lead.prototype, "relations", void 0);
198
+ __decorate([
199
+ (0, swagger_1.ApiProperty)({ type: String, description: 'CURP of the lead', required: false }),
200
+ (0, typeorm_1.Column)({ name: "curp", length: 50, nullable: true }),
201
+ __metadata("design:type", String)
202
+ ], Lead.prototype, "curp", void 0);
203
+ __decorate([
204
+ (0, swagger_1.ApiProperty)({ type: String, description: 'CUA of the lead', required: false }),
205
+ (0, typeorm_1.Column)({ name: "cua", length: 50, nullable: true }),
206
+ __metadata("design:type", String)
207
+ ], Lead.prototype, "cua", void 0);
208
+ __decorate([
209
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Photo URL of the lead', required: false }),
210
+ (0, typeorm_1.Column)({ name: "photo", length: 255, nullable: true }),
211
+ __metadata("design:type", String)
212
+ ], Lead.prototype, "photo", void 0);
213
+ __decorate([
214
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Post of the lead', required: false }),
215
+ (0, typeorm_1.Column)({ name: "post", type: "text", nullable: true }),
216
+ __metadata("design:type", String)
217
+ ], Lead.prototype, "post", void 0);
271
218
  __decorate([
272
- (0, swagger_1.ApiProperty)({ type: () => helpers_1.LeadStage, description: 'Stage of the lead', required: true }),
273
- (0, typeorm_1.ManyToOne)(() => helpers_1.LeadStage, {
219
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Comments about the lead', required: false }),
220
+ (0, typeorm_1.Column)({ name: "comments", type: "text", nullable: true }),
221
+ __metadata("design:type", String)
222
+ ], Lead.prototype, "comments", void 0);
223
+ __decorate([
224
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Company of the lead', required: false }),
225
+ (0, typeorm_1.Column)({ length: 255, nullable: true }),
226
+ __metadata("design:type", String)
227
+ ], Lead.prototype, "company", void 0);
228
+ __decorate([
229
+ (0, swagger_1.ApiProperty)({ type: Boolean, description: 'Is the lead exported?', default: false }),
230
+ (0, typeorm_1.Column)({ name: "export", default: false }),
231
+ __metadata("design:type", Boolean)
232
+ ], Lead.prototype, "export", void 0);
233
+ __decorate([
234
+ (0, swagger_1.ApiProperty)({ type: String, description: 'Source description of the lead', required: false }),
235
+ (0, typeorm_1.Column)({ type: "text", nullable: true }),
236
+ __metadata("design:type", String)
237
+ ], Lead.prototype, "sourceDescription", void 0);
238
+ __decorate([
239
+ (0, swagger_1.ApiProperty)({ type: () => helpers_1.LeadCancelReazon, description: 'Cancel Reazon', required: false }),
240
+ (0, typeorm_1.ManyToOne)(() => helpers_1.LeadCancelReazon, {
274
241
  onDelete: "SET NULL",
275
242
  onUpdate: "CASCADE",
276
- nullable: true,
277
- eager: true,
278
243
  }),
279
- __metadata("design:type", helpers_1.LeadStage)
280
- ], Lead.prototype, "stage", void 0);
244
+ __metadata("design:type", helpers_1.LeadCancelReazon)
245
+ ], Lead.prototype, "cancelReazon", void 0);
281
246
  __decorate([
282
- (0, swagger_1.ApiProperty)({ type: () => helpers_1.LeadSource, description: 'Source of the lead', required: true }),
283
- (0, typeorm_1.ManyToOne)(() => helpers_1.LeadSource, {
247
+ (0, swagger_1.ApiProperty)({ type: () => helpers_2.LeadStage, description: 'Stage of the lead', required: true }),
248
+ (0, typeorm_1.ManyToOne)(() => helpers_2.LeadStage, {
284
249
  onDelete: "SET NULL",
285
250
  onUpdate: "CASCADE",
286
251
  nullable: true,
287
252
  eager: true,
288
253
  }),
289
- __metadata("design:type", helpers_1.LeadSource)
290
- ], Lead.prototype, "source", void 0);
291
- __decorate([
292
- (0, swagger_1.ApiProperty)({ type: () => [lead_phone_entity_1.LeadPhone], description: 'Phones associated with the lead' }),
293
- (0, typeorm_1.OneToMany)(() => lead_phone_entity_1.LeadPhone, (leadPhone) => leadPhone.lead, {
294
- onDelete: "CASCADE",
295
- onUpdate: "CASCADE",
296
- eager: true,
297
- }),
298
- __metadata("design:type", Array)
299
- ], Lead.prototype, "phones", void 0);
300
- __decorate([
301
- (0, swagger_1.ApiProperty)({ type: () => [lead_email_entity_1.LeadEmail], description: 'Emails associated with the lead' }),
302
- (0, typeorm_1.OneToMany)(() => lead_email_entity_1.LeadEmail, (leadEmail) => leadEmail.lead, {
303
- onDelete: "CASCADE",
304
- onUpdate: "CASCADE",
305
- eager: true,
306
- }),
307
- __metadata("design:type", Array)
308
- ], Lead.prototype, "emails", void 0);
254
+ __metadata("design:type", helpers_2.LeadStage)
255
+ ], Lead.prototype, "stage", void 0);
309
256
  exports.Lead = Lead = __decorate([
310
257
  (0, typeorm_1.Entity)()
311
258
  ], Lead);