easywork-common-lib 1.0.5 → 1.0.7

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 (94) hide show
  1. package/dist/common/database/index.js +18 -1
  2. package/dist/entities/app_config/app-config.entity.d.ts +5 -0
  3. package/dist/entities/app_config/app-config.entity.js +33 -0
  4. package/dist/entities/app_config/app-config.entity.js.map +1 -0
  5. package/dist/entities/drive/folder.entity.d.ts +5 -0
  6. package/dist/entities/drive/folder.entity.js +33 -0
  7. package/dist/entities/drive/folder.entity.js.map +1 -0
  8. package/dist/entities/email.entity.d.ts +5 -0
  9. package/dist/entities/email.entity.js +33 -0
  10. package/dist/entities/email.entity.js.map +1 -0
  11. package/dist/entities/group.entity.d.ts +1 -1
  12. package/dist/entities/group.entity.js +1 -1
  13. package/dist/entities/group.entity.js.map +1 -1
  14. package/dist/entities/helpers/contact_email.entity.d.ts +11 -0
  15. package/dist/entities/helpers/contact_email.entity.js +61 -0
  16. package/dist/entities/helpers/contact_email.entity.js.map +1 -0
  17. package/dist/entities/helpers/contact_phone.entity.d.ts +11 -0
  18. package/dist/entities/helpers/contact_phone.entity.js +61 -0
  19. package/dist/entities/helpers/contact_phone.entity.js.map +1 -0
  20. package/dist/entities/helpers/contact_sources.entity.d.ts +5 -0
  21. package/dist/entities/helpers/contact_sources.entity.js +33 -0
  22. package/dist/entities/helpers/contact_sources.entity.js.map +1 -0
  23. package/dist/entities/helpers/contact_types.entity.d.ts +5 -0
  24. package/dist/entities/helpers/contact_types.entity.js +33 -0
  25. package/dist/entities/helpers/contact_types.entity.js.map +1 -0
  26. package/dist/entities/helpers/lead_email.entity.d.ts +11 -0
  27. package/dist/entities/helpers/lead_email.entity.js +59 -0
  28. package/dist/entities/helpers/lead_email.entity.js.map +1 -0
  29. package/dist/entities/helpers/lead_phone.entity.d.ts +11 -0
  30. package/dist/entities/helpers/lead_phone.entity.js +59 -0
  31. package/dist/entities/helpers/lead_phone.entity.js.map +1 -0
  32. package/dist/entities/index.d.ts +10 -0
  33. package/dist/entities/index.js +34 -1
  34. package/dist/entities/index.js.map +1 -1
  35. package/dist/entities/otp-log.entity.d.ts +1 -1
  36. package/dist/entities/otp-log.entity.js +1 -1
  37. package/dist/entities/otp-log.entity.js.map +1 -1
  38. package/dist/entities/permission.entity.d.ts +1 -1
  39. package/dist/entities/permission.entity.js +1 -1
  40. package/dist/entities/permission.entity.js.map +1 -1
  41. package/dist/entities/phone.entity.d.ts +5 -0
  42. package/dist/entities/phone.entity.js +33 -0
  43. package/dist/entities/phone.entity.js.map +1 -0
  44. package/dist/entities/profile.entity.d.ts +1 -1
  45. package/dist/entities/profile.entity.js +2 -2
  46. package/dist/entities/profile.entity.js.map +1 -1
  47. package/dist/entities/protocol.entity.d.ts +1 -1
  48. package/dist/entities/protocol.entity.js +1 -1
  49. package/dist/entities/protocol.entity.js.map +1 -1
  50. package/dist/entities/refresh-token.entity.d.ts +1 -1
  51. package/dist/entities/refresh-token.entity.js +1 -1
  52. package/dist/entities/refresh-token.entity.js.map +1 -1
  53. package/dist/entities/role.entity.d.ts +1 -1
  54. package/dist/entities/role.entity.js +1 -1
  55. package/dist/entities/role.entity.js.map +1 -1
  56. package/dist/entities/sales/contact.entity.d.ts +41 -0
  57. package/dist/entities/sales/contact.entity.js +221 -0
  58. package/dist/entities/sales/contact.entity.js.map +1 -0
  59. package/dist/entities/sales/lead.entity.d.ts +46 -0
  60. package/dist/entities/sales/lead.entity.js +244 -0
  61. package/dist/entities/sales/lead.entity.js.map +1 -0
  62. package/dist/entities/sales/poliza.entity.d.ts +58 -0
  63. package/dist/entities/sales/poliza.entity.js +342 -0
  64. package/dist/entities/sales/poliza.entity.js.map +1 -0
  65. package/dist/entities/user.entity.d.ts +1 -1
  66. package/dist/entities/user.entity.js +1 -1
  67. package/dist/entities/user.entity.js.map +1 -1
  68. package/dist/eslint.config.js +47 -1
  69. package/dist/index.js +18 -2
  70. package/package.json +3 -2
  71. package/src/entities/app_config/app-config.entity.ts +13 -0
  72. package/src/entities/drive/folder.entity.ts +13 -0
  73. package/src/entities/email.entity.ts +13 -0
  74. package/src/entities/group.entity.ts +1 -1
  75. package/src/entities/helpers/contact_email.entity.ts +33 -0
  76. package/src/entities/helpers/contact_phone.entity.ts +33 -0
  77. package/src/entities/helpers/contact_sources.entity.ts +13 -0
  78. package/src/entities/helpers/contact_types.entity.ts +13 -0
  79. package/src/entities/helpers/lead_email.entity.ts +31 -0
  80. package/src/entities/helpers/lead_phone.entity.ts +31 -0
  81. package/src/entities/index.ts +10 -0
  82. package/src/entities/otp-log.entity.ts +1 -1
  83. package/src/entities/permission.entity.ts +1 -1
  84. package/src/entities/phone.entity.ts +13 -0
  85. package/src/entities/profile.entity.ts +2 -2
  86. package/src/entities/protocol.entity.ts +1 -1
  87. package/src/entities/refresh-token.entity.ts +1 -1
  88. package/src/entities/role.entity.ts +1 -1
  89. package/src/entities/sales/contact.entity.ts +140 -0
  90. package/src/entities/sales/lead.entity.ts +151 -0
  91. package/src/entities/sales/poliza.entity.ts +220 -0
  92. package/src/entities/user.entity.ts +1 -1
  93. package/tsconfig.json +0 -4
  94. package/dist/index.js.LICENSE.txt +0 -19
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "easywork-common-lib",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Librería común de Easywork",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "build": "webpack",
7
+ "build": "tsc",
8
8
  "postbuild": "node -r tsconfig-paths/register dist/index.js",
9
9
  "test": "echo \"Error: no test specified\" && exit 1"
10
10
  },
@@ -26,6 +26,7 @@
26
26
  "@nestjs/typeorm": "^10.0.2",
27
27
  "class-transformer": "^0.5.1",
28
28
  "class-validator": "^0.14.1",
29
+ "pg": "^8.11.5",
29
30
  "tspath": "^2.6.8",
30
31
  "typeorm": "^0.3.20"
31
32
  },
@@ -0,0 +1,13 @@
1
+ import { BaseEntity } from "../../common/database";
2
+ import { MinLength } from "class-validator";
3
+ import { Column, Entity } from "typeorm";
4
+
5
+ @Entity()
6
+ export class AppConfig extends BaseEntity {
7
+ @MinLength(3)
8
+ @Column({ unique: true })
9
+ key: string;
10
+
11
+ @Column({ nullable: true })
12
+ value: string;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseEntity } from "../../common/database";
2
+ import { MinLength } from "class-validator";
3
+ import { Column, Entity } from "typeorm";
4
+
5
+ @Entity()
6
+ export class Folder extends BaseEntity {
7
+ @MinLength(1)
8
+ @Column({ unique: true })
9
+ name: string;
10
+
11
+ @Column({ default: false })
12
+ isDefault: boolean;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseEntity } from "../common/database";
2
+ import { MinLength } from "class-validator";
3
+ import { Column, Entity } from "typeorm";
4
+
5
+ @Entity()
6
+ export class Email extends BaseEntity {
7
+ @MinLength(3)
8
+ @Column({ unique: true })
9
+ email: string;
10
+
11
+ @Column({ name: "is_default", default: false })
12
+ isDefault: boolean;
13
+ }
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../common/database";
2
2
  import { MinLength } from "class-validator";
3
3
  import { Column, Entity } from "typeorm";
4
4
 
@@ -0,0 +1,33 @@
1
+ import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
2
+ import { Exclude } from "class-transformer";
3
+ import { Contact } from "../sales/contact.entity";
4
+ import { Email } from "../email.entity";
5
+
6
+ @Entity()
7
+ export class ContactEmail extends BaseEntity {
8
+ @PrimaryGeneratedColumn("uuid")
9
+ id?: string;
10
+
11
+ @Column()
12
+ contactId: string;
13
+
14
+ @Column()
15
+ emailId: string;
16
+
17
+ @Column({ nullable: true })
18
+ relation: string;
19
+
20
+ @Exclude()
21
+ @ManyToOne(() => Contact, contact => contact.emails, {
22
+ onDelete: "CASCADE",
23
+ onUpdate: "CASCADE",
24
+ })
25
+ public contact: Contact;
26
+
27
+ @ManyToOne(() => Email, {
28
+ onDelete: "CASCADE",
29
+ onUpdate: "CASCADE",
30
+ eager: true,
31
+ })
32
+ public email: Email; // s
33
+ }
@@ -0,0 +1,33 @@
1
+ import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
2
+ import { Exclude } from "class-transformer";
3
+ import { Contact } from "../sales/contact.entity";
4
+ import { Phone } from "../phone.entity";
5
+
6
+ @Entity()
7
+ export class ContactPhone extends BaseEntity {
8
+ @PrimaryGeneratedColumn("uuid")
9
+ id?: string;
10
+
11
+ @Column()
12
+ contactId: string;
13
+
14
+ @Column()
15
+ phoneId: string;
16
+
17
+ @Column({ nullable: true })
18
+ relation: string;
19
+
20
+ @Exclude()
21
+ @ManyToOne(() => Contact, contact => contact.phones, {
22
+ onDelete: "CASCADE",
23
+ onUpdate: "CASCADE",
24
+ })
25
+ public contact: Contact;
26
+
27
+ @ManyToOne(() => Phone, {
28
+ onDelete: "CASCADE",
29
+ onUpdate: "CASCADE",
30
+ eager: true,
31
+ })
32
+ public phone: Phone; // s
33
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseEntity } from "../../common/database";
2
+ import { MinLength } from "class-validator";
3
+ import { Column, Entity } from "typeorm";
4
+
5
+ @Entity()
6
+ export class ContactSource extends BaseEntity {
7
+ @MinLength(3)
8
+ @Column({ unique: true })
9
+ name: string;
10
+
11
+ @Column({ default: false })
12
+ isDefault: boolean;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseEntity } from "../../common/database";
2
+ import { MinLength } from "class-validator";
3
+ import { Column, Entity } from "typeorm";
4
+
5
+ @Entity()
6
+ export class ContactType extends BaseEntity {
7
+ @MinLength(3)
8
+ @Column({ unique: true })
9
+ name: string;
10
+
11
+ @Column({ default: false })
12
+ isDefault: boolean;
13
+ }
@@ -0,0 +1,31 @@
1
+ import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
2
+ import { Lead } from "../sales/lead.entity";
3
+ import { Email } from "../email.entity";
4
+
5
+ @Entity()
6
+ export class LeadEmail extends BaseEntity {
7
+ @PrimaryGeneratedColumn("uuid")
8
+ id?: string;
9
+
10
+ @Column()
11
+ leadId: string;
12
+
13
+ @Column()
14
+ emailId: string;
15
+
16
+ @Column({ nullable: true })
17
+ relation: string;
18
+
19
+ @ManyToOne(() => Lead, (lead) => lead.emails, {
20
+ onDelete: "CASCADE",
21
+ onUpdate: "CASCADE",
22
+ })
23
+ public lead: Lead;
24
+
25
+ @ManyToOne(() => Email, {
26
+ onDelete: "CASCADE",
27
+ onUpdate: "CASCADE",
28
+ eager: true,
29
+ })
30
+ public email: Email; // s
31
+ }
@@ -0,0 +1,31 @@
1
+ import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
2
+ import { Lead } from "../sales/lead.entity";
3
+ import { Phone } from "../phone.entity";
4
+
5
+ @Entity()
6
+ export class LeadPhone extends BaseEntity {
7
+ @PrimaryGeneratedColumn("uuid")
8
+ id?: string;
9
+
10
+ @Column()
11
+ leadId: string;
12
+
13
+ @Column()
14
+ phoneId: string;
15
+
16
+ @Column({ nullable: true })
17
+ relation: string;
18
+
19
+ @ManyToOne(() => Lead, (lead) => lead.phones, {
20
+ onDelete: "CASCADE",
21
+ onUpdate: "CASCADE",
22
+ })
23
+ public lead: Lead;
24
+
25
+ @ManyToOne(() => Phone, {
26
+ onDelete: "CASCADE",
27
+ onUpdate: "CASCADE",
28
+ eager: true,
29
+ })
30
+ public phone: Phone; // s
31
+ }
@@ -5,3 +5,13 @@ export * from "./refresh-token.entity";
5
5
  export * from "./profile.entity";
6
6
  export * from "./role.entity";
7
7
  export * from "./permission.entity";
8
+ export * from "./sales/contact.entity";
9
+ export * from "./sales/lead.entity";
10
+ export * from "./sales/poliza.entity";
11
+ export * from "./phone.entity";
12
+ export * from "./email.entity";
13
+ export * from "./helpers/contact_phone.entity";
14
+ export * from "./helpers/contact_email.entity";
15
+ export * from "./helpers/contact_types.entity";
16
+ export * from "./helpers/contact_sources.entity";
17
+ export * from "./app_config/app-config.entity";
@@ -1,5 +1,5 @@
1
1
  import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
2
- import { BaseEntity } from "@common/database";
2
+ import { BaseEntity } from "../common/database";
3
3
  import { User } from "./user.entity";
4
4
 
5
5
  @Entity()
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../common/database";
2
2
  import { Column, Entity, Index, JoinTable, ManyToMany } from "typeorm";
3
3
  import { Role } from "./role.entity";
4
4
 
@@ -0,0 +1,13 @@
1
+ import { BaseEntity } from "../common/database";
2
+ import { MinLength } from "class-validator";
3
+ import { Column, Entity } from "typeorm";
4
+
5
+ @Entity()
6
+ export class Phone extends BaseEntity {
7
+ @MinLength(3)
8
+ @Column({ unique: true })
9
+ number: string;
10
+
11
+ @Column({ name: "is_default", default: false })
12
+ isDefault: boolean;
13
+ }
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../common/database";
2
2
  import { Column, Entity, OneToOne } from "typeorm";
3
3
  import { User } from "./user.entity";
4
4
 
@@ -16,7 +16,7 @@ export class Profile extends BaseEntity {
16
16
  @Column({ nullable: true })
17
17
  birthday: Date;
18
18
 
19
- @OneToOne(() => User, (user) => user.profile, {
19
+ @OneToOne(() => User, user => user.profile, {
20
20
  onDelete: "CASCADE",
21
21
  onUpdate: "CASCADE",
22
22
  })
@@ -1,5 +1,5 @@
1
1
  import { Column, Entity } from "typeorm";
2
- import { BaseEntity } from "@common/database";
2
+ import { BaseEntity } from "../common/database";
3
3
 
4
4
  // Usa este modelo para almacenar el protocolo
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { Column, Entity, ManyToOne } from "typeorm";
2
- import { BaseEntity } from "@common/database";
2
+ import { BaseEntity } from "../common/database";
3
3
  import { User } from "./user.entity";
4
4
 
5
5
  @Entity()
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../common/database";
2
2
  import { MinLength } from "class-validator";
3
3
  import { Column, Entity } from "typeorm";
4
4
 
@@ -0,0 +1,140 @@
1
+ import { BaseEntity } from "../../common/database";
2
+ import { ContactEmail } from "../helpers/contact_email.entity";
3
+ import { ContactPhone } from "../helpers/contact_phone.entity";
4
+ import { ContactSource } from "../helpers/contact_sources.entity";
5
+ import { ContactType } from "../helpers/contact_types.entity";
6
+ import { User } from "../user.entity";
7
+ import { Column, Entity, ManyToOne, OneToMany } from "typeorm";
8
+
9
+ @Entity()
10
+ export class Contact extends BaseEntity {
11
+ @Column({ name: "curp", length: 50, nullable: true })
12
+ curp: string;
13
+
14
+ @Column({ name: "id_bitrix", nullable: true })
15
+ idBitrix: number;
16
+
17
+ @Column({ name: "cua", length: 50, nullable: true })
18
+ cua: string;
19
+
20
+ @Column({ name: "cargo", length: 50, nullable: true })
21
+ cargo: string;
22
+
23
+ @Column({ name: "full_name", length: 100, nullable: true })
24
+ fullName: string;
25
+
26
+ @Column({ name: "name", length: 50, nullable: true })
27
+ name: string;
28
+
29
+ @Column({ name: "last_name", length: 50, nullable: true })
30
+ lastName: string;
31
+
32
+ @Column({ name: "second_name", length: 50, nullable: true })
33
+ secondName: string;
34
+
35
+ @Column({ name: "photo", length: 255, nullable: true })
36
+ photo: string;
37
+
38
+ @Column({ name: "post", type: "text", nullable: true })
39
+ post: string;
40
+
41
+ @Column({ name: "address", type: "text", nullable: true })
42
+ address: string;
43
+
44
+ @Column({ name: "comments", type: "text", nullable: true })
45
+ comments: string;
46
+
47
+ @Column({ name: "lead", nullable: true })
48
+ lead: string;
49
+
50
+ @Column({ name: "export", default: false })
51
+ export: boolean;
52
+
53
+ @Column({ name: "originator_id", length: 255, nullable: true })
54
+ originatorId: string;
55
+
56
+ @Column({ name: "origin_id", length: 255, nullable: true })
57
+ originId: string;
58
+
59
+ @Column({ name: "origin_version", length: 255, nullable: true })
60
+ originVersion: string;
61
+
62
+ @Column({ name: "birthdate", nullable: true })
63
+ birthdate: Date;
64
+
65
+ @Column({ name: "honorific", length: 128, nullable: true })
66
+ honorific: string;
67
+
68
+ @Column({ name: "has_phone", default: false })
69
+ hasPhone: boolean;
70
+
71
+ @Column({ name: "has_email", default: false })
72
+ hasEmail: boolean;
73
+
74
+ @Column({ name: "has_imol", default: false })
75
+ hasImol: boolean;
76
+
77
+ @Column({ name: "face_id", nullable: true })
78
+ faceId: string;
79
+
80
+ @Column({ name: "opened", default: false })
81
+ opened: boolean;
82
+
83
+ @Column({ name: "company", nullable: true })
84
+ company: string;
85
+
86
+ @Column({ name: "source_description", type: "text", nullable: true })
87
+ sourceDescription: string;
88
+
89
+ /* Metadata */
90
+ @ManyToOne(() => User, {
91
+ onDelete: "SET NULL",
92
+ onUpdate: "CASCADE",
93
+ nullable: true,
94
+ })
95
+ assignedBy: User;
96
+
97
+ @ManyToOne(() => User, {
98
+ onDelete: "SET NULL",
99
+ onUpdate: "CASCADE",
100
+ nullable: true,
101
+ })
102
+ createdBy: User;
103
+
104
+ @ManyToOne(() => User, {
105
+ onDelete: "SET NULL",
106
+ onUpdate: "CASCADE",
107
+ nullable: true,
108
+ })
109
+ observador: User;
110
+
111
+ @ManyToOne(() => ContactType, {
112
+ onDelete: "SET NULL",
113
+ onUpdate: "CASCADE",
114
+ nullable: true,
115
+ eager: true,
116
+ })
117
+ type: ContactType;
118
+
119
+ @ManyToOne(() => ContactSource, {
120
+ onDelete: "SET NULL",
121
+ onUpdate: "CASCADE",
122
+ nullable: true,
123
+ eager: true,
124
+ })
125
+ source: ContactSource;
126
+
127
+ @OneToMany(() => ContactPhone, (contactPhone) => contactPhone.contact, {
128
+ onDelete: "CASCADE",
129
+ onUpdate: "CASCADE",
130
+ eager: true,
131
+ })
132
+ phones?: ContactPhone[];
133
+
134
+ @OneToMany(() => ContactEmail, (contactEmail) => contactEmail.contact, {
135
+ onDelete: "CASCADE",
136
+ onUpdate: "CASCADE",
137
+ eager: true,
138
+ })
139
+ emails?: ContactEmail[];
140
+ }
@@ -0,0 +1,151 @@
1
+ import { BaseEntity } from "../../common/database";
2
+ import { LeadEmail } from "../helpers/lead_email.entity";
3
+ import { LeadPhone } from "../helpers/lead_phone.entity";
4
+ import { User } from "../user.entity";
5
+ import { Column, Entity, ManyToOne, OneToMany, OneToOne } from "typeorm";
6
+ import { Contact } from "./contact.entity";
7
+
8
+ @Entity()
9
+ export class Lead extends BaseEntity {
10
+ @Column({ name: "curp", length: 50, nullable: true })
11
+ curp: string;
12
+
13
+ @Column({ name: "id_bitrix" })
14
+ idBitrix: number;
15
+
16
+ @Column({ name: "cua", length: 50, nullable: true })
17
+ cua: string;
18
+
19
+ @Column({ name: "full_name", length: 100, nullable: true })
20
+ fullName: string;
21
+
22
+ @Column({ name: "name", length: 50, nullable: true })
23
+ name: string;
24
+
25
+ @Column({ name: "last_name", length: 50, nullable: true })
26
+ lastName: string;
27
+
28
+ @Column({ name: "second_name", length: 50, nullable: true })
29
+ secondName: string;
30
+
31
+ @Column({ name: "photo", length: 255, nullable: true })
32
+ photo: string;
33
+
34
+ @Column({ type: "decimal" })
35
+ opportunity: number;
36
+
37
+ @Column({ name: "post", type: "text", nullable: true })
38
+ post: string;
39
+
40
+ @Column({ name: "address", type: "text", nullable: true })
41
+ address: string;
42
+
43
+ @Column({ name: "comments", type: "text", nullable: true })
44
+ comments: string;
45
+
46
+ @Column({ name: "lead", nullable: true })
47
+ lead: string;
48
+
49
+ @Column({ name: "export", default: false })
50
+ export: boolean;
51
+
52
+ @Column({ name: "originator_id", length: 255, nullable: true })
53
+ originatorId: string;
54
+
55
+ @Column({ name: "origin_id", length: 255, nullable: true })
56
+ originId: string;
57
+
58
+ @Column({ name: "origin_version", length: 255, nullable: true })
59
+ originVersion: string;
60
+
61
+ @Column({ name: "birthdate", nullable: true })
62
+ birthdate: Date;
63
+
64
+ @Column({ name: "honorific", length: 128, nullable: true })
65
+ honorific: string;
66
+
67
+ @Column({ name: "has_phone", default: false })
68
+ hasPhone: boolean;
69
+
70
+ @Column({ name: "has_email", default: false })
71
+ hasEmail: boolean;
72
+
73
+ @Column({ name: "has_imol", default: false })
74
+ hasImol: boolean;
75
+
76
+ @Column({ name: "face_id", nullable: true })
77
+ faceId: string;
78
+
79
+ @Column({ name: "opened", default: false })
80
+ opened: boolean;
81
+
82
+ @Column({ name: "company", nullable: true })
83
+ company: string;
84
+
85
+ @Column({ name: "status_id", nullable: true })
86
+ statusId: string;
87
+
88
+ @Column({ name: "company_title", length: 255, nullable: true })
89
+ companyTitle: string;
90
+
91
+ @Column({ name: "account_currency_id", nullable: true })
92
+ accountCurrencyId: string;
93
+
94
+ @Column({ nullable: true })
95
+ title: string;
96
+
97
+ @Column({ name: "source", length: 50, nullable: true })
98
+ source: string;
99
+
100
+ @Column({ name: "source_description", type: "text", nullable: true })
101
+ sourceDescription: string;
102
+
103
+ @Column({ name: "is_return_customer", nullable: true })
104
+ isReturnCustomer: boolean;
105
+
106
+ @Column({ name: "is_manual_opportunity", nullable: true })
107
+ isManualOpportunity: boolean;
108
+
109
+ /* Metadata */
110
+ @ManyToOne(() => User, {
111
+ onDelete: "SET NULL",
112
+ onUpdate: "CASCADE",
113
+ nullable: true,
114
+ })
115
+ assignedBy: User;
116
+
117
+ @ManyToOne(() => User, {
118
+ onDelete: "SET NULL",
119
+ onUpdate: "CASCADE",
120
+ nullable: true,
121
+ })
122
+ createdBy: User;
123
+
124
+ @ManyToOne(() => User, {
125
+ onDelete: "SET NULL",
126
+ onUpdate: "CASCADE",
127
+ nullable: true,
128
+ })
129
+ observador: User;
130
+
131
+ @OneToOne(() => Contact, {
132
+ onDelete: "SET NULL",
133
+ onUpdate: "CASCADE",
134
+ nullable: true,
135
+ })
136
+ contact: Contact;
137
+
138
+ @OneToMany(() => LeadPhone, (leadPhone) => leadPhone.lead, {
139
+ onDelete: "CASCADE",
140
+ onUpdate: "CASCADE",
141
+ eager: true,
142
+ })
143
+ phones?: LeadPhone[];
144
+
145
+ @OneToMany(() => LeadEmail, (leadEmail) => leadEmail.lead, {
146
+ onDelete: "CASCADE",
147
+ onUpdate: "CASCADE",
148
+ eager: true,
149
+ })
150
+ emails?: LeadEmail[];
151
+ }