easywork-common-lib 1.0.14 → 1.0.19

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 (35) hide show
  1. package/dist/entities/drive/folder.entity.d.ts +1 -0
  2. package/dist/entities/drive/folder.entity.js +11 -2
  3. package/dist/entities/drive/folder.entity.js.map +1 -1
  4. package/package.json +1 -1
  5. package/tsconfig.tsbuildinfo +1 -0
  6. package/src/common/@types/typings/globals.d.ts +0 -13
  7. package/src/common/database/base.entity.ts +0 -30
  8. package/src/common/database/index.ts +0 -1
  9. package/src/entities/app_config/app-config.entity.ts +0 -13
  10. package/src/entities/drive/file.entity.ts +0 -41
  11. package/src/entities/drive/folder.entity.ts +0 -24
  12. package/src/entities/drive/index.ts +0 -2
  13. package/src/entities/email.entity.ts +0 -13
  14. package/src/entities/group.entity.ts +0 -10
  15. package/src/entities/helpers/contact_email.entity.ts +0 -33
  16. package/src/entities/helpers/contact_phone.entity.ts +0 -33
  17. package/src/entities/helpers/contact_sources.entity.ts +0 -13
  18. package/src/entities/helpers/contact_types.entity.ts +0 -13
  19. package/src/entities/helpers/entity_file.entity.ts +0 -26
  20. package/src/entities/helpers/lead_email.entity.ts +0 -31
  21. package/src/entities/helpers/lead_phone.entity.ts +0 -31
  22. package/src/entities/index.ts +0 -18
  23. package/src/entities/otp-log.entity.ts +0 -20
  24. package/src/entities/permission.entity.ts +0 -20
  25. package/src/entities/phone.entity.ts +0 -13
  26. package/src/entities/profile.entity.ts +0 -24
  27. package/src/entities/protocol.entity.ts +0 -24
  28. package/src/entities/refresh-token.entity.ts +0 -24
  29. package/src/entities/role.entity.ts +0 -13
  30. package/src/entities/sales/contact.entity.ts +0 -140
  31. package/src/entities/sales/lead.entity.ts +0 -151
  32. package/src/entities/sales/poliza.entity.ts +0 -220
  33. package/src/entities/user.entity.ts +0 -54
  34. package/src/eslint.config.js +0 -45
  35. package/src/index.ts +0 -1
@@ -1,26 +0,0 @@
1
- import { Entity, PrimaryGeneratedColumn, Column, BaseEntity, ManyToOne } from "typeorm";
2
- import { File } from "../drive/file.entity";
3
-
4
- @Entity()
5
- export class EntityFile extends BaseEntity {
6
- @PrimaryGeneratedColumn("uuid")
7
- id: string;
8
-
9
- @Column("uuid")
10
- entityId: string; // ID de la entidad asociada
11
-
12
- @Column()
13
- entityType: string; // Tipo de la entidad asociada (p.ej. 'User', 'Poliza', 'Contact', 'Company')
14
-
15
- @Column()
16
- fileId: string; // ID del archivo asociado
17
-
18
- @Column({ nullable: true })
19
- relation: string; // Descripción o tipo de relación (opcional)
20
-
21
- @ManyToOne(() => File, file => file.owners, {
22
- onDelete: "CASCADE",
23
- onUpdate: "CASCADE",
24
- })
25
- public file: File;
26
- }
@@ -1,31 +0,0 @@
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
- }
@@ -1,31 +0,0 @@
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
- }
@@ -1,18 +0,0 @@
1
- export * from "./user.entity";
2
- export * from "./protocol.entity";
3
- export * from "./otp-log.entity";
4
- export * from "./refresh-token.entity";
5
- export * from "./profile.entity";
6
- export * from "./role.entity";
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";
18
- export * from "./drive"
@@ -1,20 +0,0 @@
1
- import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
2
- import { BaseEntity } from "../common/database";
3
- import { User } from "./user.entity";
4
-
5
- @Entity()
6
- @Index(["otpCode"], { unique: true })
7
- export class OtpLog extends BaseEntity {
8
- @Column({ type: "timestamp" })
9
- expiresIn!: Date;
10
-
11
- @Column({ length: 20, nullable: true })
12
- otpCode?: string;
13
-
14
- @ManyToOne(() => User, { eager: false, nullable: false })
15
- @JoinColumn()
16
- user!: User;
17
-
18
- @Column({ default: false })
19
- isUsed?: boolean;
20
- }
@@ -1,20 +0,0 @@
1
- import { BaseEntity } from "../common/database";
2
- import { Column, Entity, Index, JoinTable, ManyToMany } from "typeorm";
3
- import { Role } from "./role.entity";
4
-
5
- @Entity()
6
- @Index(["resource", "action"], { unique: true })
7
- export class Permission extends BaseEntity {
8
- @Column()
9
- resource: string;
10
-
11
- @Column()
12
- action: string;
13
-
14
- @ManyToMany(() => Role, {
15
- onDelete: "CASCADE",
16
- onUpdate: "CASCADE",
17
- })
18
- @JoinTable()
19
- roles?: Role[];
20
- }
@@ -1,13 +0,0 @@
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,24 +0,0 @@
1
- import { BaseEntity } from "../common/database";
2
- import { Column, Entity, OneToOne } from "typeorm";
3
- import { User } from "./user.entity";
4
-
5
- @Entity("user_profile")
6
- export class Profile extends BaseEntity {
7
- @Column()
8
- firstName: string;
9
-
10
- @Column()
11
- lastName: string;
12
-
13
- @Column({ unique: true })
14
- idcard: string;
15
-
16
- @Column({ nullable: true })
17
- birthday: Date;
18
-
19
- @OneToOne(() => User, user => user.profile, {
20
- onDelete: "CASCADE",
21
- onUpdate: "CASCADE",
22
- })
23
- user: User;
24
- }
@@ -1,24 +0,0 @@
1
- import { Column, Entity } from "typeorm";
2
- import { BaseEntity } from "../common/database";
3
-
4
- // Usa este modelo para almacenar el protocolo
5
-
6
- @Entity()
7
- export class Protocol extends BaseEntity {
8
- @Column()
9
- loginAttemptInterval!: number;
10
-
11
- @Column()
12
- loginIntervalUnit!: string;
13
-
14
- @Column()
15
- loginMaxRetry!: number;
16
-
17
- @Column()
18
- otpExpiryInMinutes!: number;
19
-
20
- constructor(partial?: Partial<Protocol>) {
21
- super();
22
- Object.assign(this, partial);
23
- }
24
- }
@@ -1,24 +0,0 @@
1
- import { Column, Entity, ManyToOne } from "typeorm";
2
- import { BaseEntity } from "../common/database";
3
- import { User } from "./user.entity";
4
-
5
- @Entity()
6
- export class RefreshToken extends BaseEntity {
7
- @Column()
8
- expiresIn!: Date;
9
-
10
- @ManyToOne(() => User, {
11
- eager: false,
12
- onDelete: "CASCADE",
13
- onUpdate: "CASCADE",
14
- })
15
- user!: User;
16
-
17
- @Column({ default: false })
18
- isRevoked?: boolean;
19
-
20
- constructor(partial?: Partial<RefreshToken>) {
21
- super();
22
- Object.assign(this, partial);
23
- }
24
- }
@@ -1,13 +0,0 @@
1
- import { BaseEntity } from "../common/database";
2
- import { MinLength } from "class-validator";
3
- import { Column, Entity } from "typeorm";
4
-
5
- @Entity()
6
- export class Role extends BaseEntity {
7
- @MinLength(3)
8
- @Column({ unique: true })
9
- name: string;
10
-
11
- @Column({ default: false })
12
- isDefault: boolean;
13
- }
@@ -1,140 +0,0 @@
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
- }
@@ -1,151 +0,0 @@
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
- }