test-entity-library-asm 3.9.32 → 3.9.33

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,3 +1,4 @@
1
+ import { ReceiptConfig } from "..";
1
2
  import { IPropsContactDetail } from "../interfaces";
2
3
  import { City } from "./City";
3
4
  import { CodeRedemptionHistoryCompany } from "./CodeRedemptionHistoryCompany";
@@ -7,7 +8,6 @@ import { Partner } from "./Partner";
7
8
  import { PartnerRole } from "./PartnerRole";
8
9
  import { Plan } from "./Plan";
9
10
  import { ProductTopping } from "./ProductTopping";
10
- import { ReceiptConfig } from "..";
11
11
  export declare class Company {
12
12
  id: number;
13
13
  code: string;
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Company = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
- const dateTransformer_1 = require("../transformers/dateTransformer");
14
+ const __1 = require("..");
15
15
  const jsonTransformer_1 = require("../transformers/jsonTransformer");
16
16
  const City_1 = require("./City");
17
17
  const CodeRedemptionHistoryCompany_1 = require("./CodeRedemptionHistoryCompany");
@@ -21,7 +21,6 @@ const Partner_1 = require("./Partner");
21
21
  const PartnerRole_1 = require("./PartnerRole");
22
22
  const Plan_1 = require("./Plan");
23
23
  const ProductTopping_1 = require("./ProductTopping");
24
- const __1 = require("..");
25
24
  let Company = class Company {
26
25
  };
27
26
  exports.Company = Company;
@@ -113,8 +112,8 @@ __decorate([
113
112
  ], Company.prototype, "settings", void 0);
114
113
  __decorate([
115
114
  (0, typeorm_1.Column)({
116
- type: "datetime",
117
- transformer: new dateTransformer_1.DateTransformer(),
115
+ type: "timestamp",
116
+ default: () => "CURRENT_TIMESTAMP",
118
117
  comment: "Fecha creación de la empresa.",
119
118
  }),
120
119
  __metadata("design:type", Date)
@@ -130,8 +129,9 @@ __decorate([
130
129
  ], Company.prototype, "expiration", void 0);
131
130
  __decorate([
132
131
  (0, typeorm_1.Column)({
133
- type: "datetime",
134
- transformer: new dateTransformer_1.DateTransformer(),
132
+ type: "timestamp",
133
+ default: () => "CURRENT_TIMESTAMP",
134
+ onUpdate: "CURRENT_TIMESTAMP",
135
135
  comment: "Fecha de actualización de la empresa.",
136
136
  }),
137
137
  __metadata("design:type", Date)
@@ -30,17 +30,6 @@ __decorate([
30
30
  (0, typeorm_1.Column)({
31
31
  type: "date",
32
32
  comment: "Fecha del festivo.",
33
- // transformer: {
34
- // to: (value: string | Date) => value, // guardamos tal cual
35
- // from: (value: Date | string) => {
36
- // if (typeof value === "string") return value; // ya es string, devuelve
37
- // // Convierte Date a YYYY-MM-DD
38
- // const y = value.getFullYear();
39
- // const m = (value.getMonth() + 1).toString().padStart(2, "0");
40
- // const d = value.getDate().toString().padStart(2, "0");
41
- // return `${y}-${m}-${d}`;
42
- // },
43
- // },
44
33
  }),
45
34
  __metadata("design:type", String)
46
35
  ], CountryHoliday.prototype, "date", void 0);
@@ -55,7 +44,6 @@ __decorate([
55
44
  __decorate([
56
45
  (0, typeorm_1.Column)({
57
46
  type: "timestamp",
58
- // transformer: new DateTransformer(),
59
47
  default: () => "CURRENT_TIMESTAMP",
60
48
  comment: "Fecha de creación del registro.",
61
49
  }),
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Local = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const __1 = require("..");
15
- const dateTransformer_1 = require("../transformers/dateTransformer");
16
15
  const jsonTransformer_1 = require("../transformers/jsonTransformer");
17
16
  const BusinessTypeProduct_1 = require("./BusinessTypeProduct");
18
17
  const Category_1 = require("./Category");
@@ -76,11 +75,15 @@ __decorate([
76
75
  __metadata("design:type", Object)
77
76
  ], Local.prototype, "details", void 0);
78
77
  __decorate([
79
- (0, typeorm_1.Column)({ type: "datetime", transformer: new dateTransformer_1.DateTransformer() }),
78
+ (0, typeorm_1.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" }),
80
79
  __metadata("design:type", Date)
81
80
  ], Local.prototype, "created", void 0);
82
81
  __decorate([
83
- (0, typeorm_1.Column)({ type: "datetime", transformer: new dateTransformer_1.DateTransformer() }),
82
+ (0, typeorm_1.Column)({
83
+ type: "timestamp",
84
+ default: () => "CURRENT_TIMESTAMP",
85
+ onUpdate: "CURRENT_TIMESTAMP",
86
+ }),
84
87
  __metadata("design:type", Date)
85
88
  ], Local.prototype, "updated", void 0);
86
89
  __decorate([
@@ -13,7 +13,6 @@ exports.LocalPlan = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const __1 = require("..");
15
15
  const jsonTransformer_1 = require("../transformers/jsonTransformer");
16
- const dateTransformer_1 = require("../transformers/dateTransformer");
17
16
  let LocalPlan = class LocalPlan {
18
17
  };
19
18
  exports.LocalPlan = LocalPlan;
@@ -70,17 +69,16 @@ __decorate([
70
69
  ], LocalPlan.prototype, "settings", void 0);
71
70
  __decorate([
72
71
  (0, typeorm_1.Column)({
73
- type: "datetime",
74
- transformer: new dateTransformer_1.DateTransformer(),
75
- comment: "Fecha de creación del registro.",
72
+ type: "timestamp",
73
+ default: () => "CURRENT_TIMESTAMP",
74
+ comment: "Fecha de inicio del registro.",
76
75
  }),
77
76
  __metadata("design:type", Date)
78
77
  ], LocalPlan.prototype, "start_date", void 0);
79
78
  __decorate([
80
79
  (0, typeorm_1.Column)({
81
- type: "datetime",
82
- transformer: new dateTransformer_1.DateTransformer(),
83
- comment: "Fecha de creación del registro.",
80
+ type: "timestamp",
81
+ comment: "Fecha de finalización del registro.",
84
82
  }),
85
83
  __metadata("design:type", Date)
86
84
  ], LocalPlan.prototype, "end_date", void 0);
@@ -89,7 +87,7 @@ __decorate([
89
87
  default: 1,
90
88
  type: "int",
91
89
  width: 1,
92
- comment: "¿El master tiene acceso a la plataforma?:\r\n1. Activo: El master tiene acceso.\r\n0. Inactivo: El master no tiene acceso a la plataforma.",
90
+ comment: "Estado del plan del local, es decir: \n\n1. Activo: El plan está vigente. \n\n0. Inactivo: El plan ha caducado.",
93
91
  }),
94
92
  __metadata("design:type", Number)
95
93
  ], LocalPlan.prototype, "status", void 0);
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Partner = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const __1 = require("..");
15
- const dateTransformer_1 = require("../transformers/dateTransformer");
16
15
  const jsonTransformer_1 = require("../transformers/jsonTransformer");
17
16
  const City_1 = require("./City");
18
17
  const Company_1 = require("./Company");
@@ -147,17 +146,18 @@ __decorate([
147
146
  ], Partner.prototype, "owner", void 0);
148
147
  __decorate([
149
148
  (0, typeorm_1.Column)({
150
- type: "datetime",
149
+ type: "timestamp",
151
150
  comment: "Fecha de creación del registro.",
152
- transformer: new dateTransformer_1.DateTransformer(),
151
+ default: () => "CURRENT_TIMESTAMP",
153
152
  }),
154
153
  __metadata("design:type", Date)
155
154
  ], Partner.prototype, "created", void 0);
156
155
  __decorate([
157
156
  (0, typeorm_1.Column)({
158
- type: "datetime",
157
+ type: "timestamp",
159
158
  comment: "Fecha de actualización del registro.",
160
- transformer: new dateTransformer_1.DateTransformer(),
159
+ default: () => "CURRENT_TIMESTAMP",
160
+ onUpdate: "CURRENT_TIMESTAMP",
161
161
  }),
162
162
  __metadata("design:type", Date)
163
163
  ], Partner.prototype, "updated", void 0);
@@ -8,7 +8,7 @@ export declare class Plan {
8
8
  description: any | null;
9
9
  quantity_locals: number;
10
10
  created: Date;
11
- expiration: string;
11
+ expiration: Date;
12
12
  status: number;
13
13
  local_plans: LocalPlan[];
14
14
  }
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Plan = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const __1 = require("..");
15
- const dateTransformer_1 = require("../transformers/dateTransformer");
16
15
  const jsonTransformer_1 = require("../transformers/jsonTransformer");
17
16
  const Company_1 = require("./Company");
18
17
  let Plan = class Plan {
@@ -69,15 +68,15 @@ __decorate([
69
68
  ], Plan.prototype, "quantity_locals", void 0);
70
69
  __decorate([
71
70
  (0, typeorm_1.Column)({
72
- type: "datetime",
73
- transformer: new dateTransformer_1.DateTransformer(),
71
+ type: "timestamp",
72
+ default: () => "CURRENT_TIMESTAMP",
74
73
  comment: "Fecha de creación del registro.",
75
74
  }),
76
75
  __metadata("design:type", Date)
77
76
  ], Plan.prototype, "created", void 0);
78
77
  __decorate([
79
- (0, typeorm_1.Column)({ type: "date", comment: "Fecha de expiración del registro." }),
80
- __metadata("design:type", String)
78
+ (0, typeorm_1.Column)({ type: "timestamp", comment: "Fecha de expiración del registro." }),
79
+ __metadata("design:type", Date)
81
80
  ], Plan.prototype, "expiration", void 0);
82
81
  __decorate([
83
82
  (0, typeorm_1.Column)({
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLocalsCompanyInformation = void 0;
4
- const __1 = require("..");
4
+ // import { getTimeZone, getTimezoneOffset } from "..";
5
5
  async function getLocalsCompanyInformation(repository, { company, status, visible, lazyEvent }) {
6
6
  try {
7
- const timezone = (0, __1.getTimezoneOffset)((0, __1.getTimeZone)());
7
+ // const timezone = getTimezoneOffset(getTimeZone());
8
+ console.log(lazyEvent, "LazyEvent en el filtro");
8
9
  const queryBuilder = repository
9
10
  .createQueryBuilder("locals_company_information_for_the_table")
10
11
  .skip(lazyEvent.first)
@@ -105,40 +106,40 @@ async function getLocalsCompanyInformation(repository, { company, status, visibl
105
106
  });
106
107
  }
107
108
  break;
108
- case "dateIs": // DOC: Si el modo de coincidencia es "dateIs". Hay que tener en cuenta la zona horaria (timezone)
109
- queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
110
- ? "DATE(CONVERT_TZ("
111
- : ""} ${accessKey} ${key !== "expiration" && key !== "start"
112
- ? `, '+00:00', '${timezone}'))`
113
- : ""} != :${key}`, {
114
- [key]: value.split("T")[0],
109
+ case "dateIs": {
110
+ // DOC: Si el modo de coincidencia es "dateIs". Hay que tener en cuenta la zona horaria (timezone)
111
+ const date = new Date(value);
112
+ const start = new Date(date);
113
+ start.setUTCHours(0, 0, 0, 0);
114
+ const end = new Date(date);
115
+ end.setUTCHours(23, 59, 59, 999);
116
+ queryBuilder.andWhere(`${accessKey} BETWEEN :start AND :end`, {
117
+ start,
118
+ end,
115
119
  });
116
120
  break;
117
- case "dateIsNot": // DOC: Si el modo de coincidencia es "dateIsNot". Hay que tener en cuenta la zona horaria (timezone)
118
- queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
119
- ? "DATE(CONVERT_TZ("
120
- : ""} ${accessKey} ${key !== "expiration" && key !== "start"
121
- ? `, '+00:00', '${timezone}'))`
122
- : ""} = :${key}`, {
123
- [key]: value.split("T")[0],
121
+ }
122
+ case "dateIsNot": {
123
+ // DOC: Si el modo de coincidencia es "dateIsNot". Hay que tener en cuenta la zona horaria (timezone)
124
+ const date = new Date(value);
125
+ const start = new Date(date);
126
+ start.setUTCHours(0, 0, 0, 0);
127
+ const end = new Date(date);
128
+ end.setUTCHours(23, 59, 59, 999);
129
+ queryBuilder.andWhere(`${accessKey} NOT BETWEEN :start AND :end`, {
130
+ start,
131
+ end,
124
132
  });
125
133
  break;
134
+ }
126
135
  case "dateBefore": // DOC: Si el modo de coincidencia es "dateBefore". Hay que tener en cuenta la zona horaria (timezone)
127
- queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
128
- ? "DATE(CONVERT_TZ("
129
- : ""} ${accessKey} ${key !== "expiration" && key !== "start"
130
- ? `, '+00:00', '${timezone}'))`
131
- : ""} < :${key}`, {
132
- [key]: value.split("T")[0],
136
+ queryBuilder.andWhere(`${accessKey} < :${key}`, {
137
+ [key]: new Date(value),
133
138
  });
134
139
  break;
135
140
  case "dateAfter": // DOC: Si el modo de coincidencia es "dateAfter". Hay que tener en cuenta la zona horaria (timezone)
136
- queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
137
- ? "DATE(CONVERT_TZ("
138
- : ""} ${accessKey} ${key !== "expiration" && key !== "start"
139
- ? `, '+00:00', '${timezone}'))`
140
- : ""} > :${key}`, {
141
- [key]: value.split("T")[0],
141
+ queryBuilder.andWhere(`${accessKey} > :${key}`, {
142
+ [key]: new Date(value),
142
143
  });
143
144
  break;
144
145
  default: // DOC: Si el modo de coincidencia no es ninguno de los anteriores.
@@ -7,8 +7,8 @@ export declare class LocalsCompanyInformationForTheTable {
7
7
  latitude: number;
8
8
  longitude: number;
9
9
  details: any | null;
10
- created: string;
11
- updated: string;
10
+ created: Date;
11
+ updated: Date;
12
12
  updated_by: number;
13
13
  square: number | null;
14
14
  pos_system: number;
@@ -60,8 +60,8 @@ export declare class LocalsCompanyInformationForTheTable {
60
60
  partner_profile: any | null;
61
61
  partner_status: number;
62
62
  partner_visible: number;
63
- partner_created: string;
64
- partner_updated: string;
63
+ partner_created: Date;
64
+ partner_updated: Date;
65
65
  square_id: number;
66
66
  square_details: any | null;
67
67
  square_email: string | null;
@@ -75,18 +75,18 @@ export declare class LocalsCompanyInformationForTheTable {
75
75
  local_plan_id: number;
76
76
  local_plan_type: string;
77
77
  local_plan_price: number;
78
- local_plan_start_date: string;
79
- local_plan_end_date: string;
78
+ local_plan_start_date: Date;
79
+ local_plan_end_date: Date;
80
80
  local_plan_settings: any | null;
81
81
  local_plan_status: number;
82
82
  plan_code: string;
83
83
  plan_company: number;
84
- plan_created: string;
84
+ plan_created: Date;
85
85
  plan_name: string;
86
86
  plan_id: number;
87
87
  plan_description: any | null;
88
88
  plan_quantity_locals: number;
89
- plan_expiration: string;
89
+ plan_expiration: Date;
90
90
  plan_status: number;
91
91
  total_requests: number;
92
92
  total_ratings: number;
@@ -11,8 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LocalsCompanyInformationForTheTable = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
- const moment = require("moment-timezone");
15
- const __1 = require("..");
16
14
  const jsonTransformer = {
17
15
  to: (value) => JSON.stringify(value),
18
16
  from: (value) => {
@@ -25,14 +23,14 @@ const jsonTransformer = {
25
23
  }
26
24
  },
27
25
  };
28
- const DateTransformer = {
29
- to(value) {
30
- return moment.utc(value).format("YYYY-MM-DD HH:mm:ss");
31
- },
32
- from(value) {
33
- return moment.utc(value).tz((0, __1.getTimeZone)()).format("YYYY-MM-DD HH:mm:ss");
34
- },
35
- };
26
+ // const DateTransformer = {
27
+ // to(value: Date | string): string {
28
+ // return moment.utc(value).format("YYYY-MM-DD HH:mm:ss");
29
+ // },
30
+ // from(value: string): string {
31
+ // return moment.utc(value).tz(getTimeZone()).format("YYYY-MM-DD HH:mm:ss");
32
+ // },
33
+ // };
36
34
  let LocalsCompanyInformationForTheTable = class LocalsCompanyInformationForTheTable {
37
35
  };
38
36
  exports.LocalsCompanyInformationForTheTable = LocalsCompanyInformationForTheTable;
@@ -69,12 +67,12 @@ __decorate([
69
67
  __metadata("design:type", Object)
70
68
  ], LocalsCompanyInformationForTheTable.prototype, "details", void 0);
71
69
  __decorate([
72
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
73
- __metadata("design:type", String)
70
+ (0, typeorm_1.ViewColumn)(),
71
+ __metadata("design:type", Date)
74
72
  ], LocalsCompanyInformationForTheTable.prototype, "created", void 0);
75
73
  __decorate([
76
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
77
- __metadata("design:type", String)
74
+ (0, typeorm_1.ViewColumn)(),
75
+ __metadata("design:type", Date)
78
76
  ], LocalsCompanyInformationForTheTable.prototype, "updated", void 0);
79
77
  __decorate([
80
78
  (0, typeorm_1.ViewColumn)(),
@@ -125,7 +123,7 @@ __decorate([
125
123
  __metadata("design:type", String)
126
124
  ], LocalsCompanyInformationForTheTable.prototype, "company_name", void 0);
127
125
  __decorate([
128
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
126
+ (0, typeorm_1.ViewColumn)(),
129
127
  __metadata("design:type", Object)
130
128
  ], LocalsCompanyInformationForTheTable.prototype, "company_expiration", void 0);
131
129
  __decorate([
@@ -205,7 +203,7 @@ __decorate([
205
203
  __metadata("design:type", Object)
206
204
  ], LocalsCompanyInformationForTheTable.prototype, "country_details", void 0);
207
205
  __decorate([
208
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
206
+ (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
209
207
  __metadata("design:type", Object)
210
208
  ], LocalsCompanyInformationForTheTable.prototype, "country_legal_agent", void 0);
211
209
  __decorate([
@@ -281,12 +279,12 @@ __decorate([
281
279
  __metadata("design:type", Number)
282
280
  ], LocalsCompanyInformationForTheTable.prototype, "partner_visible", void 0);
283
281
  __decorate([
284
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
285
- __metadata("design:type", String)
282
+ (0, typeorm_1.ViewColumn)(),
283
+ __metadata("design:type", Date)
286
284
  ], LocalsCompanyInformationForTheTable.prototype, "partner_created", void 0);
287
285
  __decorate([
288
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
289
- __metadata("design:type", String)
286
+ (0, typeorm_1.ViewColumn)(),
287
+ __metadata("design:type", Date)
290
288
  ], LocalsCompanyInformationForTheTable.prototype, "partner_updated", void 0);
291
289
  __decorate([
292
290
  (0, typeorm_1.ViewColumn)(),
@@ -341,12 +339,12 @@ __decorate([
341
339
  __metadata("design:type", Number)
342
340
  ], LocalsCompanyInformationForTheTable.prototype, "local_plan_price", void 0);
343
341
  __decorate([
344
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
345
- __metadata("design:type", String)
342
+ (0, typeorm_1.ViewColumn)(),
343
+ __metadata("design:type", Date)
346
344
  ], LocalsCompanyInformationForTheTable.prototype, "local_plan_start_date", void 0);
347
345
  __decorate([
348
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
349
- __metadata("design:type", String)
346
+ (0, typeorm_1.ViewColumn)(),
347
+ __metadata("design:type", Date)
350
348
  ], LocalsCompanyInformationForTheTable.prototype, "local_plan_end_date", void 0);
351
349
  __decorate([
352
350
  (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
@@ -365,8 +363,8 @@ __decorate([
365
363
  __metadata("design:type", Number)
366
364
  ], LocalsCompanyInformationForTheTable.prototype, "plan_company", void 0);
367
365
  __decorate([
368
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
369
- __metadata("design:type", String)
366
+ (0, typeorm_1.ViewColumn)(),
367
+ __metadata("design:type", Date)
370
368
  ], LocalsCompanyInformationForTheTable.prototype, "plan_created", void 0);
371
369
  __decorate([
372
370
  (0, typeorm_1.ViewColumn)(),
@@ -385,8 +383,8 @@ __decorate([
385
383
  __metadata("design:type", Number)
386
384
  ], LocalsCompanyInformationForTheTable.prototype, "plan_quantity_locals", void 0);
387
385
  __decorate([
388
- (0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
389
- __metadata("design:type", String)
386
+ (0, typeorm_1.ViewColumn)(),
387
+ __metadata("design:type", Date)
390
388
  ], LocalsCompanyInformationForTheTable.prototype, "plan_expiration", void 0);
391
389
  __decorate([
392
390
  (0, typeorm_1.ViewColumn)(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "3.9.32",
3
+ "version": "3.9.33",
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,8 +6,8 @@ import {
6
6
  OneToMany,
7
7
  PrimaryGeneratedColumn,
8
8
  } from "typeorm";
9
+ import { ReceiptConfig } from "..";
9
10
  import { IPropsContactDetail } from "../interfaces";
10
- import { DateTransformer } from "../transformers/dateTransformer";
11
11
  import { jsonTransformer } from "../transformers/jsonTransformer";
12
12
  import { City } from "./City";
13
13
  import { CodeRedemptionHistoryCompany } from "./CodeRedemptionHistoryCompany";
@@ -17,7 +17,6 @@ import { Partner } from "./Partner";
17
17
  import { PartnerRole } from "./PartnerRole";
18
18
  import { Plan } from "./Plan";
19
19
  import { ProductTopping } from "./ProductTopping";
20
- import { ReceiptConfig } from "..";
21
20
 
22
21
  @Entity({
23
22
  comment:
@@ -105,8 +104,8 @@ export class Company {
105
104
  settings: any | null;
106
105
 
107
106
  @Column({
108
- type: "datetime",
109
- transformer: new DateTransformer(),
107
+ type: "timestamp",
108
+ default: () => "CURRENT_TIMESTAMP",
110
109
  comment: "Fecha creación de la empresa.",
111
110
  })
112
111
  created: Date;
@@ -120,8 +119,9 @@ export class Company {
120
119
  expiration: string | null;
121
120
 
122
121
  @Column({
123
- type: "datetime",
124
- transformer: new DateTransformer(),
122
+ type: "timestamp",
123
+ default: () => "CURRENT_TIMESTAMP",
124
+ onUpdate: "CURRENT_TIMESTAMP",
125
125
  comment: "Fecha de actualización de la empresa.",
126
126
  })
127
127
  updated: Date;
@@ -24,17 +24,6 @@ export class CountryHoliday {
24
24
  @Column({
25
25
  type: "date",
26
26
  comment: "Fecha del festivo.",
27
- // transformer: {
28
- // to: (value: string | Date) => value, // guardamos tal cual
29
- // from: (value: Date | string) => {
30
- // if (typeof value === "string") return value; // ya es string, devuelve
31
- // // Convierte Date a YYYY-MM-DD
32
- // const y = value.getFullYear();
33
- // const m = (value.getMonth() + 1).toString().padStart(2, "0");
34
- // const d = value.getDate().toString().padStart(2, "0");
35
- // return `${y}-${m}-${d}`;
36
- // },
37
- // },
38
27
  })
39
28
  date: string;
40
29
 
@@ -47,7 +36,6 @@ export class CountryHoliday {
47
36
 
48
37
  @Column({
49
38
  type: "timestamp",
50
- // transformer: new DateTransformer(),
51
39
  default: () => "CURRENT_TIMESTAMP",
52
40
  comment: "Fecha de creación del registro.",
53
41
  })
@@ -22,7 +22,6 @@ import {
22
22
  RequestInvoice,
23
23
  RequestLocal,
24
24
  } from "..";
25
- import { DateTransformer } from "../transformers/dateTransformer";
26
25
  import { jsonTransformer } from "../transformers/jsonTransformer";
27
26
  import { BusinessTypeProduct } from "./BusinessTypeProduct";
28
27
  import { Category } from "./Category";
@@ -78,10 +77,14 @@ export class Local {
78
77
  })
79
78
  details: any | null;
80
79
 
81
- @Column({ type: "datetime", transformer: new DateTransformer() })
80
+ @Column({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
82
81
  created: Date;
83
82
 
84
- @Column({ type: "datetime", transformer: new DateTransformer() })
83
+ @Column({
84
+ type: "timestamp",
85
+ default: () => "CURRENT_TIMESTAMP",
86
+ onUpdate: "CURRENT_TIMESTAMP",
87
+ })
85
88
  updated: Date;
86
89
 
87
90
  @ManyToOne(() => Partner, (partner) => partner.locals, {
@@ -7,7 +7,6 @@ import {
7
7
  } from "typeorm";
8
8
  import { Local, Plan } from "..";
9
9
  import { jsonTransformer } from "../transformers/jsonTransformer";
10
- import { DateTransformer } from "../transformers/dateTransformer";
11
10
 
12
11
  @Entity({
13
12
  name: "local_plan",
@@ -62,16 +61,15 @@ export class LocalPlan {
62
61
  settings: any | null;
63
62
 
64
63
  @Column({
65
- type: "datetime",
66
- transformer: new DateTransformer(),
67
- comment: "Fecha de creación del registro.",
64
+ type: "timestamp",
65
+ default: () => "CURRENT_TIMESTAMP",
66
+ comment: "Fecha de inicio del registro.",
68
67
  })
69
68
  start_date: Date;
70
69
 
71
70
  @Column({
72
- type: "datetime",
73
- transformer: new DateTransformer(),
74
- comment: "Fecha de creación del registro.",
71
+ type: "timestamp",
72
+ comment: "Fecha de finalización del registro.",
75
73
  })
76
74
  end_date: Date;
77
75
 
@@ -80,7 +78,7 @@ export class LocalPlan {
80
78
  type: "int",
81
79
  width: 1,
82
80
  comment:
83
- "¿El master tiene acceso a la plataforma?:\r\n1. Activo: El master tiene acceso.\r\n0. Inactivo: El master no tiene acceso a la plataforma.",
81
+ "Estado del plan del local, es decir: \n\n1. Activo: El plan está vigente. \n\n0. Inactivo: El plan ha caducado.",
84
82
  })
85
83
  status: number;
86
84
  }
@@ -26,7 +26,6 @@ import {
26
26
  RequestPrint,
27
27
  VerifyLocal,
28
28
  } from "..";
29
- import { DateTransformer } from "../transformers/dateTransformer";
30
29
  import { jsonTransformer } from "../transformers/jsonTransformer";
31
30
  import { City } from "./City";
32
31
  import { Company } from "./Company";
@@ -152,16 +151,17 @@ export class Partner {
152
151
  owner: number;
153
152
 
154
153
  @Column({
155
- type: "datetime",
154
+ type: "timestamp",
156
155
  comment: "Fecha de creación del registro.",
157
- transformer: new DateTransformer(),
156
+ default: () => "CURRENT_TIMESTAMP",
158
157
  })
159
158
  created: Date;
160
159
 
161
160
  @Column({
162
- type: "datetime",
161
+ type: "timestamp",
163
162
  comment: "Fecha de actualización del registro.",
164
- transformer: new DateTransformer(),
163
+ default: () => "CURRENT_TIMESTAMP",
164
+ onUpdate: "CURRENT_TIMESTAMP",
165
165
  })
166
166
  updated: Date;
167
167
 
@@ -187,7 +187,7 @@ export class Partner {
187
187
 
188
188
  @OneToMany(
189
189
  () => DiscountCodeUser,
190
- (discountCodeUser) => discountCodeUser.updated_by
190
+ (discountCodeUser) => discountCodeUser.updated_by,
191
191
  )
192
192
  discount_code_partners: DiscountCodeUser[];
193
193
 
@@ -224,7 +224,7 @@ export class Partner {
224
224
 
225
225
  @OneToMany(
226
226
  () => PartnerNotification,
227
- (partnerNotification) => partnerNotification.partner
227
+ (partnerNotification) => partnerNotification.partner,
228
228
  )
229
229
  partners_notification: PartnerNotification[];
230
230
 
@@ -233,7 +233,7 @@ export class Partner {
233
233
 
234
234
  @ManyToMany(
235
235
  () => PartnerNotification,
236
- (partnerNotification) => partnerNotification.partner_to_notifications
236
+ (partnerNotification) => partnerNotification.partner_to_notifications,
237
237
  )
238
238
  @JoinTable({
239
239
  name: "partner_to_notification",
@@ -250,7 +250,7 @@ export class Partner {
250
250
 
251
251
  @OneToMany(
252
252
  () => MasterNotification,
253
- (master_notification) => master_notification.master
253
+ (master_notification) => master_notification.master,
254
254
  )
255
255
  partner_notifications: MasterNotification[];
256
256
 
@@ -271,13 +271,13 @@ export class Partner {
271
271
 
272
272
  @OneToMany(
273
273
  () => RequestLocalHistory,
274
- (requestLocalHistory) => requestLocalHistory.updated_by
274
+ (requestLocalHistory) => requestLocalHistory.updated_by,
275
275
  )
276
276
  updated_by_history: RequestLocalHistory[];
277
277
 
278
278
  @OneToMany(
279
279
  () => RequestLocalPayment,
280
- (requestLocalPayment) => requestLocalPayment.partner
280
+ (requestLocalPayment) => requestLocalPayment.partner,
281
281
  )
282
282
  requests_local_payment: RequestLocalPayment[];
283
283
 
@@ -289,7 +289,7 @@ export class Partner {
289
289
 
290
290
  @OneToMany(
291
291
  () => LocalTableZone,
292
- (localTableZone) => localTableZone.updated_by
292
+ (localTableZone) => localTableZone.updated_by,
293
293
  )
294
294
  local_table_zones: LocalTableZone[];
295
295
 
@@ -298,7 +298,7 @@ export class Partner {
298
298
 
299
299
  @OneToMany(
300
300
  () => LocalTableReservePayment,
301
- (LocalTableReservePayment) => LocalTableReservePayment.partner
301
+ (LocalTableReservePayment) => LocalTableReservePayment.partner,
302
302
  )
303
303
  local_table_reserve_payments: LocalTableReservePayment[];
304
304
 
@@ -307,13 +307,13 @@ export class Partner {
307
307
 
308
308
  @OneToMany(
309
309
  () => LocalReserveStatus,
310
- (localReserveStatus) => localReserveStatus.updated_by
310
+ (localReserveStatus) => localReserveStatus.updated_by,
311
311
  )
312
312
  local_reserve_status: LocalReserveStatus[];
313
313
 
314
314
  @OneToMany(
315
315
  () => RequestInvoice,
316
- (RequestInvoice) => RequestInvoice.updated_by
316
+ (RequestInvoice) => RequestInvoice.updated_by,
317
317
  )
318
318
  request_invoices: RequestInvoice[];
319
319
 
@@ -7,7 +7,6 @@ import {
7
7
  PrimaryGeneratedColumn,
8
8
  } from "typeorm";
9
9
  import { LocalPlan } from "..";
10
- import { DateTransformer } from "../transformers/dateTransformer";
11
10
  import { jsonTransformer } from "../transformers/jsonTransformer";
12
11
  import { Company } from "./Company";
13
12
 
@@ -61,14 +60,14 @@ export class Plan {
61
60
  quantity_locals: number;
62
61
 
63
62
  @Column({
64
- type: "datetime",
65
- transformer: new DateTransformer(),
63
+ type: "timestamp",
64
+ default: () => "CURRENT_TIMESTAMP",
66
65
  comment: "Fecha de creación del registro.",
67
66
  })
68
67
  created: Date;
69
68
 
70
- @Column({ type: "date", comment: "Fecha de expiración del registro." })
71
- expiration: string;
69
+ @Column({ type: "timestamp", comment: "Fecha de expiración del registro." })
70
+ expiration: Date;
72
71
 
73
72
  @Column({
74
73
  default: 1,
@@ -1,13 +1,14 @@
1
1
  import { Repository } from "typeorm";
2
2
  import { IBasicCompany } from "../interfaces";
3
- import { getTimeZone, getTimezoneOffset } from "..";
3
+ // import { getTimeZone, getTimezoneOffset } from "..";
4
4
 
5
5
  export async function getLocalsCompanyInformation(
6
6
  repository: Repository<any>,
7
- { company, status, visible, lazyEvent }: IBasicCompany
7
+ { company, status, visible, lazyEvent }: IBasicCompany,
8
8
  ) {
9
9
  try {
10
- const timezone = getTimezoneOffset(getTimeZone());
10
+ // const timezone = getTimezoneOffset(getTimeZone());
11
+ console.log(lazyEvent, "LazyEvent en el filtro");
11
12
 
12
13
  const queryBuilder = repository
13
14
  .createQueryBuilder("locals_company_information_for_the_table")
@@ -21,7 +22,7 @@ export async function getLocalsCompanyInformation(
21
22
  ].value.toLowerCase()}%`;
22
23
  queryBuilder.andWhere(
23
24
  "(LOWER(locals_company_information_for_the_table.name) LIKE :globalValue OR LOWER(locals_company_information_for_the_table.address) LIKE :globalValue OR LOWER(locals_company_information_for_the_table.partner_name) LIKE :globalValue OR LOWER(locals_company_information_for_the_table.partner_surname) LIKE :globalValue OR LOWER(locals_company_information_for_the_table.partner_full_name) LIKE :globalValue OR locals_company_information_for_the_table.partner_full_name LIKE :globalValue",
24
- { globalValue }
25
+ { globalValue },
25
26
  );
26
27
  }
27
28
 
@@ -31,7 +32,7 @@ export async function getLocalsCompanyInformation(
31
32
  "locals_company_information_for_the_table.status = :status",
32
33
  {
33
34
  status,
34
- }
35
+ },
35
36
  );
36
37
  }
37
38
 
@@ -41,7 +42,7 @@ export async function getLocalsCompanyInformation(
41
42
  "locals_company_information_for_the_table.company = :company",
42
43
  {
43
44
  company,
44
- }
45
+ },
45
46
  );
46
47
  }
47
48
 
@@ -51,7 +52,7 @@ export async function getLocalsCompanyInformation(
51
52
  "locals_company_information_for_the_table.visible = :visible",
52
53
  {
53
54
  visible,
54
- }
55
+ },
55
56
  );
56
57
  }
57
58
 
@@ -135,69 +136,45 @@ export async function getLocalsCompanyInformation(
135
136
  });
136
137
  }
137
138
  break;
138
- case "dateIs": // DOC: Si el modo de coincidencia es "dateIs". Hay que tener en cuenta la zona horaria (timezone)
139
- queryBuilder.andWhere(
140
- `${
141
- key !== "expiration" && key !== "start"
142
- ? "DATE(CONVERT_TZ("
143
- : ""
144
- } ${accessKey} ${
145
- key !== "expiration" && key !== "start"
146
- ? `, '+00:00', '${timezone}'))`
147
- : ""
148
- } != :${key}`,
149
- {
150
- [key]: value.split("T")[0],
151
- }
152
- );
153
- break;
154
- case "dateIsNot": // DOC: Si el modo de coincidencia es "dateIsNot". Hay que tener en cuenta la zona horaria (timezone)
155
- queryBuilder.andWhere(
156
- `${
157
- key !== "expiration" && key !== "start"
158
- ? "DATE(CONVERT_TZ("
159
- : ""
160
- } ${accessKey} ${
161
- key !== "expiration" && key !== "start"
162
- ? `, '+00:00', '${timezone}'))`
163
- : ""
164
- } = :${key}`,
165
- {
166
- [key]: value.split("T")[0],
167
- }
168
- );
139
+ case "dateIs": {
140
+ // DOC: Si el modo de coincidencia es "dateIs". Hay que tener en cuenta la zona horaria (timezone)
141
+ const date = new Date(value);
142
+ const start = new Date(date);
143
+ start.setUTCHours(0, 0, 0, 0);
144
+
145
+ const end = new Date(date);
146
+ end.setUTCHours(23, 59, 59, 999);
147
+
148
+ queryBuilder.andWhere(`${accessKey} BETWEEN :start AND :end`, {
149
+ start,
150
+ end,
151
+ });
152
+ break;
153
+ }
154
+ case "dateIsNot": {
155
+ // DOC: Si el modo de coincidencia es "dateIsNot". Hay que tener en cuenta la zona horaria (timezone)
156
+ const date = new Date(value);
157
+ const start = new Date(date);
158
+ start.setUTCHours(0, 0, 0, 0);
159
+
160
+ const end = new Date(date);
161
+ end.setUTCHours(23, 59, 59, 999);
162
+
163
+ queryBuilder.andWhere(`${accessKey} NOT BETWEEN :start AND :end`, {
164
+ start,
165
+ end,
166
+ });
169
167
  break;
168
+ }
170
169
  case "dateBefore": // DOC: Si el modo de coincidencia es "dateBefore". Hay que tener en cuenta la zona horaria (timezone)
171
- queryBuilder.andWhere(
172
- `${
173
- key !== "expiration" && key !== "start"
174
- ? "DATE(CONVERT_TZ("
175
- : ""
176
- } ${accessKey} ${
177
- key !== "expiration" && key !== "start"
178
- ? `, '+00:00', '${timezone}'))`
179
- : ""
180
- } < :${key}`,
181
- {
182
- [key]: value.split("T")[0],
183
- }
184
- );
170
+ queryBuilder.andWhere(`${accessKey} < :${key}`, {
171
+ [key]: new Date(value),
172
+ });
185
173
  break;
186
174
  case "dateAfter": // DOC: Si el modo de coincidencia es "dateAfter". Hay que tener en cuenta la zona horaria (timezone)
187
- queryBuilder.andWhere(
188
- `${
189
- key !== "expiration" && key !== "start"
190
- ? "DATE(CONVERT_TZ("
191
- : ""
192
- } ${accessKey} ${
193
- key !== "expiration" && key !== "start"
194
- ? `, '+00:00', '${timezone}'))`
195
- : ""
196
- } > :${key}`,
197
- {
198
- [key]: value.split("T")[0],
199
- }
200
- );
175
+ queryBuilder.andWhere(`${accessKey} > :${key}`, {
176
+ [key]: new Date(value),
177
+ });
201
178
  break;
202
179
  default: // DOC: Si el modo de coincidencia no es ninguno de los anteriores.
203
180
  break;
@@ -210,7 +187,7 @@ export async function getLocalsCompanyInformation(
210
187
  const sortOrder = lazyEvent.sortOrder === 1 ? "ASC" : "DESC";
211
188
  queryBuilder.addOrderBy(
212
189
  `locals_company_information_for_the_table.${lazyEvent.sortField}`,
213
- sortOrder
190
+ sortOrder,
214
191
  );
215
192
  }
216
193
 
@@ -1,6 +1,4 @@
1
1
  import { ViewColumn, ViewEntity } from "typeorm";
2
- import moment = require("moment-timezone");
3
- import { getTimeZone } from "..";
4
2
 
5
3
  const jsonTransformer = {
6
4
  to: (value: any) => JSON.stringify(value),
@@ -14,14 +12,14 @@ const jsonTransformer = {
14
12
  },
15
13
  };
16
14
 
17
- const DateTransformer = {
18
- to(value: Date | string): string {
19
- return moment.utc(value).format("YYYY-MM-DD HH:mm:ss");
20
- },
21
- from(value: string): string {
22
- return moment.utc(value).tz(getTimeZone()).format("YYYY-MM-DD HH:mm:ss");
23
- },
24
- };
15
+ // const DateTransformer = {
16
+ // to(value: Date | string): string {
17
+ // return moment.utc(value).format("YYYY-MM-DD HH:mm:ss");
18
+ // },
19
+ // from(value: string): string {
20
+ // return moment.utc(value).tz(getTimeZone()).format("YYYY-MM-DD HH:mm:ss");
21
+ // },
22
+ // };
25
23
 
26
24
  @ViewEntity({
27
25
  name: "locals_company_information_for_the_table",
@@ -51,11 +49,11 @@ export class LocalsCompanyInformationForTheTable {
51
49
  @ViewColumn({ transformer: jsonTransformer })
52
50
  details: any | null;
53
51
 
54
- @ViewColumn({ transformer: DateTransformer })
55
- created: string;
52
+ @ViewColumn()
53
+ created: Date;
56
54
 
57
- @ViewColumn({ transformer: DateTransformer })
58
- updated: string;
55
+ @ViewColumn()
56
+ updated: Date;
59
57
 
60
58
  @ViewColumn()
61
59
  updated_by: number;
@@ -93,7 +91,7 @@ export class LocalsCompanyInformationForTheTable {
93
91
  @ViewColumn()
94
92
  company_name: string;
95
93
 
96
- @ViewColumn({ transformer: DateTransformer })
94
+ @ViewColumn()
97
95
  company_expiration: string | null;
98
96
 
99
97
  @ViewColumn()
@@ -153,7 +151,7 @@ export class LocalsCompanyInformationForTheTable {
153
151
  @ViewColumn({ transformer: jsonTransformer })
154
152
  country_details: any | null;
155
153
 
156
- @ViewColumn({ transformer: DateTransformer })
154
+ @ViewColumn({ transformer: jsonTransformer })
157
155
  country_legal_agent: string | null;
158
156
 
159
157
  @ViewColumn({ transformer: jsonTransformer })
@@ -210,11 +208,11 @@ export class LocalsCompanyInformationForTheTable {
210
208
  @ViewColumn()
211
209
  partner_visible: number;
212
210
 
213
- @ViewColumn({ transformer: DateTransformer })
214
- partner_created: string;
211
+ @ViewColumn()
212
+ partner_created: Date;
215
213
 
216
- @ViewColumn({ transformer: DateTransformer })
217
- partner_updated: string;
214
+ @ViewColumn()
215
+ partner_updated: Date;
218
216
 
219
217
  @ViewColumn()
220
218
  square_id: number;
@@ -255,11 +253,11 @@ export class LocalsCompanyInformationForTheTable {
255
253
  @ViewColumn()
256
254
  local_plan_price: number;
257
255
 
258
- @ViewColumn({ transformer: DateTransformer })
259
- local_plan_start_date: string;
256
+ @ViewColumn()
257
+ local_plan_start_date: Date;
260
258
 
261
- @ViewColumn({ transformer: DateTransformer })
262
- local_plan_end_date: string;
259
+ @ViewColumn()
260
+ local_plan_end_date: Date;
263
261
 
264
262
  @ViewColumn({ transformer: jsonTransformer })
265
263
  local_plan_settings: any | null;
@@ -273,8 +271,8 @@ export class LocalsCompanyInformationForTheTable {
273
271
  @ViewColumn()
274
272
  plan_company: number;
275
273
 
276
- @ViewColumn({ transformer: DateTransformer })
277
- plan_created: string;
274
+ @ViewColumn()
275
+ plan_created: Date;
278
276
 
279
277
  @ViewColumn()
280
278
  plan_name: string;
@@ -288,8 +286,8 @@ export class LocalsCompanyInformationForTheTable {
288
286
  @ViewColumn()
289
287
  plan_quantity_locals: number;
290
288
 
291
- @ViewColumn({ transformer: DateTransformer })
292
- plan_expiration: string;
289
+ @ViewColumn()
290
+ plan_expiration: Date;
293
291
 
294
292
  @ViewColumn()
295
293
  plan_status: number;