test-entity-library-asm 3.9.36 → 3.9.38

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.
@@ -1,4 +1,4 @@
1
- import { DiscountCodeUser, Gallery, LocalDecorationReserve, LocalPaymentMethod, LocalPlan, LocalReserveStatus, LocalTable, LocalTableZone, PosSystem, ReceiptConfig, RequestInvoice, RequestLocal } from "..";
1
+ import { DiscountCodeUser, Gallery, LocalDecorationReserve, LocalPaymentMethod, LocalPlan, LocalReserveStatus, LocalTable, LocalTableZone, Master, PosSystem, ReceiptConfig, RequestInvoice, RequestLocal } from "..";
2
2
  import { BusinessTypeProduct } from "./BusinessTypeProduct";
3
3
  import { Category } from "./Category";
4
4
  import { City } from "./City";
@@ -10,6 +10,7 @@ import { Square } from "./Square";
10
10
  import { User } from "./User";
11
11
  export declare class Local {
12
12
  id: number;
13
+ code: string;
13
14
  company: Company;
14
15
  name: string;
15
16
  city: City;
@@ -17,14 +18,21 @@ export declare class Local {
17
18
  latitude: number;
18
19
  longitude: number;
19
20
  details: any | null;
21
+ changes: any | null;
20
22
  created: Date;
21
- updated: Date;
22
- updated_by: Partner;
23
+ updated: Date | null;
24
+ updated_by: Partner | null;
23
25
  square: Square;
24
26
  pos_system: PosSystem;
25
27
  pos_system_settings: any | null;
26
28
  status: number;
27
29
  visible: number;
30
+ contact_details: any | null;
31
+ review_status: number;
32
+ operation_type: number;
33
+ reviewed_by: Master | null;
34
+ review_date: Date | null;
35
+ review_comments: string | null;
28
36
  locals_partners: Partner[];
29
37
  requests_local: RequestLocal[];
30
38
  categories: Category[];
@@ -32,6 +32,15 @@ __decorate([
32
32
  }),
33
33
  __metadata("design:type", Number)
34
34
  ], Local.prototype, "id", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({
37
+ length: 10,
38
+ type: "varchar",
39
+ unique: true,
40
+ comment: "Código único de 10 caracteres por cada registro.",
41
+ }),
42
+ __metadata("design:type", String)
43
+ ], Local.prototype, "code", void 0);
35
44
  __decorate([
36
45
  (0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.locals, {
37
46
  onDelete: "CASCADE",
@@ -74,6 +83,16 @@ __decorate([
74
83
  }),
75
84
  __metadata("design:type", Object)
76
85
  ], Local.prototype, "details", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.Column)({
88
+ type: "longtext",
89
+ nullable: true,
90
+ default: null,
91
+ transformer: jsonTransformer_1.jsonTransformer,
92
+ comment: "Columna para almacenar los cambios que se le hacen al registro. \nSe almacena todo el formik, con esto simplemente cuando estemos editando se usa esta variable y no tenemos que construir la información.",
93
+ }),
94
+ __metadata("design:type", Object)
95
+ ], Local.prototype, "changes", void 0);
77
96
  __decorate([
78
97
  (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP" }),
79
98
  __metadata("design:type", Date)
@@ -81,18 +100,20 @@ __decorate([
81
100
  __decorate([
82
101
  (0, typeorm_1.Column)({
83
102
  type: "datetime",
84
- default: () => "CURRENT_TIMESTAMP",
85
103
  onUpdate: "CURRENT_TIMESTAMP",
104
+ nullable: true,
105
+ default: null,
86
106
  }),
87
- __metadata("design:type", Date)
107
+ __metadata("design:type", Object)
88
108
  ], Local.prototype, "updated", void 0);
89
109
  __decorate([
90
110
  (0, typeorm_1.ManyToOne)(() => Partner_1.Partner, (partner) => partner.locals, {
91
111
  onDelete: "NO ACTION",
92
112
  onUpdate: "NO ACTION",
113
+ nullable: true,
93
114
  }),
94
115
  (0, typeorm_1.JoinColumn)({ name: "updated_by" }),
95
- __metadata("design:type", Partner_1.Partner)
116
+ __metadata("design:type", Object)
96
117
  ], Local.prototype, "updated_by", void 0);
97
118
  __decorate([
98
119
  (0, typeorm_1.ManyToOne)(() => Square_1.Square, (square) => square.locals, {
@@ -138,6 +159,57 @@ __decorate([
138
159
  }),
139
160
  __metadata("design:type", Number)
140
161
  ], Local.prototype, "visible", void 0);
162
+ __decorate([
163
+ (0, typeorm_1.Column)({
164
+ type: "text",
165
+ nullable: true,
166
+ default: null,
167
+ transformer: jsonTransformer_1.jsonTransformer,
168
+ }),
169
+ __metadata("design:type", Object)
170
+ ], Local.prototype, "contact_details", void 0);
171
+ __decorate([
172
+ (0, typeorm_1.Column)({
173
+ type: "int",
174
+ nullable: true,
175
+ default: null,
176
+ width: 1,
177
+ comment: "Estado en el que se encuentra la revisión de los nuevos cambios.\n1: Pendiente de revisión:Estado para decirle al usuario que los cambios se encuentran en revisión.\n2: Aprobado: Los cambios se encuentran aprobados.\n3: Rechazado: Los cambios se rechazaron por algún problema en los datos.",
178
+ }),
179
+ __metadata("design:type", Number)
180
+ ], Local.prototype, "review_status", void 0);
181
+ __decorate([
182
+ (0, typeorm_1.Column)({
183
+ type: "int",
184
+ nullable: true,
185
+ default: null,
186
+ width: 1,
187
+ comment: "Columna para guardar el tipo de operación del registro.\n1: Creación: Cuando se crea por primera vez el registro.\n2: Edición: Cuando se está editando información del local.",
188
+ }),
189
+ __metadata("design:type", Number)
190
+ ], Local.prototype, "operation_type", void 0);
191
+ __decorate([
192
+ (0, typeorm_1.ManyToOne)(() => __1.Master, (master) => master.locals_reviewed, {
193
+ onDelete: "NO ACTION",
194
+ onUpdate: "NO ACTION",
195
+ nullable: true,
196
+ }),
197
+ (0, typeorm_1.JoinColumn)({ name: "reviewed_by" }),
198
+ __metadata("design:type", Object)
199
+ ], Local.prototype, "reviewed_by", void 0);
200
+ __decorate([
201
+ (0, typeorm_1.Column)({
202
+ type: "datetime",
203
+ nullable: true,
204
+ default: null,
205
+ comment: "Fecha de revisión de los cambios realizados por el usuario.",
206
+ }),
207
+ __metadata("design:type", Object)
208
+ ], Local.prototype, "review_date", void 0);
209
+ __decorate([
210
+ (0, typeorm_1.Column)({ type: "varchar", length: 300, nullable: true, default: null }),
211
+ __metadata("design:type", Object)
212
+ ], Local.prototype, "review_comments", void 0);
141
213
  __decorate([
142
214
  (0, typeorm_1.ManyToMany)(() => Partner_1.Partner, (partner) => partner.locals_partner),
143
215
  (0, typeorm_1.JoinTable)({
@@ -1,4 +1,4 @@
1
- import { MasterNotification, MasterSession, PartnerNotification, VerifyLocal } from "..";
1
+ import { Local, MasterNotification, MasterSession, PartnerNotification, VerifyLocal } from "..";
2
2
  import { City } from "./City";
3
3
  import { DiscountCodeCompany } from "./DiscountCodeCompany";
4
4
  import { MasterRole } from "./MasterRole";
@@ -26,4 +26,5 @@ export declare class Master {
26
26
  masters_to_notification: MasterNotification[];
27
27
  masters_notification: PartnerNotification[];
28
28
  masters_session: MasterSession[];
29
+ locals_reviewed: Local[];
29
30
  }
@@ -207,6 +207,10 @@ __decorate([
207
207
  (0, typeorm_1.OneToMany)(() => __1.MasterSession, (MasterSession) => MasterSession.master),
208
208
  __metadata("design:type", Array)
209
209
  ], Master.prototype, "masters_session", void 0);
210
+ __decorate([
211
+ (0, typeorm_1.OneToMany)(() => __1.Local, (local) => local.reviewed_by),
212
+ __metadata("design:type", Array)
213
+ ], Master.prototype, "locals_reviewed", void 0);
210
214
  exports.Master = Master = __decorate([
211
215
  (0, typeorm_1.Entity)({
212
216
  comment: "Tabla agregada para los usuarios qué son administradores de la plataforma.",
@@ -1,6 +1,6 @@
1
1
  import { Repository } from "typeorm";
2
2
  import { IBasicCompany } from "../interfaces";
3
- export declare function getLocalsCompanyInformation(repository: Repository<any>, { company, status, visible, lazyEvent }: IBasicCompany): Promise<{
3
+ export declare function getLocalsCompanyInformation(repository: Repository<any>, { company, status, visible, lazyEvent, filter_visualization, }: IBasicCompany): Promise<{
4
4
  data: any[];
5
5
  totalRecords: number;
6
6
  }>;
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLocalsCompanyInformation = void 0;
4
- // import { getTimeZone, getTimezoneOffset } from "..";
5
- async function getLocalsCompanyInformation(repository, { company, status, visible, lazyEvent }) {
4
+ async function getLocalsCompanyInformation(repository, { company, status, visible, lazyEvent, filter_visualization = "no-in-review-rejected", }) {
6
5
  try {
7
- // const timezone = getTimezoneOffset(getTimeZone());
8
- console.log(lazyEvent, "LazyEvent en el filtro");
9
6
  const queryBuilder = repository
10
7
  .createQueryBuilder("locals_company_information_for_the_table")
11
8
  .skip(lazyEvent.first)
@@ -33,6 +30,15 @@ async function getLocalsCompanyInformation(repository, { company, status, visibl
33
30
  visible,
34
31
  });
35
32
  }
33
+ // DOC: la columna filter_visualization se utiliza para aplicar el filtro review_status y operation_type.
34
+ // DOC: Si filter_visualization es "in-review-rejected", se muestran los locales que están en revisión o rechazados, es decir, review_status = 1 o 3 y operation_type = 1 o 2.
35
+ // DOC: Si filter_visualization es "no-in-review-rejected", se muestran los locales que no están en revisión ni rechazados, es decir, review_status es null y operation_type es null.
36
+ if (filter_visualization === "in-review-rejected") {
37
+ queryBuilder.andWhere("(locals_company_information_for_the_table.review_status IN (1, 3) AND locals_company_information_for_the_table.operation_type IN (1, 2))");
38
+ }
39
+ else if (filter_visualization === "no-in-review-rejected") {
40
+ queryBuilder.andWhere("(locals_company_information_for_the_table.review_status IS NULL AND locals_company_information_for_the_table.operation_type IS NULL)");
41
+ }
36
42
  // DOC: Acá vienen los otros filtros, por las columnas de la tabla.
37
43
  const filters = lazyEvent.filters;
38
44
  Object.keys(filters).forEach((key) => {
@@ -28,6 +28,7 @@ export interface IBasicCompany extends IBasicLazyEvent {
28
28
  company: number | null;
29
29
  visible?: number | null;
30
30
  owner?: number | null;
31
+ filter_visualization: TLocalsCompanyTypeVisualization;
31
32
  }
32
33
  export interface IPropsQueryVerifyLocalInformation extends IPropsQueryVerifyLocal {
33
34
  partner: number | null;
@@ -64,4 +65,5 @@ export interface IPropsLocalReserve {
64
65
  status: number | null;
65
66
  local: number | null;
66
67
  }
68
+ export type TLocalsCompanyTypeVisualization = "in-review-rejected" | "no-in-review-rejected";
67
69
  export type IType = "mysql" | "mariadb";
@@ -7,6 +7,7 @@ export declare class LocalsCompanyInformationForTheMap {
7
7
  latitude: number;
8
8
  longitude: number;
9
9
  details: any | null;
10
+ changes: any | null;
10
11
  created: Date;
11
12
  updated: Date;
12
13
  updated_by: number;
@@ -16,6 +17,8 @@ export declare class LocalsCompanyInformationForTheMap {
16
17
  status: number;
17
18
  visible: number;
18
19
  contact_details: any | null;
20
+ review_status: number;
21
+ operation_type: number;
19
22
  company_code: string;
20
23
  company_name: string;
21
24
  company_partner: number;
@@ -58,6 +58,10 @@ __decorate([
58
58
  (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
59
59
  __metadata("design:type", Object)
60
60
  ], LocalsCompanyInformationForTheMap.prototype, "details", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
63
+ __metadata("design:type", Object)
64
+ ], LocalsCompanyInformationForTheMap.prototype, "changes", void 0);
61
65
  __decorate([
62
66
  (0, typeorm_1.ViewColumn)(),
63
67
  __metadata("design:type", Date)
@@ -94,6 +98,14 @@ __decorate([
94
98
  (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
95
99
  __metadata("design:type", Object)
96
100
  ], LocalsCompanyInformationForTheMap.prototype, "contact_details", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.ViewColumn)(),
103
+ __metadata("design:type", Number)
104
+ ], LocalsCompanyInformationForTheMap.prototype, "review_status", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.ViewColumn)(),
107
+ __metadata("design:type", Number)
108
+ ], LocalsCompanyInformationForTheMap.prototype, "operation_type", void 0);
97
109
  __decorate([
98
110
  (0, typeorm_1.ViewColumn)(),
99
111
  __metadata("design:type", String)
@@ -1,5 +1,6 @@
1
1
  export declare class LocalsCompanyInformationForTheTable {
2
2
  id: number;
3
+ code: string;
3
4
  company: number;
4
5
  name: string;
5
6
  city: number;
@@ -7,15 +8,21 @@ export declare class LocalsCompanyInformationForTheTable {
7
8
  latitude: number;
8
9
  longitude: number;
9
10
  details: any | null;
11
+ changes: any | null;
10
12
  created: Date;
11
- updated: Date;
12
- updated_by: number;
13
+ updated: Date | null;
14
+ updated_by: number | null;
13
15
  square: number | null;
14
16
  pos_system: number;
15
17
  pos_system_settings: any | null;
16
18
  status: number;
17
19
  visible: number;
18
20
  contact_details: any | null;
21
+ review_status: number;
22
+ operation_type: number;
23
+ reviewed_by: number | null;
24
+ review_date: Date | null;
25
+ review_comments: string;
19
26
  type_local: string;
20
27
  address_local: string;
21
28
  company_id: number;
@@ -62,6 +69,21 @@ export declare class LocalsCompanyInformationForTheTable {
62
69
  partner_visible: number;
63
70
  partner_created: Date;
64
71
  partner_updated: Date;
72
+ master_reviewed_id: number;
73
+ master_reviewed_code: string;
74
+ master_reviewed_document: string | null;
75
+ master_reviewed_name: string;
76
+ master_reviewed_surname: string;
77
+ master_reviewed_full_name: string;
78
+ master_reviewed_email: string;
79
+ master_reviewed_phone: string | null;
80
+ master_reviewed_city: number;
81
+ master_reviewed_address: string | null;
82
+ master_reviewed_profile: any | null;
83
+ master_reviewed_created: Date;
84
+ master_reviewed_updated: Date | null;
85
+ master_reviewed_status: number;
86
+ master_reviewed_visible: number;
65
87
  square_id: number;
66
88
  square_details: any | null;
67
89
  square_email: string | null;
@@ -30,6 +30,10 @@ __decorate([
30
30
  (0, typeorm_1.ViewColumn)(),
31
31
  __metadata("design:type", Number)
32
32
  ], LocalsCompanyInformationForTheTable.prototype, "id", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.ViewColumn)(),
35
+ __metadata("design:type", String)
36
+ ], LocalsCompanyInformationForTheTable.prototype, "code", void 0);
33
37
  __decorate([
34
38
  (0, typeorm_1.ViewColumn)(),
35
39
  __metadata("design:type", Number)
@@ -58,17 +62,21 @@ __decorate([
58
62
  (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
59
63
  __metadata("design:type", Object)
60
64
  ], LocalsCompanyInformationForTheTable.prototype, "details", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
67
+ __metadata("design:type", Object)
68
+ ], LocalsCompanyInformationForTheTable.prototype, "changes", void 0);
61
69
  __decorate([
62
70
  (0, typeorm_1.ViewColumn)(),
63
71
  __metadata("design:type", Date)
64
72
  ], LocalsCompanyInformationForTheTable.prototype, "created", void 0);
65
73
  __decorate([
66
74
  (0, typeorm_1.ViewColumn)(),
67
- __metadata("design:type", Date)
75
+ __metadata("design:type", Object)
68
76
  ], LocalsCompanyInformationForTheTable.prototype, "updated", void 0);
69
77
  __decorate([
70
78
  (0, typeorm_1.ViewColumn)(),
71
- __metadata("design:type", Number)
79
+ __metadata("design:type", Object)
72
80
  ], LocalsCompanyInformationForTheTable.prototype, "updated_by", void 0);
73
81
  __decorate([
74
82
  (0, typeorm_1.ViewColumn)(),
@@ -94,6 +102,26 @@ __decorate([
94
102
  (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
95
103
  __metadata("design:type", Object)
96
104
  ], LocalsCompanyInformationForTheTable.prototype, "contact_details", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.ViewColumn)(),
107
+ __metadata("design:type", Number)
108
+ ], LocalsCompanyInformationForTheTable.prototype, "review_status", void 0);
109
+ __decorate([
110
+ (0, typeorm_1.ViewColumn)(),
111
+ __metadata("design:type", Number)
112
+ ], LocalsCompanyInformationForTheTable.prototype, "operation_type", void 0);
113
+ __decorate([
114
+ (0, typeorm_1.ViewColumn)(),
115
+ __metadata("design:type", Object)
116
+ ], LocalsCompanyInformationForTheTable.prototype, "reviewed_by", void 0);
117
+ __decorate([
118
+ (0, typeorm_1.ViewColumn)(),
119
+ __metadata("design:type", Object)
120
+ ], LocalsCompanyInformationForTheTable.prototype, "review_date", void 0);
121
+ __decorate([
122
+ (0, typeorm_1.ViewColumn)(),
123
+ __metadata("design:type", String)
124
+ ], LocalsCompanyInformationForTheTable.prototype, "review_comments", void 0);
97
125
  __decorate([
98
126
  (0, typeorm_1.ViewColumn)(),
99
127
  __metadata("design:type", String)
@@ -278,6 +306,66 @@ __decorate([
278
306
  (0, typeorm_1.ViewColumn)(),
279
307
  __metadata("design:type", Date)
280
308
  ], LocalsCompanyInformationForTheTable.prototype, "partner_updated", void 0);
309
+ __decorate([
310
+ (0, typeorm_1.ViewColumn)(),
311
+ __metadata("design:type", Number)
312
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_id", void 0);
313
+ __decorate([
314
+ (0, typeorm_1.ViewColumn)(),
315
+ __metadata("design:type", String)
316
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_code", void 0);
317
+ __decorate([
318
+ (0, typeorm_1.ViewColumn)(),
319
+ __metadata("design:type", Object)
320
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_document", void 0);
321
+ __decorate([
322
+ (0, typeorm_1.ViewColumn)(),
323
+ __metadata("design:type", String)
324
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_name", void 0);
325
+ __decorate([
326
+ (0, typeorm_1.ViewColumn)(),
327
+ __metadata("design:type", String)
328
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_surname", void 0);
329
+ __decorate([
330
+ (0, typeorm_1.ViewColumn)(),
331
+ __metadata("design:type", String)
332
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_full_name", void 0);
333
+ __decorate([
334
+ (0, typeorm_1.ViewColumn)(),
335
+ __metadata("design:type", String)
336
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_email", void 0);
337
+ __decorate([
338
+ (0, typeorm_1.ViewColumn)(),
339
+ __metadata("design:type", Object)
340
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_phone", void 0);
341
+ __decorate([
342
+ (0, typeorm_1.ViewColumn)(),
343
+ __metadata("design:type", Number)
344
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_city", void 0);
345
+ __decorate([
346
+ (0, typeorm_1.ViewColumn)(),
347
+ __metadata("design:type", Object)
348
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_address", void 0);
349
+ __decorate([
350
+ (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
351
+ __metadata("design:type", Object)
352
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_profile", void 0);
353
+ __decorate([
354
+ (0, typeorm_1.ViewColumn)(),
355
+ __metadata("design:type", Date)
356
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_created", void 0);
357
+ __decorate([
358
+ (0, typeorm_1.ViewColumn)(),
359
+ __metadata("design:type", Object)
360
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_updated", void 0);
361
+ __decorate([
362
+ (0, typeorm_1.ViewColumn)(),
363
+ __metadata("design:type", Number)
364
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_status", void 0);
365
+ __decorate([
366
+ (0, typeorm_1.ViewColumn)(),
367
+ __metadata("design:type", Number)
368
+ ], LocalsCompanyInformationForTheTable.prototype, "master_reviewed_visible", void 0);
281
369
  __decorate([
282
370
  (0, typeorm_1.ViewColumn)(),
283
371
  __metadata("design:type", Number)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.9.36",
3
+ "version": "3.9.38",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,6 +17,7 @@ import {
17
17
  LocalReserveStatus,
18
18
  LocalTable,
19
19
  LocalTableZone,
20
+ Master,
20
21
  PosSystem,
21
22
  ReceiptConfig,
22
23
  RequestInvoice,
@@ -41,6 +42,14 @@ export class Local {
41
42
  })
42
43
  id: number;
43
44
 
45
+ @Column({
46
+ length: 10,
47
+ type: "varchar",
48
+ unique: true,
49
+ comment: "Código único de 10 caracteres por cada registro.",
50
+ })
51
+ code: string;
52
+
44
53
  @ManyToOne(() => Company, (company) => company.locals, {
45
54
  onDelete: "CASCADE",
46
55
  onUpdate: "NO ACTION",
@@ -77,22 +86,34 @@ export class Local {
77
86
  })
78
87
  details: any | null;
79
88
 
89
+ @Column({
90
+ type: "longtext",
91
+ nullable: true,
92
+ default: null,
93
+ transformer: jsonTransformer,
94
+ comment:
95
+ "Columna para almacenar los cambios que se le hacen al registro. \nSe almacena todo el formik, con esto simplemente cuando estemos editando se usa esta variable y no tenemos que construir la información.",
96
+ })
97
+ changes: any | null;
98
+
80
99
  @Column({ type: "datetime", default: () => "CURRENT_TIMESTAMP" })
81
100
  created: Date;
82
101
 
83
102
  @Column({
84
103
  type: "datetime",
85
- default: () => "CURRENT_TIMESTAMP",
86
104
  onUpdate: "CURRENT_TIMESTAMP",
105
+ nullable: true,
106
+ default: null,
87
107
  })
88
- updated: Date;
108
+ updated: Date | null;
89
109
 
90
110
  @ManyToOne(() => Partner, (partner) => partner.locals, {
91
111
  onDelete: "NO ACTION",
92
112
  onUpdate: "NO ACTION",
113
+ nullable: true,
93
114
  })
94
115
  @JoinColumn({ name: "updated_by" })
95
- updated_by: Partner;
116
+ updated_by: Partner | null;
96
117
 
97
118
  @ManyToOne(() => Square, (square) => square.locals, {
98
119
  onDelete: "RESTRICT",
@@ -135,6 +156,54 @@ export class Local {
135
156
  })
136
157
  visible: number;
137
158
 
159
+ // !: ¿Esta columna debería venir?
160
+ @Column({
161
+ type: "text",
162
+ nullable: true,
163
+ default: null,
164
+ transformer: jsonTransformer,
165
+ })
166
+ contact_details: any | null;
167
+
168
+ @Column({
169
+ type: "int",
170
+ nullable: true,
171
+ default: null,
172
+ width: 1,
173
+ comment:
174
+ "Estado en el que se encuentra la revisión de los nuevos cambios.\n1: Pendiente de revisión:Estado para decirle al usuario que los cambios se encuentran en revisión.\n2: Aprobado: Los cambios se encuentran aprobados.\n3: Rechazado: Los cambios se rechazaron por algún problema en los datos.",
175
+ })
176
+ review_status: number;
177
+
178
+ @Column({
179
+ type: "int",
180
+ nullable: true,
181
+ default: null,
182
+ width: 1,
183
+ comment:
184
+ "Columna para guardar el tipo de operación del registro.\n1: Creación: Cuando se crea por primera vez el registro.\n2: Edición: Cuando se está editando información del local.",
185
+ })
186
+ operation_type: number;
187
+
188
+ @ManyToOne(() => Master, (master) => master.locals_reviewed, {
189
+ onDelete: "NO ACTION",
190
+ onUpdate: "NO ACTION",
191
+ nullable: true,
192
+ })
193
+ @JoinColumn({ name: "reviewed_by" })
194
+ reviewed_by: Master | null;
195
+
196
+ @Column({
197
+ type: "datetime",
198
+ nullable: true,
199
+ default: null,
200
+ comment: "Fecha de revisión de los cambios realizados por el usuario.",
201
+ })
202
+ review_date: Date | null;
203
+
204
+ @Column({ type: "varchar", length: 300, nullable: true, default: null })
205
+ review_comments: string | null;
206
+
138
207
  @ManyToMany(() => Partner, (partner) => partner.locals_partner)
139
208
  @JoinTable({
140
209
  name: "local_partner",
@@ -9,6 +9,7 @@ import {
9
9
  PrimaryGeneratedColumn,
10
10
  } from "typeorm";
11
11
  import {
12
+ Local,
12
13
  MasterNotification,
13
14
  MasterSession,
14
15
  PartnerNotification,
@@ -203,4 +204,7 @@ export class Master {
203
204
 
204
205
  @OneToMany(() => MasterSession, (MasterSession) => MasterSession.master)
205
206
  masters_session: MasterSession[];
207
+
208
+ @OneToMany(() => Local, (local) => local.reviewed_by)
209
+ locals_reviewed: Local[];
206
210
  }
@@ -1,15 +1,17 @@
1
1
  import { Repository } from "typeorm";
2
2
  import { IBasicCompany } from "../interfaces";
3
- // import { getTimeZone, getTimezoneOffset } from "..";
4
3
 
5
4
  export async function getLocalsCompanyInformation(
6
5
  repository: Repository<any>,
7
- { company, status, visible, lazyEvent }: IBasicCompany,
6
+ {
7
+ company,
8
+ status,
9
+ visible,
10
+ lazyEvent,
11
+ filter_visualization = "no-in-review-rejected",
12
+ }: IBasicCompany,
8
13
  ) {
9
14
  try {
10
- // const timezone = getTimezoneOffset(getTimeZone());
11
- console.log(lazyEvent, "LazyEvent en el filtro");
12
-
13
15
  const queryBuilder = repository
14
16
  .createQueryBuilder("locals_company_information_for_the_table")
15
17
  .skip(lazyEvent.first)
@@ -56,6 +58,19 @@ export async function getLocalsCompanyInformation(
56
58
  );
57
59
  }
58
60
 
61
+ // DOC: la columna filter_visualization se utiliza para aplicar el filtro review_status y operation_type.
62
+ // DOC: Si filter_visualization es "in-review-rejected", se muestran los locales que están en revisión o rechazados, es decir, review_status = 1 o 3 y operation_type = 1 o 2.
63
+ // DOC: Si filter_visualization es "no-in-review-rejected", se muestran los locales que no están en revisión ni rechazados, es decir, review_status es null y operation_type es null.
64
+ if (filter_visualization === "in-review-rejected") {
65
+ queryBuilder.andWhere(
66
+ "(locals_company_information_for_the_table.review_status IN (1, 3) AND locals_company_information_for_the_table.operation_type IN (1, 2))",
67
+ );
68
+ } else if (filter_visualization === "no-in-review-rejected") {
69
+ queryBuilder.andWhere(
70
+ "(locals_company_information_for_the_table.review_status IS NULL AND locals_company_information_for_the_table.operation_type IS NULL)",
71
+ );
72
+ }
73
+
59
74
  // DOC: Acá vienen los otros filtros, por las columnas de la tabla.
60
75
  const filters = lazyEvent.filters;
61
76
  Object.keys(filters).forEach((key) => {
package/src/interfaces.ts CHANGED
@@ -32,10 +32,10 @@ export interface IBasicCompany extends IBasicLazyEvent {
32
32
  company: number | null;
33
33
  visible?: number | null;
34
34
  owner?: number | null;
35
+ filter_visualization: TLocalsCompanyTypeVisualization;
35
36
  }
36
37
 
37
- export interface IPropsQueryVerifyLocalInformation
38
- extends IPropsQueryVerifyLocal {
38
+ export interface IPropsQueryVerifyLocalInformation extends IPropsQueryVerifyLocal {
39
39
  partner: number | null;
40
40
  assigned_master: number | null;
41
41
  }
@@ -76,4 +76,8 @@ export interface IPropsLocalReserve {
76
76
  local: number | null;
77
77
  }
78
78
 
79
+ export type TLocalsCompanyTypeVisualization =
80
+ | "in-review-rejected"
81
+ | "no-in-review-rejected";
82
+
79
83
  export type IType = "mysql" | "mariadb";
@@ -40,6 +40,9 @@ export class LocalsCompanyInformationForTheMap {
40
40
  @ViewColumn({ transformer: jsonTransformer })
41
41
  details: any | null;
42
42
 
43
+ @ViewColumn({ transformer: jsonTransformer })
44
+ changes: any | null;
45
+
43
46
  @ViewColumn()
44
47
  created: Date;
45
48
 
@@ -67,6 +70,12 @@ export class LocalsCompanyInformationForTheMap {
67
70
  @ViewColumn({ transformer: jsonTransformer })
68
71
  contact_details: any | null;
69
72
 
73
+ @ViewColumn()
74
+ review_status: number;
75
+
76
+ @ViewColumn()
77
+ operation_type: number;
78
+
70
79
  @ViewColumn()
71
80
  company_code: string;
72
81
 
@@ -19,6 +19,9 @@ export class LocalsCompanyInformationForTheTable {
19
19
  @ViewColumn()
20
20
  id: number;
21
21
 
22
+ @ViewColumn()
23
+ code: string;
24
+
22
25
  @ViewColumn()
23
26
  company: number;
24
27
 
@@ -40,14 +43,17 @@ export class LocalsCompanyInformationForTheTable {
40
43
  @ViewColumn({ transformer: jsonTransformer })
41
44
  details: any | null;
42
45
 
46
+ @ViewColumn({ transformer: jsonTransformer })
47
+ changes: any | null;
48
+
43
49
  @ViewColumn()
44
50
  created: Date;
45
51
 
46
52
  @ViewColumn()
47
- updated: Date;
53
+ updated: Date | null;
48
54
 
49
55
  @ViewColumn()
50
- updated_by: number;
56
+ updated_by: number | null;
51
57
 
52
58
  @ViewColumn()
53
59
  square: number | null;
@@ -67,6 +73,21 @@ export class LocalsCompanyInformationForTheTable {
67
73
  @ViewColumn({ transformer: jsonTransformer })
68
74
  contact_details: any | null;
69
75
 
76
+ @ViewColumn()
77
+ review_status: number;
78
+
79
+ @ViewColumn()
80
+ operation_type: number;
81
+
82
+ @ViewColumn()
83
+ reviewed_by: number | null;
84
+
85
+ @ViewColumn()
86
+ review_date: Date | null;
87
+
88
+ @ViewColumn()
89
+ review_comments: string;
90
+
70
91
  @ViewColumn()
71
92
  type_local: string;
72
93
 
@@ -205,6 +226,51 @@ export class LocalsCompanyInformationForTheTable {
205
226
  @ViewColumn()
206
227
  partner_updated: Date;
207
228
 
229
+ @ViewColumn()
230
+ master_reviewed_id: number;
231
+
232
+ @ViewColumn()
233
+ master_reviewed_code: string;
234
+
235
+ @ViewColumn()
236
+ master_reviewed_document: string | null;
237
+
238
+ @ViewColumn()
239
+ master_reviewed_name: string;
240
+
241
+ @ViewColumn()
242
+ master_reviewed_surname: string;
243
+
244
+ @ViewColumn()
245
+ master_reviewed_full_name: string;
246
+
247
+ @ViewColumn()
248
+ master_reviewed_email: string;
249
+
250
+ @ViewColumn()
251
+ master_reviewed_phone: string | null;
252
+
253
+ @ViewColumn()
254
+ master_reviewed_city: number;
255
+
256
+ @ViewColumn()
257
+ master_reviewed_address: string | null;
258
+
259
+ @ViewColumn({ transformer: jsonTransformer })
260
+ master_reviewed_profile: any | null;
261
+
262
+ @ViewColumn()
263
+ master_reviewed_created: Date;
264
+
265
+ @ViewColumn()
266
+ master_reviewed_updated: Date | null;
267
+
268
+ @ViewColumn()
269
+ master_reviewed_status: number;
270
+
271
+ @ViewColumn()
272
+ master_reviewed_visible: number;
273
+
208
274
  @ViewColumn()
209
275
  square_id: number;
210
276