test-entity-library-asm 1.3.4 → 1.3.6

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 (83) hide show
  1. package/dist/entities/City.d.ts +8 -2
  2. package/dist/entities/City.js +17 -2
  3. package/dist/entities/CodeRedemptionHistoryCompany.d.ts +1 -1
  4. package/dist/entities/CodeRedemptionHistoryCompany.js +1 -1
  5. package/dist/entities/Company.d.ts +5 -5
  6. package/dist/entities/Company.js +8 -8
  7. package/dist/entities/DiscountCodeCompany.d.ts +2 -2
  8. package/dist/entities/DiscountCodeCompany.js +3 -3
  9. package/dist/entities/DiscountCodeUser.d.ts +2 -2
  10. package/dist/entities/DiscountCodeUser.js +3 -3
  11. package/dist/entities/Local.d.ts +10 -8
  12. package/dist/entities/Local.js +20 -12
  13. package/dist/entities/LocalQualification.d.ts +1 -1
  14. package/dist/entities/LocalQualification.js +1 -1
  15. package/dist/entities/Master.d.ts +19 -2
  16. package/dist/entities/Master.js +95 -8
  17. package/dist/entities/MasterPermission.d.ts +9 -0
  18. package/dist/entities/MasterPermission.js +63 -0
  19. package/dist/entities/MasterRole.d.ts +11 -0
  20. package/dist/entities/MasterRole.js +88 -0
  21. package/dist/entities/Partner.d.ts +30 -0
  22. package/dist/entities/Partner.js +153 -0
  23. package/dist/entities/PartnerPermission.d.ts +9 -0
  24. package/dist/entities/PartnerPermission.js +63 -0
  25. package/dist/entities/PartnerRole.d.ts +11 -0
  26. package/dist/entities/PartnerRole.js +88 -0
  27. package/dist/entities/PaymentMethod.d.ts +2 -0
  28. package/dist/entities/PaymentMethod.js +8 -0
  29. package/dist/entities/Plan.d.ts +2 -2
  30. package/dist/entities/Plan.js +3 -3
  31. package/dist/entities/Product.d.ts +3 -1
  32. package/dist/entities/Product.js +9 -1
  33. package/dist/entities/Request.d.ts +2 -2
  34. package/dist/entities/Request.js +2 -2
  35. package/dist/entities/Square.d.ts +2 -0
  36. package/dist/entities/Square.js +9 -1
  37. package/dist/entities/Terminal.d.ts +2 -2
  38. package/dist/entities/Terminal.js +5 -5
  39. package/dist/entities/TerminalSession.d.ts +2 -2
  40. package/dist/entities/TerminalSession.js +4 -4
  41. package/dist/entities/User.d.ts +10 -17
  42. package/dist/entities/User.js +69 -50
  43. package/dist/entities/UserAddress.d.ts +14 -0
  44. package/dist/entities/UserAddress.js +98 -0
  45. package/dist/index.d.ts +1 -1
  46. package/dist/index.js +10 -1
  47. package/package.json +1 -1
  48. package/src/entities/Category.ts +3 -5
  49. package/src/entities/CategorySchedule.ts +3 -4
  50. package/src/entities/City.ts +17 -6
  51. package/src/entities/CodeRedemptionHistoryCompany.ts +4 -5
  52. package/src/entities/Company.ts +12 -12
  53. package/src/entities/Configuration.ts +1 -1
  54. package/src/entities/Country.ts +2 -3
  55. package/src/entities/Day.ts +1 -1
  56. package/src/entities/DiscountCodeCompany.ts +7 -7
  57. package/src/entities/DiscountCodeUser.ts +3 -2
  58. package/src/entities/Local.ts +23 -17
  59. package/src/entities/LocalQualification.ts +4 -5
  60. package/src/entities/Master.ts +91 -11
  61. package/src/entities/{Permission.ts → MasterPermission.ts} +11 -11
  62. package/src/entities/MasterRole.ts +73 -0
  63. package/src/entities/Partner.ts +140 -0
  64. package/src/entities/PartnerPermission.ts +49 -0
  65. package/src/entities/{Role.ts → PartnerRole.ts} +26 -18
  66. package/src/entities/PaymentMethod.ts +7 -1
  67. package/src/entities/Plan.ts +6 -7
  68. package/src/entities/Product.ts +13 -5
  69. package/src/entities/ProductIngredient.ts +1 -2
  70. package/src/entities/ProductTopping.ts +3 -4
  71. package/src/entities/Request.ts +3 -4
  72. package/src/entities/RequestProduct.ts +1 -2
  73. package/src/entities/RequestProductGroupComplement.ts +0 -1
  74. package/src/entities/RequestStatus.ts +1 -2
  75. package/src/entities/Square.ts +16 -2
  76. package/src/entities/Terminal.ts +5 -4
  77. package/src/entities/TerminalSession.ts +3 -3
  78. package/src/entities/TypeFood.ts +3 -4
  79. package/src/entities/TypeMeasureIngredient.ts +1 -2
  80. package/src/entities/User.ts +64 -48
  81. package/src/entities/UserAddress.ts +81 -0
  82. package/src/index.ts +12 -6
  83. package/src/entities/RoleVisibleTo.ts +0 -34
@@ -1,10 +1,9 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  JoinColumn,
6
5
  ManyToOne,
7
- PrimaryGeneratedColumn,
6
+ PrimaryGeneratedColumn
8
7
  } from 'typeorm'
9
8
  import { Product } from './Product'
10
9
  import { TypeMeasureIngredient } from './TypeMeasureIngredient'
@@ -1,11 +1,10 @@
1
1
  import {
2
- Entity,
3
2
  Column,
4
- PrimaryGeneratedColumn,
5
- ManyToOne,
3
+ Entity,
6
4
  JoinColumn,
5
+ ManyToOne,
7
6
  OneToMany,
8
- BaseEntity,
7
+ PrimaryGeneratedColumn
9
8
  } from 'typeorm'
10
9
  import { Company } from './Company'
11
10
  import { ProductGroup } from './ProductGroup'
@@ -1,5 +1,4 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  JoinColumn,
@@ -7,14 +6,14 @@ import {
7
6
  ManyToMany,
8
7
  ManyToOne,
9
8
  OneToMany,
10
- PrimaryGeneratedColumn,
9
+ PrimaryGeneratedColumn
11
10
  } from 'typeorm'
12
11
  import { Local } from './Local'
13
12
  import { PaymentMethod } from './PaymentMethod'
14
- import { RequestStatus } from './RequestStatus'
15
- import { User } from './User'
16
13
  import { RequestProduct } from './RequestProduct'
17
14
  import { RequestProductGroupComplement } from './RequestProductGroupComplement'
15
+ import { RequestStatus } from './RequestStatus'
16
+ import { User } from './User'
18
17
 
19
18
  @Entity({
20
19
  comment:
@@ -1,10 +1,9 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  JoinColumn,
6
5
  ManyToOne,
7
- PrimaryGeneratedColumn,
6
+ PrimaryGeneratedColumn
8
7
  } from 'typeorm'
9
8
  import { Product } from './Product'
10
9
  import { Request } from './Request'
@@ -1,5 +1,4 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  JoinColumn,
@@ -1,9 +1,8 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  OneToMany,
6
- PrimaryGeneratedColumn,
5
+ PrimaryGeneratedColumn
7
6
  } from 'typeorm'
8
7
  import { Request } from './Request'
9
8
 
@@ -1,9 +1,17 @@
1
- import { BaseEntity, Column, Entity, OneToMany, PrimaryColumn } from 'typeorm'
1
+ import {
2
+ Column,
3
+ Entity,
4
+ JoinTable,
5
+ ManyToMany,
6
+ OneToMany,
7
+ PrimaryColumn,
8
+ } from 'typeorm'
2
9
  import { Local } from './Local'
10
+ import { User } from './User'
3
11
 
4
12
  @Entity({
5
13
  comment:
6
- 'Centros comerciales registrados/agregados a la plataforma. \n\nDel centro comercial es importante saber si tiene una plazoleta de comida.',
14
+ 'Centros comerciales registrados/agregados a la plataforma.\r\n\r\nDel centro comercial es importante saber si tiene una plazoleta de comida.',
7
15
  })
8
16
  export class Square {
9
17
  @PrimaryColumn({
@@ -53,4 +61,10 @@ export class Square {
53
61
 
54
62
  @OneToMany(() => Local, (local) => local.square)
55
63
  locals: Local[]
64
+
65
+ @ManyToMany(() => User)
66
+ @JoinTable({
67
+ name: 'user_favorite_square',
68
+ })
69
+ users_favorite_square: User[]
56
70
  }
@@ -11,6 +11,7 @@ import {
11
11
  import { User } from './User'
12
12
  import { TerminalSession } from './TerminalSession'
13
13
  import { Local } from './Local'
14
+ import { Partner } from './Partner'
14
15
 
15
16
  @Entity({
16
17
  comment:
@@ -48,11 +49,11 @@ export class Terminal {
48
49
  })
49
50
  status: number
50
51
 
51
- @ManyToMany(() => User)
52
+ @ManyToMany(() => Partner)
52
53
  @JoinTable({
53
- name: 'user_terminal',
54
+ name: 'partner_terminal',
54
55
  joinColumn: {
55
- name: 'user',
56
+ name: 'partner',
56
57
  referencedColumnName: 'id',
57
58
  },
58
59
  inverseJoinColumn: {
@@ -60,7 +61,7 @@ export class Terminal {
60
61
  referencedColumnName: 'id',
61
62
  },
62
63
  })
63
- users: User[]
64
+ partners: Partner[]
64
65
 
65
66
  @OneToMany(() => TerminalSession, (terminalsUser) => terminalsUser.terminal)
66
67
  terminalsUser: TerminalSession[]
@@ -1,5 +1,4 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  JoinColumn,
@@ -8,6 +7,7 @@ import {
8
7
  } from 'typeorm'
9
8
  import { Terminal } from './Terminal'
10
9
  import { User } from './User'
10
+ import { Partner } from './Partner'
11
11
 
12
12
  @Entity('terminal_session', {
13
13
  comment:
@@ -19,13 +19,13 @@ export class TerminalSession {
19
19
  })
20
20
  id: number
21
21
 
22
- @ManyToOne(() => User, (user) => user.terminalUsers, {
22
+ @ManyToOne(() => Partner, (partner) => partner.sessions, {
23
23
  nullable: true,
24
24
  onDelete: 'CASCADE',
25
25
  onUpdate: 'NO ACTION',
26
26
  })
27
27
  @JoinColumn({ name: 'user' })
28
- user: User
28
+ partner: Partner
29
29
 
30
30
  @ManyToOne(() => Terminal, (terminal) => terminal.terminalsUser, {
31
31
  nullable: true,
@@ -1,10 +1,9 @@
1
1
  import {
2
- Entity,
3
2
  Column,
4
- PrimaryGeneratedColumn,
5
- ManyToMany,
3
+ Entity,
6
4
  JoinTable,
7
- BaseEntity,
5
+ ManyToMany,
6
+ PrimaryGeneratedColumn
8
7
  } from 'typeorm'
9
8
  import { Company } from './Company'
10
9
 
@@ -1,9 +1,8 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  OneToMany,
6
- PrimaryGeneratedColumn,
5
+ PrimaryGeneratedColumn
7
6
  } from 'typeorm'
8
7
  import { ProductIngredient } from './ProductIngredient'
9
8
 
@@ -1,5 +1,4 @@
1
1
  import {
2
- BaseEntity,
3
2
  Column,
4
3
  Entity,
5
4
  JoinColumn,
@@ -11,18 +10,15 @@ import {
11
10
  } from 'typeorm'
12
11
  import { City } from './City'
13
12
  import { CodeRedemptionHistoryUser } from './CodeRedemptionHistoryUser'
14
- import { Company } from './Company'
15
- import { DiscountCodeCompany } from './DiscountCodeCompany'
16
- import { DiscountCodeUser } from './DiscountCodeUser'
17
- import { Local } from './Local'
18
13
  import { LocalQualification } from './LocalQualification'
19
- import { Master } from './Master'
20
- import { Plan } from './Plan'
21
14
  import { Request } from './Request'
22
15
  import { RequestProduct } from './RequestProduct'
23
16
  import { RequestProductGroupComplement } from './RequestProductGroupComplement'
24
- import { Terminal } from './Terminal'
25
- import { TerminalSession } from './TerminalSession'
17
+ import { UserAddress } from './UserAddress'
18
+ import { PaymentMethod } from './PaymentMethod'
19
+ import { Square } from './Square'
20
+ import { Local } from './Local'
21
+ import { Product } from './Product'
26
22
 
27
23
  @Entity({ comment: 'Usuarios registrados en la plataforma.' })
28
24
  export class User {
@@ -116,51 +112,12 @@ export class User {
116
112
  })
117
113
  status: number
118
114
 
119
- @ManyToMany(() => Terminal)
120
- @JoinTable({
121
- name: 'user_terminal',
122
- })
123
- terminals: Terminal[]
124
-
125
- @OneToMany(() => TerminalSession, (terminalSession) => terminalSession.user)
126
- terminalUsers: TerminalSession[]
127
-
128
- @OneToMany(() => Plan, (plan) => plan.created_by)
129
- plans: Plan[]
130
-
131
- @OneToMany(() => Company, (company) => company.user)
132
- companies: Company[]
133
-
134
- @OneToMany(() => Local, (local) => local.updated_by)
135
- locals: Local[]
136
-
137
- @OneToMany(
138
- () => DiscountCodeCompany,
139
- (discountCodeCompany) => discountCodeCompany.updated_by
140
- )
141
- discount_code_companies: DiscountCodeCompany[]
142
-
143
- @OneToMany(
144
- () => DiscountCodeUser,
145
- (discountCodeUser) => discountCodeUser.updated_by
146
- )
147
- discount_code_users: DiscountCodeUser[]
148
-
149
115
  @OneToMany(
150
116
  () => CodeRedemptionHistoryUser,
151
117
  (codeRedemptionHistoryUser) => codeRedemptionHistoryUser.user
152
118
  )
153
119
  code_redemption_history_users: CodeRedemptionHistoryUser[]
154
120
 
155
- @ManyToMany(() => Local)
156
- @JoinTable({
157
- name: 'local_user',
158
- })
159
- locals_user: Local[]
160
-
161
- @OneToMany(() => Master, (master) => master.user)
162
- masters: Master[]
163
-
164
121
  @OneToMany(
165
122
  () => LocalQualification,
166
123
  (localQualification) => localQualification.user
@@ -184,4 +141,63 @@ export class User {
184
141
  (requestProduct) => requestProduct.user
185
142
  )
186
143
  request_product_group_complements: RequestProductGroupComplement[]
144
+
145
+ @OneToMany(() => UserAddress, (userAddress) => userAddress.user)
146
+ addresses: UserAddress[]
147
+
148
+ @ManyToMany(() => PaymentMethod)
149
+ @JoinTable({
150
+ name: 'user_payment_method',
151
+ joinColumn: {
152
+ name: 'payment_method',
153
+ referencedColumnName: 'id',
154
+ },
155
+ inverseJoinColumn: {
156
+ name: 'user',
157
+ referencedColumnName: 'id',
158
+ },
159
+ })
160
+ user_payments_method: PaymentMethod[]
161
+
162
+ @ManyToMany(() => Square)
163
+ @JoinTable({
164
+ name: 'user_favorite_square',
165
+ joinColumn: {
166
+ name: 'square',
167
+ referencedColumnName: 'id',
168
+ },
169
+ inverseJoinColumn: {
170
+ name: 'user',
171
+ referencedColumnName: 'id',
172
+ },
173
+ })
174
+ user_favorite_squares: Square[]
175
+
176
+ @ManyToMany(() => Local)
177
+ @JoinTable({
178
+ name: 'user_favorite_local',
179
+ joinColumn: {
180
+ name: 'local',
181
+ referencedColumnName: 'id',
182
+ },
183
+ inverseJoinColumn: {
184
+ name: 'user',
185
+ referencedColumnName: 'id',
186
+ },
187
+ })
188
+ user_favorite_locals: Local[]
189
+
190
+ @ManyToMany(() => Product)
191
+ @JoinTable({
192
+ name: 'user_favorite_product',
193
+ joinColumn: {
194
+ name: 'product',
195
+ referencedColumnName: 'id',
196
+ },
197
+ inverseJoinColumn: {
198
+ name: 'user',
199
+ referencedColumnName: 'id',
200
+ },
201
+ })
202
+ user_favorite_products: Product[]
187
203
  }
@@ -0,0 +1,81 @@
1
+ import {
2
+ Column,
3
+ Entity,
4
+ JoinColumn,
5
+ ManyToOne,
6
+ PrimaryGeneratedColumn,
7
+ } from 'typeorm'
8
+ import { City } from './City'
9
+ import { User } from './User'
10
+
11
+ @Entity('user_address', {
12
+ comment:
13
+ 'Tabla creada para agregar las direcciones del usuario.\r\n\r\nEsta tabla es útil para cuando se tenga la opción de domicilios.',
14
+ })
15
+ export class UserAddress {
16
+ @PrimaryGeneratedColumn({
17
+ comment: 'Número de identificación (ID) único de cada registro.',
18
+ })
19
+ id: number
20
+
21
+ @ManyToOne(() => User, (user) => user.addresses, {
22
+ onDelete: 'CASCADE',
23
+ onUpdate: 'NO ACTION',
24
+ })
25
+ @JoinColumn({ name: 'user' })
26
+ user: User
27
+
28
+ @ManyToOne(() => City, (city) => city.user_addresses, {
29
+ onDelete: 'RESTRICT',
30
+ onUpdate: 'NO ACTION',
31
+ })
32
+ @JoinColumn({ name: 'city' })
33
+ city: City
34
+
35
+ @Column({ length: 120, comment: 'Dirección.' })
36
+ address: string
37
+
38
+ @Column({
39
+ type: 'decimal',
40
+ precision: 10,
41
+ scale: 8,
42
+ comment: 'Latitud de la dirección.',
43
+ })
44
+ latitude: number
45
+
46
+ @Column({
47
+ type: 'decimal',
48
+ precision: 10,
49
+ scale: 8,
50
+ comment: 'Longitud de la dirección.',
51
+ })
52
+ longitude: number
53
+
54
+ @Column({
55
+ length: 400,
56
+ nullable: true,
57
+ comment:
58
+ 'Detalles de la dirección, si es una casa, un conjunto, el apartamento.',
59
+ })
60
+ details: string
61
+
62
+ @Column({
63
+ length: 20,
64
+ comment:
65
+ 'Tipo de ubicación:\r\n1. Casa.\r\n2. Oficina.\r\n3. Pareja.\r\n4. Otro.\r\n\r\nEsto me agrega un campo de tipo texto con el tag.',
66
+ })
67
+ tag: string
68
+
69
+ @Column({
70
+ comment:
71
+ 'Campo que me dice si:\r\n1. Personal: Lo recibo yo.\r\n2. Portería: Lo recibe la portería.',
72
+ })
73
+ delivery_details: number
74
+
75
+ @Column({
76
+ length: 400,
77
+ comment:
78
+ 'Campo para agregar una descripción más detallada de cómo llegar, o donde es la ubicación.',
79
+ })
80
+ description: string
81
+ }
package/src/index.ts CHANGED
@@ -44,11 +44,17 @@ export async function showEntity(entityName: string): Promise<any> {
44
44
  return connection.getRepository(entityName)
45
45
  }
46
46
 
47
- export async function callStoredProcedure(storedProcedure: string) {
48
- if (!connection) {
49
- connection = createDataBaseSource()
50
- await connection.initialize()
51
- }
47
+ export async function callStoredProcedure(storedProcedure: any) {
48
+ try {
49
+ if (!connection) {
50
+ connection = createDataBaseSource()
51
+ await connection.initialize()
52
+ }
52
53
 
53
- return await connection.query(`CALL ${storedProcedure}`)
54
+ const result = await connection.query(`CALL ${storedProcedure}`)
55
+ return result
56
+ } catch (error) {
57
+ console.error('Error calling stored procedure:', error)
58
+ throw error
59
+ }
54
60
  }
@@ -1,34 +0,0 @@
1
- import {
2
- Entity,
3
- Column,
4
- PrimaryGeneratedColumn,
5
- ManyToOne,
6
- JoinColumn,
7
- BaseEntity,
8
- } from 'typeorm'
9
- import { Role } from './Role'
10
-
11
- @Entity('role_visible_to', {
12
- comment:
13
- 'Con esta tabla validamos cuales son los roles que puede agregar a otros usuarios qué roles',
14
- })
15
- export class RoleVisibleTo {
16
- @PrimaryGeneratedColumn({
17
- comment: 'Número de identificación (ID) único de cada registro.',
18
- })
19
- id: number
20
-
21
- @ManyToOne(() => Role, (role) => role.rolesVisibleTo, {
22
- onDelete: 'CASCADE',
23
- onUpdate: 'NO ACTION',
24
- })
25
- @JoinColumn({ name: 'role' })
26
- role: Role
27
-
28
- @ManyToOne(() => Role, (role) => role.visiblesTo, {
29
- onDelete: 'CASCADE',
30
- onUpdate: 'NO ACTION',
31
- })
32
- @JoinColumn({ name: 'visible_to' })
33
- visible_to: Role
34
- }