test-entity-library-asm 3.9.37 → 3.9.39

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.
@@ -22,4 +22,8 @@ export declare class CustomRepository<T extends ObjectLiteral> extends Repositor
22
22
  data: any[];
23
23
  totalRecords: number;
24
24
  }>;
25
+ getLocalsCompanyInformationForTheTableWrapper(params: IBasicCompany): Promise<{
26
+ data: any[];
27
+ totalRecords: number;
28
+ }>;
25
29
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CustomRepository = void 0;
4
4
  const typeorm_1 = require("typeorm");
5
5
  const _1 = require(".");
6
+ const LocalsCompanyInformationForTheTable_1 = require("./filters/LocalsCompanyInformationForTheTable");
6
7
  class CustomRepository extends typeorm_1.Repository {
7
8
  constructor(target, dataSource) {
8
9
  super(target, dataSource.manager);
@@ -22,5 +23,8 @@ class CustomRepository extends typeorm_1.Repository {
22
23
  async getLocalReservesInformationWrapper(params) {
23
24
  return await (0, _1.getLocalReservesInformation)(this, params);
24
25
  }
26
+ async getLocalsCompanyInformationForTheTableWrapper(params) {
27
+ return await (0, LocalsCompanyInformationForTheTable_1.getLocalsCompanyInformationTable)(this, params);
28
+ }
25
29
  }
26
30
  exports.CustomRepository = CustomRepository;
@@ -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;
@@ -19,8 +20,8 @@ export declare class Local {
19
20
  details: any | null;
20
21
  changes: any | null;
21
22
  created: Date;
22
- updated: Date;
23
- updated_by: Partner;
23
+ updated: Date | null;
24
+ updated_by: Partner | null;
24
25
  square: Square;
25
26
  pos_system: PosSystem;
26
27
  pos_system_settings: any | null;
@@ -29,6 +30,9 @@ export declare class Local {
29
30
  contact_details: any | null;
30
31
  review_status: number;
31
32
  operation_type: number;
33
+ reviewed_by: Master | null;
34
+ review_date: Date | null;
35
+ review_comments: string | null;
32
36
  locals_partners: Partner[];
33
37
  requests_local: RequestLocal[];
34
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",
@@ -91,18 +100,20 @@ __decorate([
91
100
  __decorate([
92
101
  (0, typeorm_1.Column)({
93
102
  type: "datetime",
94
- default: () => "CURRENT_TIMESTAMP",
95
103
  onUpdate: "CURRENT_TIMESTAMP",
104
+ nullable: true,
105
+ default: null,
96
106
  }),
97
- __metadata("design:type", Date)
107
+ __metadata("design:type", Object)
98
108
  ], Local.prototype, "updated", void 0);
99
109
  __decorate([
100
110
  (0, typeorm_1.ManyToOne)(() => Partner_1.Partner, (partner) => partner.locals, {
101
111
  onDelete: "NO ACTION",
102
112
  onUpdate: "NO ACTION",
113
+ nullable: true,
103
114
  }),
104
115
  (0, typeorm_1.JoinColumn)({ name: "updated_by" }),
105
- __metadata("design:type", Partner_1.Partner)
116
+ __metadata("design:type", Object)
106
117
  ], Local.prototype, "updated_by", void 0);
107
118
  __decorate([
108
119
  (0, typeorm_1.ManyToOne)(() => Square_1.Square, (square) => square.locals, {
@@ -177,6 +188,28 @@ __decorate([
177
188
  }),
178
189
  __metadata("design:type", Number)
179
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);
180
213
  __decorate([
181
214
  (0, typeorm_1.ManyToMany)(() => Partner_1.Partner, (partner) => partner.locals_partner),
182
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 getLocalsCompanyInformationTable(repository: Repository<any>, { company, status, visible, lazyEvent, filter_visualization, }: IBasicCompany): Promise<{
4
4
  data: any[];
5
5
  totalRecords: number;
6
6
  }>;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLocalsCompanyInformation = void 0;
4
- // import { getTimeZone, getTimezoneOffset } from "..";
5
- async function getLocalsCompanyInformation(repository, { company, status, visible, lazyEvent }) {
3
+ exports.getLocalsCompanyInformationTable = void 0;
4
+ async function getLocalsCompanyInformationTable(repository, { company, status, visible, lazyEvent, filter_visualization = 2, // "no-in-review-rejected"
5
+ }) {
6
6
  try {
7
- // const timezone = getTimezoneOffset(getTimeZone());
8
- console.log(lazyEvent, "LazyEvent en el filtro");
9
7
  const queryBuilder = repository
10
8
  .createQueryBuilder("locals_company_information_for_the_table")
11
9
  .skip(lazyEvent.first)
@@ -33,6 +31,17 @@ async function getLocalsCompanyInformation(repository, { company, status, visibl
33
31
  visible,
34
32
  });
35
33
  }
34
+ // DOC: la columna filter_visualization se utiliza para aplicar el filtro review_status y operation_type.
35
+ // 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.
36
+ // 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.
37
+ if (filter_visualization === 1) {
38
+ // "in-review-rejected"
39
+ 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))");
40
+ }
41
+ else if (filter_visualization === 2) {
42
+ // "no-in-review-rejected"
43
+ queryBuilder.andWhere("(locals_company_information_for_the_table.review_status IS NULL AND locals_company_information_for_the_table.operation_type IS NULL)");
44
+ }
36
45
  // DOC: Acá vienen los otros filtros, por las columnas de la tabla.
37
46
  const filters = lazyEvent.filters;
38
47
  Object.keys(filters).forEach((key) => {
@@ -166,4 +175,4 @@ async function getLocalsCompanyInformation(repository, { company, status, visibl
166
175
  };
167
176
  }
168
177
  }
169
- exports.getLocalsCompanyInformation = getLocalsCompanyInformation;
178
+ exports.getLocalsCompanyInformationTable = getLocalsCompanyInformationTable;
@@ -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?: number | null;
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";
@@ -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;
@@ -9,8 +10,8 @@ export declare class LocalsCompanyInformationForTheTable {
9
10
  details: any | null;
10
11
  changes: any | null;
11
12
  created: Date;
12
- updated: Date;
13
- updated_by: number;
13
+ updated: Date | null;
14
+ updated_by: number | null;
14
15
  square: number | null;
15
16
  pos_system: number;
16
17
  pos_system_settings: any | null;
@@ -19,6 +20,9 @@ export declare class LocalsCompanyInformationForTheTable {
19
20
  contact_details: any | null;
20
21
  review_status: number;
21
22
  operation_type: number;
23
+ reviewed_by: number | null;
24
+ review_date: Date | null;
25
+ review_comments: string;
22
26
  type_local: string;
23
27
  address_local: string;
24
28
  company_id: number;
@@ -65,6 +69,21 @@ export declare class LocalsCompanyInformationForTheTable {
65
69
  partner_visible: number;
66
70
  partner_created: Date;
67
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;
68
87
  square_id: number;
69
88
  square_details: any | null;
70
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)
@@ -68,11 +72,11 @@ __decorate([
68
72
  ], LocalsCompanyInformationForTheTable.prototype, "created", void 0);
69
73
  __decorate([
70
74
  (0, typeorm_1.ViewColumn)(),
71
- __metadata("design:type", Date)
75
+ __metadata("design:type", Object)
72
76
  ], LocalsCompanyInformationForTheTable.prototype, "updated", void 0);
73
77
  __decorate([
74
78
  (0, typeorm_1.ViewColumn)(),
75
- __metadata("design:type", Number)
79
+ __metadata("design:type", Object)
76
80
  ], LocalsCompanyInformationForTheTable.prototype, "updated_by", void 0);
77
81
  __decorate([
78
82
  (0, typeorm_1.ViewColumn)(),
@@ -106,6 +110,18 @@ __decorate([
106
110
  (0, typeorm_1.ViewColumn)(),
107
111
  __metadata("design:type", Number)
108
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);
109
125
  __decorate([
110
126
  (0, typeorm_1.ViewColumn)(),
111
127
  __metadata("design:type", String)
@@ -290,6 +306,66 @@ __decorate([
290
306
  (0, typeorm_1.ViewColumn)(),
291
307
  __metadata("design:type", Date)
292
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);
293
369
  __decorate([
294
370
  (0, typeorm_1.ViewColumn)(),
295
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.37",
3
+ "version": "3.9.39",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,6 +13,7 @@ import {
13
13
  getLocalsCompanyInformation,
14
14
  getVerifyLocalsInformation,
15
15
  } from ".";
16
+ import { getLocalsCompanyInformationTable } from "./filters/LocalsCompanyInformationForTheTable";
16
17
 
17
18
  export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
18
19
  constructor(target: EntityTarget<T>, dataSource: DataSource) {
@@ -32,7 +33,7 @@ export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
32
33
  }
33
34
 
34
35
  async getVerifyLocalsInformationWrapper(
35
- params: IPropsQueryVerifyLocalInformation
36
+ params: IPropsQueryVerifyLocalInformation,
36
37
  ) {
37
38
  return await getVerifyLocalsInformation(this, params);
38
39
  }
@@ -41,6 +42,10 @@ export class CustomRepository<T extends ObjectLiteral> extends Repository<T> {
41
42
  return await getLocalReservesInformation(this, params);
42
43
  }
43
44
 
45
+ async getLocalsCompanyInformationForTheTableWrapper(params: IBasicCompany) {
46
+ return await getLocalsCompanyInformationTable(this, params);
47
+ }
48
+
44
49
  //! DOC: ¿Necesita implementar un método personalizado aquí?
45
50
  // async anyOtherRepository(args: any) {
46
51
  // // Implementa otro método personalizado aquí
@@ -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",
@@ -92,17 +101,19 @@ export class Local {
92
101
 
93
102
  @Column({
94
103
  type: "datetime",
95
- default: () => "CURRENT_TIMESTAMP",
96
104
  onUpdate: "CURRENT_TIMESTAMP",
105
+ nullable: true,
106
+ default: null,
97
107
  })
98
- updated: Date;
108
+ updated: Date | null;
99
109
 
100
110
  @ManyToOne(() => Partner, (partner) => partner.locals, {
101
111
  onDelete: "NO ACTION",
102
112
  onUpdate: "NO ACTION",
113
+ nullable: true,
103
114
  })
104
115
  @JoinColumn({ name: "updated_by" })
105
- updated_by: Partner;
116
+ updated_by: Partner | null;
106
117
 
107
118
  @ManyToOne(() => Square, (square) => square.locals, {
108
119
  onDelete: "RESTRICT",
@@ -174,6 +185,25 @@ export class Local {
174
185
  })
175
186
  operation_type: number;
176
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
+
177
207
  @ManyToMany(() => Partner, (partner) => partner.locals_partner)
178
208
  @JoinTable({
179
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
- export async function getLocalsCompanyInformation(
4
+ export async function getLocalsCompanyInformationTable(
6
5
  repository: Repository<any>,
7
- { company, status, visible, lazyEvent }: IBasicCompany,
6
+ {
7
+ company,
8
+ status,
9
+ visible,
10
+ lazyEvent,
11
+ filter_visualization = 2, // "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,21 @@ 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 === 1) {
65
+ // "in-review-rejected"
66
+ queryBuilder.andWhere(
67
+ "(locals_company_information_for_the_table.review_status IN (1, 3) AND locals_company_information_for_the_table.operation_type IN (1, 2))",
68
+ );
69
+ } else if (filter_visualization === 2) {
70
+ // "no-in-review-rejected"
71
+ queryBuilder.andWhere(
72
+ "(locals_company_information_for_the_table.review_status IS NULL AND locals_company_information_for_the_table.operation_type IS NULL)",
73
+ );
74
+ }
75
+
59
76
  // DOC: Acá vienen los otros filtros, por las columnas de la tabla.
60
77
  const filters = lazyEvent.filters;
61
78
  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?: number | null;
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";
@@ -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
 
@@ -47,10 +50,10 @@ export class LocalsCompanyInformationForTheTable {
47
50
  created: Date;
48
51
 
49
52
  @ViewColumn()
50
- updated: Date;
53
+ updated: Date | null;
51
54
 
52
55
  @ViewColumn()
53
- updated_by: number;
56
+ updated_by: number | null;
54
57
 
55
58
  @ViewColumn()
56
59
  square: number | null;
@@ -76,6 +79,15 @@ export class LocalsCompanyInformationForTheTable {
76
79
  @ViewColumn()
77
80
  operation_type: number;
78
81
 
82
+ @ViewColumn()
83
+ reviewed_by: number | null;
84
+
85
+ @ViewColumn()
86
+ review_date: Date | null;
87
+
88
+ @ViewColumn()
89
+ review_comments: string;
90
+
79
91
  @ViewColumn()
80
92
  type_local: string;
81
93
 
@@ -214,6 +226,51 @@ export class LocalsCompanyInformationForTheTable {
214
226
  @ViewColumn()
215
227
  partner_updated: Date;
216
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
+
217
274
  @ViewColumn()
218
275
  square_id: number;
219
276