easywork-common-lib 1.0.6 → 1.0.8

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 (86) hide show
  1. package/dist/common/database/index.js +18 -1
  2. package/dist/entities/app_config/app-config.entity.d.ts +1 -1
  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 +1 -1
  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 +1 -1
  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.js +61 -0
  15. package/dist/entities/helpers/contact_email.entity.js.map +1 -0
  16. package/dist/entities/helpers/contact_phone.entity.js +61 -0
  17. package/dist/entities/helpers/contact_phone.entity.js.map +1 -0
  18. package/dist/entities/helpers/contact_sources.entity.d.ts +1 -1
  19. package/dist/entities/helpers/contact_sources.entity.js +33 -0
  20. package/dist/entities/helpers/contact_sources.entity.js.map +1 -0
  21. package/dist/entities/helpers/contact_types.entity.d.ts +1 -1
  22. package/dist/entities/helpers/contact_types.entity.js +33 -0
  23. package/dist/entities/helpers/contact_types.entity.js.map +1 -0
  24. package/dist/entities/helpers/lead_email.entity.js +59 -0
  25. package/dist/entities/helpers/lead_email.entity.js.map +1 -0
  26. package/dist/entities/helpers/lead_phone.entity.js +59 -0
  27. package/dist/entities/helpers/lead_phone.entity.js.map +1 -0
  28. package/dist/entities/index.js +34 -1
  29. package/dist/entities/index.js.map +1 -1
  30. package/dist/entities/otp-log.entity.d.ts +1 -1
  31. package/dist/entities/otp-log.entity.js +1 -1
  32. package/dist/entities/otp-log.entity.js.map +1 -1
  33. package/dist/entities/permission.entity.d.ts +1 -1
  34. package/dist/entities/permission.entity.js +1 -1
  35. package/dist/entities/permission.entity.js.map +1 -1
  36. package/dist/entities/phone.entity.d.ts +1 -1
  37. package/dist/entities/phone.entity.js +33 -0
  38. package/dist/entities/phone.entity.js.map +1 -0
  39. package/dist/entities/profile.entity.d.ts +1 -1
  40. package/dist/entities/profile.entity.js +2 -2
  41. package/dist/entities/profile.entity.js.map +1 -1
  42. package/dist/entities/protocol.entity.d.ts +1 -1
  43. package/dist/entities/protocol.entity.js +1 -1
  44. package/dist/entities/protocol.entity.js.map +1 -1
  45. package/dist/entities/refresh-token.entity.d.ts +1 -1
  46. package/dist/entities/refresh-token.entity.js +1 -1
  47. package/dist/entities/refresh-token.entity.js.map +1 -1
  48. package/dist/entities/role.entity.d.ts +1 -1
  49. package/dist/entities/role.entity.js +1 -1
  50. package/dist/entities/role.entity.js.map +1 -1
  51. package/dist/entities/sales/contact.entity.d.ts +1 -1
  52. package/dist/entities/sales/contact.entity.js +221 -0
  53. package/dist/entities/sales/contact.entity.js.map +1 -0
  54. package/dist/entities/sales/lead.entity.d.ts +1 -1
  55. package/dist/entities/sales/lead.entity.js +244 -0
  56. package/dist/entities/sales/lead.entity.js.map +1 -0
  57. package/dist/entities/sales/poliza.entity.d.ts +1 -1
  58. package/dist/entities/sales/poliza.entity.js +342 -0
  59. package/dist/entities/sales/poliza.entity.js.map +1 -0
  60. package/dist/entities/user.entity.d.ts +1 -1
  61. package/dist/entities/user.entity.js +1 -1
  62. package/dist/entities/user.entity.js.map +1 -1
  63. package/dist/eslint.config.js +47 -1
  64. package/dist/index.js +18 -2
  65. package/package.json +3 -2
  66. package/src/entities/app_config/app-config.entity.ts +1 -1
  67. package/src/entities/drive/file.entity.ts +40 -0
  68. package/src/entities/drive/folder.entity.ts +11 -7
  69. package/src/entities/email.entity.ts +1 -1
  70. package/src/entities/group.entity.ts +1 -1
  71. package/src/entities/helpers/contact_sources.entity.ts +1 -1
  72. package/src/entities/helpers/contact_types.entity.ts +1 -1
  73. package/src/entities/helpers/entity_file.entity.ts +26 -0
  74. package/src/entities/otp-log.entity.ts +1 -1
  75. package/src/entities/permission.entity.ts +1 -1
  76. package/src/entities/phone.entity.ts +1 -1
  77. package/src/entities/profile.entity.ts +1 -1
  78. package/src/entities/protocol.entity.ts +1 -1
  79. package/src/entities/refresh-token.entity.ts +1 -1
  80. package/src/entities/role.entity.ts +1 -1
  81. package/src/entities/sales/contact.entity.ts +1 -1
  82. package/src/entities/sales/lead.entity.ts +1 -1
  83. package/src/entities/sales/poliza.entity.ts +1 -1
  84. package/src/entities/user.entity.ts +1 -1
  85. package/tsconfig.json +0 -4
  86. 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.6",
3
+ "version": "1.0.8",
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
  },
@@ -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,40 @@
1
+ import { BaseEntity } from "../../common/database";
2
+ import { MinLength } from "class-validator";
3
+ import { Column, Entity, JoinColumn, OneToMany, OneToOne } from "typeorm";
4
+ import { Folder } from "./folder.entity";
5
+ import { EntityFile } from "../helpers/entity_file.entity";
6
+
7
+ @Entity()
8
+ export class File extends BaseEntity {
9
+ @MinLength(1)
10
+ name: string;
11
+
12
+ @OneToOne(() => Folder, {
13
+ onDelete: "CASCADE",
14
+ onUpdate: "CASCADE",
15
+ })
16
+ @JoinColumn()
17
+ folder: Folder;
18
+
19
+ @Column({ nullable: true })
20
+ url: string;
21
+
22
+ @Column({ nullable: true })
23
+ size: number;
24
+
25
+ @Column({ type: "bigint", nullable: true })
26
+ mimeType: string;
27
+
28
+ @Column({ nullable: true })
29
+ s3Key: string;
30
+
31
+ @Column({ default: false })
32
+ isDefault: boolean;
33
+
34
+ @OneToMany(() => EntityFile, (EntityFile) => EntityFile.file, {
35
+ onDelete: "CASCADE",
36
+ onUpdate: "CASCADE",
37
+ eager: true,
38
+ })
39
+ owners?: EntityFile[];
40
+ }
@@ -1,13 +1,17 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../../common/database";
2
2
  import { MinLength } from "class-validator";
3
- import { Column, Entity } from "typeorm";
3
+ import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
4
4
 
5
5
  @Entity()
6
6
  export class Folder extends BaseEntity {
7
- @MinLength(1)
8
- @Column({ unique: true })
9
- name: string;
7
+ @MinLength(1)
8
+ @Column({ unique: true })
9
+ name: string;
10
10
 
11
- @Column({ default: false })
12
- isDefault: boolean;
11
+ @OneToOne(() => Folder, {
12
+ onDelete: "CASCADE",
13
+ onUpdate: "CASCADE",
14
+ })
15
+ @JoinColumn()
16
+ parent: Folder;
13
17
  }
@@ -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
 
@@ -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
 
@@ -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
 
@@ -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,26 @@
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,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
 
@@ -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
 
@@ -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
 
@@ -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
 
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../../common/database";
2
2
  import { ContactEmail } from "../helpers/contact_email.entity";
3
3
  import { ContactPhone } from "../helpers/contact_phone.entity";
4
4
  import { ContactSource } from "../helpers/contact_sources.entity";
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../../common/database";
2
2
  import { LeadEmail } from "../helpers/lead_email.entity";
3
3
  import { LeadPhone } from "../helpers/lead_phone.entity";
4
4
  import { User } from "../user.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 { User } from "../user.entity";
4
4
  import { Column, Entity, ManyToOne } from "typeorm";
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "@common/database";
1
+ import { BaseEntity } from "../common/database";
2
2
  import { Column, Entity, JoinColumn, JoinTable, ManyToMany, OneToOne } from "typeorm";
3
3
  import { Exclude } from "class-transformer";
4
4
  import { Profile } from "./profile.entity";
package/tsconfig.json CHANGED
@@ -19,10 +19,6 @@
19
19
  "noImplicitAny": false,
20
20
  "strictBindCallApply": false,
21
21
  "forceConsistentCasingInFileNames": true,
22
- "paths": {
23
- "@common/*": ["./common/*"],
24
- "@entities": ["./entities"]
25
- },
26
22
  "noFallthroughCasesInSwitch": false
27
23
  },
28
24
  "include": ["test/**/*", "src/**/*", "eslint.config.js"],
@@ -1,19 +0,0 @@
1
- /*!
2
- */
3
-
4
- /*! *****************************************************************************
5
- Copyright (C) Microsoft. All rights reserved.
6
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
7
- this file except in compliance with the License. You may obtain a copy of the
8
- License at http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
12
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
13
- MERCHANTABLITY OR NON-INFRINGEMENT.
14
-
15
- See the Apache Version 2.0 License for specific language governing permissions
16
- and limitations under the License.
17
- ***************************************************************************** */
18
-
19
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */