test-entity-library-asm 3.1.8 → 3.2.0

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.
@@ -11,7 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Request = void 0;
13
13
  var typeorm_1 = require("typeorm");
14
- var Local_1 = require("./Local");
14
+ var __1 = require("..");
15
+ var dateTransformer_1 = require("../transformers/dateTransformer");
15
16
  var PaymentMethod_1 = require("./PaymentMethod");
16
17
  var RequestProduct_1 = require("./RequestProduct");
17
18
  var RequestProductGroupComplement_1 = require("./RequestProductGroupComplement");
@@ -22,82 +23,121 @@ var Request = /** @class */ (function () {
22
23
  }
23
24
  __decorate([
24
25
  (0, typeorm_1.PrimaryGeneratedColumn)({
25
- comment: 'Número de identificación (ID) único de cada registro.',
26
+ comment: "Número de identificación (ID) único de cada registro.",
26
27
  }),
27
28
  __metadata("design:type", Number)
28
29
  ], Request.prototype, "id", void 0);
29
30
  __decorate([
30
31
  (0, typeorm_1.ManyToOne)(function () { return User_1.User; }, function (user) { return user.requests; }, {
31
32
  nullable: true,
32
- onDelete: 'SET NULL',
33
- onUpdate: 'NO ACTION',
33
+ onDelete: "SET NULL",
34
+ onUpdate: "NO ACTION",
34
35
  }),
35
- (0, typeorm_1.JoinColumn)({ name: 'user' }),
36
+ (0, typeorm_1.JoinColumn)({ name: "user" }),
36
37
  __metadata("design:type", User_1.User)
37
38
  ], Request.prototype, "user", void 0);
38
39
  __decorate([
39
- (0, typeorm_1.ManyToOne)(function () { return Local_1.Local; }, function (local) { return local.requests; }, {
40
- onDelete: 'CASCADE',
41
- onUpdate: 'NO ACTION',
40
+ (0, typeorm_1.Column)({
41
+ default: 1,
42
+ comment: "Este campo hace referencia a si el tipo es:\r\n\r\n1. Individual: Un solo usuario ordena y paga.\r\n\r\n2. Grupal: El usuario principal puede agregar a otros colaboradores para realizar un pedido grupal (a tener en cuenta que el usuario principal es el único que puede realizar el pago del pedido).",
42
43
  }),
43
- (0, typeorm_1.JoinColumn)({ name: 'local' }),
44
- __metadata("design:type", Local_1.Local)
45
- ], Request.prototype, "local", void 0);
44
+ __metadata("design:type", Number)
45
+ ], Request.prototype, "order_mode", void 0);
46
46
  __decorate([
47
47
  (0, typeorm_1.Column)({
48
48
  default: 1,
49
- comment: 'Este campo hace referencia a si el tipo es:\r\n\r\n1. Individual: Un solo usuario ordena y paga.\r\n\r\n2. Grupal: El usuario principal puede agregar a otros colaboradores para realizar un pedido grupal (a tener en cuenta que el usuario principal es el único que puede realizar el pago del pedido).',
49
+ comment: "Puedo saber si el pedido es para:\r\n1. Comer en el establecimiento.\r\n2. Recoger para llevar.\r\n3. Para llevar.",
50
50
  }),
51
51
  __metadata("design:type", Number)
52
52
  ], Request.prototype, "order_type", void 0);
53
53
  __decorate([
54
54
  (0, typeorm_1.ManyToOne)(function () { return PaymentMethod_1.PaymentMethod; }, function (paymentMethod) { return paymentMethod.requests; }, {
55
- onDelete: 'RESTRICT',
56
- onUpdate: 'NO ACTION',
55
+ onDelete: "RESTRICT",
56
+ onUpdate: "NO ACTION",
57
57
  }),
58
- (0, typeorm_1.JoinColumn)({ name: 'payment_method' }),
58
+ (0, typeorm_1.JoinColumn)({ name: "payment_method" }),
59
59
  __metadata("design:type", PaymentMethod_1.PaymentMethod)
60
60
  ], Request.prototype, "payment_method", void 0);
61
61
  __decorate([
62
62
  (0, typeorm_1.Column)({
63
63
  length: 30,
64
- comment: 'Costo total del pedido, aquí toca tener en cuenta los productos (request_product) que se agreguen al pedido (request) y los complementos (request_product_group_complement).',
64
+ comment: "Costo total del pedido, aquí toca tener en cuenta los productos (request_product) que se agreguen al pedido (request) y los complementos (request_product_group_complement).",
65
65
  }),
66
66
  __metadata("design:type", String)
67
67
  ], Request.prototype, "order_cost", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)({
70
+ default: 0,
71
+ comment: "Me indica si el pedido ya está pago o falta por pagar:\r\n0. No pagado.\r\n1. Pagado.",
72
+ }),
73
+ __metadata("design:type", Number)
74
+ ], Request.prototype, "paid_status", void 0);
68
75
  __decorate([
69
76
  (0, typeorm_1.ManyToOne)(function () { return RequestStatus_1.RequestStatus; }, function (requestStatus) { return requestStatus.requests; }, {
70
- onDelete: 'RESTRICT',
71
- onUpdate: 'NO ACTION',
77
+ onDelete: "RESTRICT",
78
+ onUpdate: "NO ACTION",
72
79
  }),
73
- (0, typeorm_1.JoinColumn)({ name: 'status' }),
80
+ (0, typeorm_1.JoinColumn)({ name: "status" }),
74
81
  __metadata("design:type", RequestStatus_1.RequestStatus)
75
82
  ], Request.prototype, "status", void 0);
76
83
  __decorate([
77
84
  (0, typeorm_1.Column)({
78
85
  length: 400,
79
- comment: 'Los detalles que el usuario agrega al pedido, puede ser alguna sugerencia u otra cosa.',
86
+ comment: "Los detalles que el usuario agrega al pedido, puede ser alguna sugerencia u otra cosa.",
80
87
  }),
81
88
  __metadata("design:type", String)
82
89
  ], Request.prototype, "details", void 0);
83
90
  __decorate([
84
91
  (0, typeorm_1.Column)({
85
92
  length: 400,
86
- comment: 'Comentarios del pedido, este los realiza el cliente (local).',
93
+ comment: "Comentarios del pedido, este los realiza el cliente (local).",
87
94
  }),
88
95
  __metadata("design:type", String)
89
96
  ], Request.prototype, "comments", void 0);
90
97
  __decorate([
91
- (0, typeorm_1.ManyToMany)(function () { return User_1.User; }),
98
+ (0, typeorm_1.Column)({
99
+ type: "datetime",
100
+ transformer: new dateTransformer_1.DateTransformer(),
101
+ comment: "Fecha en la que el cliente final crea el pedido.",
102
+ }),
103
+ __metadata("design:type", Date)
104
+ ], Request.prototype, "created", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)({
107
+ type: "datetime",
108
+ transformer: new dateTransformer_1.DateTransformer(),
109
+ nullable: true,
110
+ default: null,
111
+ comment: "Fecha en la que el cliente final hace la última actualización del pedido.",
112
+ }),
113
+ __metadata("design:type", Date)
114
+ ], Request.prototype, "updated", void 0);
115
+ __decorate([
116
+ (0, typeorm_1.ManyToMany)(function () { return __1.Local; }, function (local) { return local.requests_local; }),
117
+ (0, typeorm_1.JoinTable)({
118
+ name: "request_local",
119
+ joinColumn: {
120
+ name: "request",
121
+ referencedColumnName: "id",
122
+ },
123
+ inverseJoinColumn: {
124
+ name: "local",
125
+ referencedColumnName: "id",
126
+ },
127
+ }),
128
+ __metadata("design:type", Array)
129
+ ], Request.prototype, "requests_local", void 0);
130
+ __decorate([
131
+ (0, typeorm_1.ManyToMany)(function () { return User_1.User; }, function (user) { return user.requests_group; }),
92
132
  (0, typeorm_1.JoinTable)({
93
- name: 'request_group',
133
+ name: "request_group",
94
134
  joinColumn: {
95
- name: 'user',
96
- referencedColumnName: 'id',
135
+ name: "request",
136
+ referencedColumnName: "id",
97
137
  },
98
138
  inverseJoinColumn: {
99
- name: 'request',
100
- referencedColumnName: 'id',
139
+ name: "user",
140
+ referencedColumnName: "id",
101
141
  },
102
142
  }),
103
143
  __metadata("design:type", Array)
@@ -112,7 +152,7 @@ var Request = /** @class */ (function () {
112
152
  ], Request.prototype, "request_product_group_complements", void 0);
113
153
  Request = __decorate([
114
154
  (0, typeorm_1.Entity)({
115
- comment: 'Tabla para agregar los pedidos realizados a través de la plataforma.',
155
+ comment: "Tabla para agregar los pedidos realizados através de la plataforma.",
116
156
  })
117
157
  ], Request);
118
158
  return Request;
@@ -89,9 +89,17 @@ var Square = /** @class */ (function () {
89
89
  __metadata("design:type", Array)
90
90
  ], Square.prototype, "locals", void 0);
91
91
  __decorate([
92
- (0, typeorm_1.ManyToMany)(function () { return User_1.User; }),
92
+ (0, typeorm_1.ManyToMany)(function () { return User_1.User; }, function (user) { return user.user_favorite_squares; }),
93
93
  (0, typeorm_1.JoinTable)({
94
- name: 'user_favorite_square',
94
+ name: "user_favorite_square",
95
+ joinColumn: {
96
+ name: "square",
97
+ referencedColumnName: "id",
98
+ },
99
+ inverseJoinColumn: {
100
+ name: "user",
101
+ referencedColumnName: "id",
102
+ },
95
103
  }),
96
104
  __metadata("design:type", Array)
97
105
  ], Square.prototype, "users_favorite_square", void 0);
@@ -1,14 +1,14 @@
1
- import { City } from './City';
2
- import { CodeRedemptionHistoryUser } from './CodeRedemptionHistoryUser';
3
- import { LocalQualification } from './LocalQualification';
4
- import { Request } from './Request';
5
- import { RequestProduct } from './RequestProduct';
6
- import { RequestProductGroupComplement } from './RequestProductGroupComplement';
7
- import { UserAddress } from './UserAddress';
8
- import { PaymentMethod } from './PaymentMethod';
9
- import { Square } from './Square';
10
- import { Local } from './Local';
11
- import { Product } from './Product';
1
+ import { City } from "./City";
2
+ import { CodeRedemptionHistoryUser } from "./CodeRedemptionHistoryUser";
3
+ import { LocalQualification } from "./LocalQualification";
4
+ import { Request } from "./Request";
5
+ import { RequestProduct } from "./RequestProduct";
6
+ import { RequestProductGroupComplement } from "./RequestProductGroupComplement";
7
+ import { UserAddress } from "./UserAddress";
8
+ import { PaymentMethod } from "./PaymentMethod";
9
+ import { Square } from "./Square";
10
+ import { Local } from "./Local";
11
+ import { Product } from "./Product";
12
12
  export declare class User {
13
13
  id: number;
14
14
  code: string;
@@ -27,35 +27,35 @@ var User = /** @class */ (function () {
27
27
  }
28
28
  __decorate([
29
29
  (0, typeorm_1.PrimaryGeneratedColumn)({
30
- comment: 'Número de identificación (ID) único de cada registro.',
30
+ comment: "Número de identificación (ID) único de cada registro.",
31
31
  }),
32
32
  __metadata("design:type", Number)
33
33
  ], User.prototype, "id", void 0);
34
34
  __decorate([
35
- (0, typeorm_1.Column)({ length: 30, unique: true, comment: 'Código único del usuario.' }),
35
+ (0, typeorm_1.Column)({ length: 30, unique: true, comment: "Código único del usuario." }),
36
36
  __metadata("design:type", String)
37
37
  ], User.prototype, "code", void 0);
38
38
  __decorate([
39
39
  (0, typeorm_1.Column)({
40
40
  length: 14,
41
41
  unique: true,
42
- comment: 'Número de documento del usuario.',
42
+ comment: "Número de documento del usuario.",
43
43
  }),
44
44
  __metadata("design:type", String)
45
45
  ], User.prototype, "document", void 0);
46
46
  __decorate([
47
- (0, typeorm_1.Column)({ length: 50, comment: 'Nombre del usuario.' }),
47
+ (0, typeorm_1.Column)({ length: 50, comment: "Nombre del usuario." }),
48
48
  __metadata("design:type", String)
49
49
  ], User.prototype, "name", void 0);
50
50
  __decorate([
51
- (0, typeorm_1.Column)({ length: 50, comment: 'Apellidos del usuario.' }),
51
+ (0, typeorm_1.Column)({ length: 50, comment: "Apellidos del usuario." }),
52
52
  __metadata("design:type", String)
53
53
  ], User.prototype, "surname", void 0);
54
54
  __decorate([
55
55
  (0, typeorm_1.Column)({
56
56
  length: 60,
57
57
  unique: true,
58
- comment: 'Correo electrónico del usuario.',
58
+ comment: "Correo electrónico del usuario.",
59
59
  }),
60
60
  __metadata("design:type", String)
61
61
  ], User.prototype, "email", void 0);
@@ -63,52 +63,52 @@ var User = /** @class */ (function () {
63
63
  (0, typeorm_1.Column)({
64
64
  length: 12,
65
65
  unique: true,
66
- comment: 'Número de celular del usuario.',
66
+ comment: "Número de celular del usuario.",
67
67
  }),
68
68
  __metadata("design:type", String)
69
69
  ], User.prototype, "phone", void 0);
70
70
  __decorate([
71
71
  (0, typeorm_1.ManyToOne)(function () { return City_1.City; }, function (city) { return city.users; }, {
72
- onDelete: 'RESTRICT',
73
- onUpdate: 'NO ACTION',
72
+ onDelete: "RESTRICT",
73
+ onUpdate: "NO ACTION",
74
74
  }),
75
- (0, typeorm_1.JoinColumn)({ name: 'city' }),
75
+ (0, typeorm_1.JoinColumn)({ name: "city" }),
76
76
  __metadata("design:type", City_1.City)
77
77
  ], User.prototype, "city", void 0);
78
78
  __decorate([
79
79
  (0, typeorm_1.Column)({
80
80
  length: 255,
81
- comment: 'Contraseña almacenada tipo SHA256 del usuario.',
81
+ comment: "Contraseña almacenada tipo SHA256 del usuario.",
82
82
  }),
83
83
  __metadata("design:type", String)
84
84
  ], User.prototype, "password", void 0);
85
85
  __decorate([
86
86
  (0, typeorm_1.Column)({
87
- type: 'longtext',
87
+ type: "longtext",
88
88
  nullable: true,
89
- comment: 'Campo de tipo JSON donde se guarda información necesaria para el registro.',
89
+ comment: "Campo de tipo JSON donde se guarda información necesaria para el registro.",
90
90
  }),
91
91
  __metadata("design:type", String)
92
92
  ], User.prototype, "profile", void 0);
93
93
  __decorate([
94
- (0, typeorm_1.Column)({ type: 'datetime', comment: 'Fecha de creación del registro.' }),
94
+ (0, typeorm_1.Column)({ type: "datetime", comment: "Fecha de creación del registro." }),
95
95
  __metadata("design:type", Date)
96
96
  ], User.prototype, "created", void 0);
97
97
  __decorate([
98
- (0, typeorm_1.Column)({ type: 'datetime', comment: 'Fecha de actualización del registro.' }),
98
+ (0, typeorm_1.Column)({ type: "datetime", comment: "Fecha de actualización del registro." }),
99
99
  __metadata("design:type", Date)
100
100
  ], User.prototype, "updated", void 0);
101
101
  __decorate([
102
102
  (0, typeorm_1.Column)({
103
103
  default: 1,
104
- comment: '¿El usuario tiene acceso a la plataforma?:\r\n1. Activo: El usuario tiene acceso.\r\n0. Inactivo: El usuario no tiene acceso a la plataforma.',
104
+ comment: "¿El usuario tiene acceso a la plataforma?:\r\n1. Activo: El usuario tiene acceso.\r\n0. Inactivo: El usuario no tiene acceso a la plataforma.",
105
105
  }),
106
106
  __metadata("design:type", Number)
107
107
  ], User.prototype, "status", void 0);
108
108
  __decorate([
109
109
  (0, typeorm_1.Column)({
110
110
  default: 1,
111
- comment: 'Es el estado para verificar si se envia en la papelara o no.',
111
+ comment: "Es el estado para verificar si se envia en la papelara o no.",
112
112
  }),
113
113
  __metadata("design:type", Number)
114
114
  ], User.prototype, "visible", void 0);
@@ -125,9 +125,17 @@ var User = /** @class */ (function () {
125
125
  __metadata("design:type", Array)
126
126
  ], User.prototype, "requests", void 0);
127
127
  __decorate([
128
- (0, typeorm_1.ManyToMany)(function () { return Request_1.Request; }),
128
+ (0, typeorm_1.ManyToMany)(function () { return Request_1.Request; }, function (request) { return request.requests_group; }),
129
129
  (0, typeorm_1.JoinTable)({
130
- name: 'request_group',
130
+ name: "request_group",
131
+ joinColumn: {
132
+ name: "user",
133
+ referencedColumnName: "id",
134
+ },
135
+ inverseJoinColumn: {
136
+ name: "request",
137
+ referencedColumnName: "id",
138
+ },
131
139
  }),
132
140
  __metadata("design:type", Array)
133
141
  ], User.prototype, "requests_group", void 0);
@@ -144,67 +152,67 @@ var User = /** @class */ (function () {
144
152
  __metadata("design:type", Array)
145
153
  ], User.prototype, "addresses", void 0);
146
154
  __decorate([
147
- (0, typeorm_1.ManyToMany)(function () { return PaymentMethod_1.PaymentMethod; }),
155
+ (0, typeorm_1.ManyToMany)(function () { return PaymentMethod_1.PaymentMethod; }, function (paymentMethod) { return paymentMethod.user_payments_method; }),
148
156
  (0, typeorm_1.JoinTable)({
149
- name: 'user_payment_method',
157
+ name: "user_payment_method",
150
158
  joinColumn: {
151
- name: 'payment_method',
152
- referencedColumnName: 'id',
159
+ name: "user",
160
+ referencedColumnName: "id",
153
161
  },
154
162
  inverseJoinColumn: {
155
- name: 'user',
156
- referencedColumnName: 'id',
163
+ name: "payment_method",
164
+ referencedColumnName: "id",
157
165
  },
158
166
  }),
159
167
  __metadata("design:type", Array)
160
168
  ], User.prototype, "user_payments_method", void 0);
161
169
  __decorate([
162
- (0, typeorm_1.ManyToMany)(function () { return Square_1.Square; }),
170
+ (0, typeorm_1.ManyToMany)(function () { return Square_1.Square; }, function (square) { return square.users_favorite_square; }),
163
171
  (0, typeorm_1.JoinTable)({
164
- name: 'user_favorite_square',
172
+ name: "user_favorite_square",
165
173
  joinColumn: {
166
- name: 'square',
167
- referencedColumnName: 'id',
174
+ name: "user",
175
+ referencedColumnName: "id",
168
176
  },
169
177
  inverseJoinColumn: {
170
- name: 'user',
171
- referencedColumnName: 'id',
178
+ name: "square",
179
+ referencedColumnName: "id",
172
180
  },
173
181
  }),
174
182
  __metadata("design:type", Array)
175
183
  ], User.prototype, "user_favorite_squares", void 0);
176
184
  __decorate([
177
- (0, typeorm_1.ManyToMany)(function () { return Local_1.Local; }),
185
+ (0, typeorm_1.ManyToMany)(function () { return Local_1.Local; }, function (local) { return local.users_favorite_local; }),
178
186
  (0, typeorm_1.JoinTable)({
179
- name: 'user_favorite_local',
187
+ name: "user_favorite_local",
180
188
  joinColumn: {
181
- name: 'local',
182
- referencedColumnName: 'id',
189
+ name: "user",
190
+ referencedColumnName: "id",
183
191
  },
184
192
  inverseJoinColumn: {
185
- name: 'user',
186
- referencedColumnName: 'id',
193
+ name: "local",
194
+ referencedColumnName: "id",
187
195
  },
188
196
  }),
189
197
  __metadata("design:type", Array)
190
198
  ], User.prototype, "user_favorite_locals", void 0);
191
199
  __decorate([
192
- (0, typeorm_1.ManyToMany)(function () { return Product_1.Product; }),
200
+ (0, typeorm_1.ManyToMany)(function () { return Product_1.Product; }, function (product) { return product.users_favorite_product; }),
193
201
  (0, typeorm_1.JoinTable)({
194
- name: 'user_favorite_product',
202
+ name: "user_favorite_product",
195
203
  joinColumn: {
196
- name: 'product',
197
- referencedColumnName: 'id',
204
+ name: "user",
205
+ referencedColumnName: "id",
198
206
  },
199
207
  inverseJoinColumn: {
200
- name: 'user',
201
- referencedColumnName: 'id',
208
+ name: "product",
209
+ referencedColumnName: "id",
202
210
  },
203
211
  }),
204
212
  __metadata("design:type", Array)
205
213
  ], User.prototype, "user_favorite_products", void 0);
206
214
  User = __decorate([
207
- (0, typeorm_1.Entity)({ comment: 'Usuarios registrados en la plataforma.' })
215
+ (0, typeorm_1.Entity)({ comment: "Usuarios registrados en la plataforma." })
208
216
  ], User);
209
217
  return User;
210
218
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.1.8",
3
+ "version": "3.2.0",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -6,64 +6,64 @@ import {
6
6
  ManyToMany,
7
7
  ManyToOne,
8
8
  PrimaryGeneratedColumn,
9
- } from 'typeorm'
10
- import { Local } from '..'
11
- import { BusinessType } from './BusinessType'
9
+ } from "typeorm";
10
+ import { Local } from "..";
11
+ import { BusinessType } from "./BusinessType";
12
12
 
13
- @Entity('business_type_product', {
13
+ @Entity("business_type_product", {
14
14
  comment:
15
- 'Tabla para agregar los productos qué el local va tener por el tipo de negocio.',
15
+ "Tabla para agregar los productos qué el local va tener por el tipo de negocio.",
16
16
  })
17
17
  export class BusinessTypeProduct {
18
18
  @PrimaryGeneratedColumn({
19
- comment: 'Número de identificación (ID) único de cada registro.',
19
+ comment: "Número de identificación (ID) único de cada registro.",
20
20
  })
21
- id: number
21
+ id: number;
22
22
 
23
23
  @ManyToOne(
24
24
  () => BusinessType,
25
25
  (businessType) => businessType.business_types_product,
26
26
  {
27
- onDelete: 'RESTRICT',
28
- onUpdate: 'NO ACTION',
27
+ onDelete: "RESTRICT",
28
+ onUpdate: "NO ACTION",
29
29
  nullable: true,
30
30
  }
31
31
  )
32
- @JoinColumn({ name: 'business_type' })
33
- business_type: BusinessType
32
+ @JoinColumn({ name: "business_type" })
33
+ business_type: BusinessType;
34
34
 
35
35
  @Column({
36
36
  length: 40,
37
37
  comment:
38
- 'ID de la variable que se encuentra en los archivos `locales` para el multilenguaje.',
38
+ "ID de la variable que se encuentra en los archivos `locales` para el multilenguaje.",
39
39
  })
40
- name: string
40
+ name: string;
41
41
 
42
42
  @Column({
43
43
  length: 500,
44
44
  nullable: true,
45
- comment: 'Imagen para el tipo de comida.',
45
+ comment: "Imagen para el tipo de comida.",
46
46
  })
47
- photo: string
47
+ photo: string;
48
48
 
49
49
  @Column({
50
50
  default: 1,
51
51
  comment:
52
- 'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
52
+ "Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.",
53
53
  })
54
- status: number
54
+ status: number;
55
55
 
56
- @ManyToMany(() => Local)
56
+ @ManyToMany(() => Local, (local) => local.business_type_products)
57
57
  @JoinTable({
58
- name: 'business_type_product_local',
58
+ name: "business_type_product_local",
59
59
  joinColumn: {
60
- name: 'business_type_product',
61
- referencedColumnName: 'id',
60
+ name: "business_type_product",
61
+ referencedColumnName: "id",
62
62
  },
63
63
  inverseJoinColumn: {
64
- name: 'local',
65
- referencedColumnName: 'id',
64
+ name: "local",
65
+ referencedColumnName: "id",
66
66
  },
67
67
  })
68
- business_type_products: Local[]
68
+ business_type_products: Local[];
69
69
  }
@@ -8,7 +8,7 @@ import {
8
8
  OneToMany,
9
9
  PrimaryGeneratedColumn,
10
10
  } from "typeorm";
11
- import { DiscountCodeUser, LocalPlan, PosSystem } from "..";
11
+ import { DiscountCodeUser, LocalPlan, PosSystem, Request } from "..";
12
12
  import { jsonTransformer } from "../transformers/jsonTransformer";
13
13
  import { BusinessTypeProduct } from "./BusinessTypeProduct";
14
14
  import { Category } from "./Category";
@@ -17,9 +17,9 @@ import { Company } from "./Company";
17
17
  import { LocalQualification } from "./LocalQualification";
18
18
  import { Partner } from "./Partner";
19
19
  import { PaymentMethod } from "./PaymentMethod";
20
- import { Request } from "./Request";
21
20
  import { Square } from "./Square";
22
21
  import { User } from "./User";
22
+ import { DateTransformer } from "../transformers/dateTransformer";
23
23
 
24
24
  @Entity({ comment: "Locales disponibles de las empresas (company)." })
25
25
  export class Local {
@@ -63,10 +63,10 @@ export class Local {
63
63
  })
64
64
  details: any;
65
65
 
66
- @Column({ type: "datetime" })
66
+ @Column({ type: "datetime", transformer: new DateTransformer() })
67
67
  created: Date;
68
68
 
69
- @Column({ type: "datetime" })
69
+ @Column({ type: "datetime", transformer: new DateTransformer() })
70
70
  updated: Date;
71
71
 
72
72
  @ManyToOne(() => Partner, (partner) => partner.locals, {
@@ -126,12 +126,34 @@ export class Local {
126
126
  })
127
127
  locals_partners: Partner[];
128
128
 
129
+ @ManyToMany(() => Request, (request) => request.requests_local)
130
+ @JoinTable({
131
+ name: "request_local",
132
+ joinColumn: {
133
+ name: "local",
134
+ referencedColumnName: "id",
135
+ },
136
+ inverseJoinColumn: {
137
+ name: "request",
138
+ referencedColumnName: "id",
139
+ },
140
+ })
141
+ requests_local: Request[];
142
+
129
143
  @OneToMany(() => Category, (category) => category.local)
130
144
  categories: Category[];
131
145
 
132
- @ManyToMany(() => PaymentMethod)
146
+ @ManyToMany(() => PaymentMethod, (paymentMethod) => paymentMethod.locals)
133
147
  @JoinTable({
134
148
  name: "local_payment_method",
149
+ joinColumn: {
150
+ name: "local",
151
+ referencedColumnName: "id",
152
+ },
153
+ inverseJoinColumn: {
154
+ name: "payment_method",
155
+ referencedColumnName: "id",
156
+ },
135
157
  })
136
158
  payment_methods: PaymentMethod[];
137
159
 
@@ -141,16 +163,24 @@ export class Local {
141
163
  )
142
164
  qualifications: LocalQualification[];
143
165
 
144
- @OneToMany(() => Request, (request) => request.local)
145
- requests: Request[];
146
-
147
- @ManyToMany(() => User)
166
+ @ManyToMany(() => User, (user) => user.user_favorite_locals)
148
167
  @JoinTable({
149
168
  name: "user_favorite_local",
169
+ joinColumn: {
170
+ name: "local",
171
+ referencedColumnName: "id",
172
+ },
173
+ inverseJoinColumn: {
174
+ name: "user",
175
+ referencedColumnName: "id",
176
+ },
150
177
  })
151
178
  users_favorite_local: User[];
152
179
 
153
- @ManyToMany(() => BusinessTypeProduct)
180
+ @ManyToMany(
181
+ () => BusinessTypeProduct,
182
+ (businessTypeProduct) => businessTypeProduct.business_type_products
183
+ )
154
184
  @JoinTable({
155
185
  name: "business_type_product_local",
156
186
  joinColumn: {