test-entity-library-asm 3.9.5 → 3.9.7
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.
- package/dist/CustomRepository.js +21 -109
- package/dist/entities/AuthenticationCredential.js +54 -57
- package/dist/entities/Bank.js +50 -53
- package/dist/entities/BusinessType.js +47 -50
- package/dist/entities/BusinessTypeProduct.js +68 -71
- package/dist/entities/Category.js +148 -151
- package/dist/entities/CategoryDate.js +39 -42
- package/dist/entities/CategorySchedule.js +41 -44
- package/dist/entities/City.js +70 -73
- package/dist/entities/CodeRedemptionHistoryCompany.js +44 -47
- package/dist/entities/CodeRedemptionHistoryUser.js +54 -57
- package/dist/entities/Company.js +169 -172
- package/dist/entities/Configuration.d.ts +1 -1
- package/dist/entities/Configuration.js +25 -26
- package/dist/entities/Country.js +91 -94
- package/dist/entities/Day.js +38 -41
- package/dist/entities/DecorationReserve.js +46 -49
- package/dist/entities/DiscountCodeCompany.js +124 -129
- package/dist/entities/DiscountCodeUser.js +139 -142
- package/dist/entities/Gallery.js +88 -91
- package/dist/entities/Local.js +239 -242
- package/dist/entities/LocalDecorationReserve.js +64 -67
- package/dist/entities/LocalPaymentMethod.js +41 -44
- package/dist/entities/LocalPlan.js +88 -91
- package/dist/entities/LocalQualification.js +51 -54
- package/dist/entities/LocalReserve.js +177 -180
- package/dist/entities/LocalReserveStatus.js +85 -88
- package/dist/entities/LocalTable.js +163 -166
- package/dist/entities/LocalTableReserve.js +22 -25
- package/dist/entities/LocalTableReservePayment.js +156 -159
- package/dist/entities/LocalTableZone.js +84 -87
- package/dist/entities/Master.js +182 -185
- package/dist/entities/MasterNotification.js +96 -99
- package/dist/entities/MasterPermission.js +65 -68
- package/dist/entities/MasterRole.js +83 -86
- package/dist/entities/Partner.js +306 -309
- package/dist/entities/PartnerNotification.js +97 -100
- package/dist/entities/PartnerPlatform.js +66 -69
- package/dist/entities/PartnerPlatformSection.js +74 -79
- package/dist/entities/PartnerPlatformSectionPermission.js +113 -118
- package/dist/entities/PartnerPlatformSectionPermissionAssociate.js +26 -29
- package/dist/entities/PartnerRole.js +93 -96
- package/dist/entities/PartnerSession.js +94 -97
- package/dist/entities/PaymentMethod.js +91 -94
- package/dist/entities/Plan.js +86 -89
- package/dist/entities/PosSystem.js +69 -74
- package/dist/entities/Product.js +219 -222
- package/dist/entities/ProductDate.js +39 -42
- package/dist/entities/ProductGroup.js +76 -79
- package/dist/entities/ProductImage.js +33 -36
- package/dist/entities/ProductIngredient.js +54 -57
- package/dist/entities/ProductSchedule.js +41 -44
- package/dist/entities/ProductTopping.js +47 -50
- package/dist/entities/ReceiptConfig.js +184 -187
- package/dist/entities/Region.js +46 -49
- package/dist/entities/Request.js +152 -155
- package/dist/entities/RequestInvoice.js +125 -128
- package/dist/entities/RequestInvoiceCategory.js +34 -37
- package/dist/entities/RequestLocal.js +164 -169
- package/dist/entities/RequestLocalHistory.js +61 -64
- package/dist/entities/RequestLocalPayment.js +154 -157
- package/dist/entities/RequestLocalTable.js +34 -37
- package/dist/entities/RequestPrint.js +60 -63
- package/dist/entities/RequestProduct.js +58 -61
- package/dist/entities/RequestProductGroupComplement.js +51 -56
- package/dist/entities/ServiceDiscountsPlan.js +30 -33
- package/dist/entities/ServicePlan.js +84 -87
- package/dist/entities/Square.js +130 -133
- package/dist/entities/ToppingImage.js +56 -59
- package/dist/entities/TypeMeasureIngredient.js +45 -48
- package/dist/entities/User.js +234 -237
- package/dist/entities/UserAddress.js +114 -117
- package/dist/entities/UserPaymentMethod.js +118 -121
- package/dist/entities/VerificationCode.js +60 -63
- package/dist/entities/VerifyLocal.js +142 -145
- package/dist/entities/productGroupComplement.js +117 -120
- package/dist/filters/DiscountsCodeCompanyInformation.js +153 -202
- package/dist/filters/DiscountsCodeUserInformation.js +173 -220
- package/dist/filters/LocalReservesInformation.js +35 -81
- package/dist/filters/LocalsCompanyInformation.js +169 -218
- package/dist/filters/LocalsCompanyInformationForTheTable.js +157 -203
- package/dist/filters/VerifyLocalsInformation.js +131 -179
- package/dist/index.js +55 -130
- package/dist/transformers/dateTransformer.js +10 -13
- package/dist/transformers/jsonEncryptionTransformer.d.ts +2 -0
- package/dist/transformers/jsonEncryptionTransformer.js +72 -0
- package/dist/transformers/jsonTransformer.js +2 -2
- package/dist/utils.js +3 -3
- package/dist/views/DiscountsCodeUser.js +120 -123
- package/dist/views/LocalReserves.js +280 -283
- package/dist/views/LocalTableZonesFilter.js +76 -79
- package/dist/views/LocalsCompany.js +172 -175
- package/dist/views/LocalsCompanyInformationForTheMap.js +276 -279
- package/dist/views/LocalsCompanyInformationForTheTable.js +384 -387
- package/dist/views/MasterNotifications.js +132 -135
- package/dist/views/PartnerNotifications.js +104 -107
- package/dist/views/Partners.js +140 -143
- package/dist/views/VerifyLocals.js +152 -155
- package/dist/views/ViewLocalsCompanies.js +100 -103
- package/package.json +3 -2
- package/src/entities/Configuration.ts +3 -1
- package/src/transformers/jsonEncryptionTransformer.ts +78 -0
- package/tsconfig.json +7 -3
|
@@ -1,214 +1,168 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.getLocalsCompanyInformation = void 0;
|
|
40
|
-
|
|
41
|
-
function getLocalsCompanyInformation(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
async function getLocalsCompanyInformation(repository, { company, status, visible, lazyEvent }) {
|
|
6
|
+
try {
|
|
7
|
+
const timezone = (0, __1.getTimezoneOffset)((0, __1.getTimeZone)());
|
|
8
|
+
const queryBuilder = repository
|
|
9
|
+
.createQueryBuilder("locals_company_information_for_the_table")
|
|
10
|
+
.skip(lazyEvent.first)
|
|
11
|
+
.take(lazyEvent.rows);
|
|
12
|
+
// DOC: Filtro global
|
|
13
|
+
if (lazyEvent.filters["global"] && lazyEvent.filters["global"].value) {
|
|
14
|
+
const globalValue = `%${lazyEvent.filters["global"].value.toLowerCase()}%`;
|
|
15
|
+
queryBuilder.andWhere("(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", { globalValue });
|
|
16
|
+
}
|
|
17
|
+
// DOC: Filtro por estado FILTRO POR DEFECTO.
|
|
18
|
+
if (status !== null && status >= 0) {
|
|
19
|
+
queryBuilder.andWhere("locals_company_information_for_the_table.status = :status", {
|
|
20
|
+
status,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
// DOC: Filtro por company FILTRO POR DEFECTO.
|
|
24
|
+
if (company !== null && company >= 0) {
|
|
25
|
+
queryBuilder.andWhere("locals_company_information_for_the_table.company = :company", {
|
|
26
|
+
company,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// DOC: Filtro por visible FILTRO POR DEFECTO.
|
|
30
|
+
if (visible !== null) {
|
|
31
|
+
queryBuilder.andWhere("locals_company_information_for_the_table.visible = :visible", {
|
|
32
|
+
visible,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// DOC: Acá vienen los otros filtros, por las columnas de la tabla.
|
|
36
|
+
const filters = lazyEvent.filters;
|
|
37
|
+
Object.keys(filters).forEach((key) => {
|
|
38
|
+
let value = filters[key].value; // DOC: Obtenemos el valor del filtro.
|
|
39
|
+
if ((Array.isArray(value) && value.length > 0) ||
|
|
40
|
+
(!Array.isArray(value) && value && key !== "global")) {
|
|
41
|
+
// DOC: Verificamos si el filtro tiene valor, si no es un filtro global y no es un array vacío.
|
|
42
|
+
const matchMode = filters[key].matchMode; // DOC: Obtenemos el modo de coincidencia del filtro.
|
|
43
|
+
if (!Array.isArray(value) && value) {
|
|
44
|
+
// DOC: Si el valor no es un array y tiene valor, lo convertimos a minúsculas.
|
|
45
|
+
value = filters[key].value.toLowerCase();
|
|
46
|
+
}
|
|
47
|
+
const accessKey = key.split(".").length > 1
|
|
48
|
+
? `${key}`
|
|
49
|
+
: `locals_company_information_for_the_table.${key}`; // DOC: Verificamos si el filtro es un campo anidado o no.
|
|
50
|
+
switch (matchMode // DOC: Verificamos el modo de coincidencia del filtro.
|
|
51
|
+
) {
|
|
52
|
+
case "contains": // DOC: Si el modo de coincidencia es "contains".
|
|
53
|
+
queryBuilder.andWhere(`LOWER(${accessKey}) LIKE :${key}`, {
|
|
54
|
+
[key]: `%${value}%`,
|
|
63
55
|
});
|
|
64
|
-
|
|
65
|
-
// DOC:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
break;
|
|
57
|
+
case "equals": // DOC: Si el modo de coincidencia es "equals".
|
|
58
|
+
queryBuilder.andWhere(`${accessKey} = :${key}`, { [key]: value });
|
|
59
|
+
break;
|
|
60
|
+
case "notEquals": // DOC: Si el modo de coincidencia es "notEquals".
|
|
61
|
+
queryBuilder.andWhere(`${accessKey} != :${key}`, { [key]: value });
|
|
62
|
+
break;
|
|
63
|
+
case "startsWith": // DOC: Si el modo de coincidencia es "startsWith".
|
|
64
|
+
queryBuilder.andWhere(`LOWER(${accessKey}) LIKE :${key}`, {
|
|
65
|
+
[key]: `${value}%`,
|
|
69
66
|
});
|
|
70
|
-
|
|
71
|
-
// DOC:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
visible: visible,
|
|
67
|
+
break;
|
|
68
|
+
case "endsWith": // DOC: Si el modo de coincidencia es "endsWith".
|
|
69
|
+
queryBuilder.andWhere(`LOWER(${accessKey}) LIKE :${key}`, {
|
|
70
|
+
[key]: `%${value}`,
|
|
75
71
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
var accessKey = key.split(".").length > 1
|
|
90
|
-
? "".concat(key)
|
|
91
|
-
: "locals_company_information_for_the_table.".concat(key); // DOC: Verificamos si el filtro es un campo anidado o no.
|
|
92
|
-
switch (matchMode // DOC: Verificamos el modo de coincidencia del filtro.
|
|
93
|
-
) {
|
|
94
|
-
case "contains": // DOC: Si el modo de coincidencia es "contains".
|
|
95
|
-
queryBuilder_1.andWhere("LOWER(".concat(accessKey, ") LIKE :").concat(key), (_a = {},
|
|
96
|
-
_a[key] = "%".concat(value, "%"),
|
|
97
|
-
_a));
|
|
98
|
-
break;
|
|
99
|
-
case "equals": // DOC: Si el modo de coincidencia es "equals".
|
|
100
|
-
queryBuilder_1.andWhere("".concat(accessKey, " = :").concat(key), (_b = {}, _b[key] = value, _b));
|
|
101
|
-
break;
|
|
102
|
-
case "notEquals": // DOC: Si el modo de coincidencia es "notEquals".
|
|
103
|
-
queryBuilder_1.andWhere("".concat(accessKey, " != :").concat(key), (_c = {}, _c[key] = value, _c));
|
|
104
|
-
break;
|
|
105
|
-
case "startsWith": // DOC: Si el modo de coincidencia es "startsWith".
|
|
106
|
-
queryBuilder_1.andWhere("LOWER(".concat(accessKey, ") LIKE :").concat(key), (_d = {},
|
|
107
|
-
_d[key] = "".concat(value, "%"),
|
|
108
|
-
_d));
|
|
109
|
-
break;
|
|
110
|
-
case "endsWith": // DOC: Si el modo de coincidencia es "endsWith".
|
|
111
|
-
queryBuilder_1.andWhere("LOWER(".concat(accessKey, ") LIKE :").concat(key), (_e = {},
|
|
112
|
-
_e[key] = "%".concat(value),
|
|
113
|
-
_e));
|
|
114
|
-
break;
|
|
115
|
-
case "in": // DOC: Si el modo de coincidencia es "in".
|
|
116
|
-
if (Array.isArray(value)) {
|
|
117
|
-
queryBuilder_1.andWhere("".concat(accessKey, " IN (:...").concat(key, ")"), (_f = {},
|
|
118
|
-
_f[key] = value,
|
|
119
|
-
_f));
|
|
120
|
-
}
|
|
121
|
-
break;
|
|
122
|
-
case "notIn": // DOC: Si el modo de coincidencia es "notIn
|
|
123
|
-
if (Array.isArray(value)) {
|
|
124
|
-
queryBuilder_1.andWhere("".concat(accessKey, " NOT IN (:...").concat(key, ")"), (_g = {},
|
|
125
|
-
_g[key] = value,
|
|
126
|
-
_g));
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
case "lt": // DOC: Si el modo de coincidencia es "lt" (less than).
|
|
130
|
-
queryBuilder_1.andWhere("".concat(accessKey, " < :").concat(key), (_h = {}, _h[key] = value, _h));
|
|
131
|
-
break;
|
|
132
|
-
case "lte": // DOC: Si el modo de coincidencia es "lte" (less than or equal).
|
|
133
|
-
queryBuilder_1.andWhere("".concat(accessKey, " <= :").concat(key), (_j = {}, _j[key] = value, _j));
|
|
134
|
-
break;
|
|
135
|
-
case "gt": // DOC: Si el modo de coincidencia es "gt" (greater than).
|
|
136
|
-
queryBuilder_1.andWhere("".concat(accessKey, " > :").concat(key), (_k = {}, _k[key] = value, _k));
|
|
137
|
-
break;
|
|
138
|
-
case "gte": // DOC: Si el modo de coincidencia es "gte" (greater than or equal).
|
|
139
|
-
queryBuilder_1.andWhere("".concat(accessKey, " >= :").concat(key), (_l = {}, _l[key] = value, _l));
|
|
140
|
-
break;
|
|
141
|
-
case "between": // DOC: Si el modo de coincidencia es "between".
|
|
142
|
-
if (Array.isArray(value) && value.length === 2) {
|
|
143
|
-
var from = value[0], to = value[1];
|
|
144
|
-
queryBuilder_1.andWhere("".concat(accessKey, " BETWEEN :from AND :to"), {
|
|
145
|
-
from: from,
|
|
146
|
-
to: to,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
break;
|
|
150
|
-
case "dateIs": // DOC: Si el modo de coincidencia es "dateIs". Hay que tener en cuenta la zona horaria (timezone)
|
|
151
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
152
|
-
? "DATE(CONVERT_TZ("
|
|
153
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
154
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
155
|
-
: "", " != :").concat(key), (_m = {},
|
|
156
|
-
_m[key] = value.split("T")[0],
|
|
157
|
-
_m));
|
|
158
|
-
break;
|
|
159
|
-
case "dateIsNot": // DOC: Si el modo de coincidencia es "dateIsNot". Hay que tener en cuenta la zona horaria (timezone)
|
|
160
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
161
|
-
? "DATE(CONVERT_TZ("
|
|
162
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
163
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
164
|
-
: "", " = :").concat(key), (_o = {},
|
|
165
|
-
_o[key] = value.split("T")[0],
|
|
166
|
-
_o));
|
|
167
|
-
break;
|
|
168
|
-
case "dateBefore": // DOC: Si el modo de coincidencia es "dateBefore". Hay que tener en cuenta la zona horaria (timezone)
|
|
169
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
170
|
-
? "DATE(CONVERT_TZ("
|
|
171
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
172
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
173
|
-
: "", " < :").concat(key), (_p = {},
|
|
174
|
-
_p[key] = value.split("T")[0],
|
|
175
|
-
_p));
|
|
176
|
-
break;
|
|
177
|
-
case "dateAfter": // DOC: Si el modo de coincidencia es "dateAfter". Hay que tener en cuenta la zona horaria (timezone)
|
|
178
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
179
|
-
? "DATE(CONVERT_TZ("
|
|
180
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
181
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
182
|
-
: "", " > :").concat(key), (_q = {},
|
|
183
|
-
_q[key] = value.split("T")[0],
|
|
184
|
-
_q));
|
|
185
|
-
break;
|
|
186
|
-
default: // DOC: Si el modo de coincidencia no es ninguno de los anteriores.
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
72
|
+
break;
|
|
73
|
+
case "in": // DOC: Si el modo de coincidencia es "in".
|
|
74
|
+
if (Array.isArray(value)) {
|
|
75
|
+
queryBuilder.andWhere(`${accessKey} IN (:...${key})`, {
|
|
76
|
+
[key]: value,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
break;
|
|
80
|
+
case "notIn": // DOC: Si el modo de coincidencia es "notIn
|
|
81
|
+
if (Array.isArray(value)) {
|
|
82
|
+
queryBuilder.andWhere(`${accessKey} NOT IN (:...${key})`, {
|
|
83
|
+
[key]: value,
|
|
84
|
+
});
|
|
189
85
|
}
|
|
190
|
-
|
|
191
|
-
// DOC:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
86
|
+
break;
|
|
87
|
+
case "lt": // DOC: Si el modo de coincidencia es "lt" (less than).
|
|
88
|
+
queryBuilder.andWhere(`${accessKey} < :${key}`, { [key]: value });
|
|
89
|
+
break;
|
|
90
|
+
case "lte": // DOC: Si el modo de coincidencia es "lte" (less than or equal).
|
|
91
|
+
queryBuilder.andWhere(`${accessKey} <= :${key}`, { [key]: value });
|
|
92
|
+
break;
|
|
93
|
+
case "gt": // DOC: Si el modo de coincidencia es "gt" (greater than).
|
|
94
|
+
queryBuilder.andWhere(`${accessKey} > :${key}`, { [key]: value });
|
|
95
|
+
break;
|
|
96
|
+
case "gte": // DOC: Si el modo de coincidencia es "gte" (greater than or equal).
|
|
97
|
+
queryBuilder.andWhere(`${accessKey} >= :${key}`, { [key]: value });
|
|
98
|
+
break;
|
|
99
|
+
case "between": // DOC: Si el modo de coincidencia es "between".
|
|
100
|
+
if (Array.isArray(value) && value.length === 2) {
|
|
101
|
+
const [from, to] = value;
|
|
102
|
+
queryBuilder.andWhere(`${accessKey} BETWEEN :from AND :to`, {
|
|
103
|
+
from,
|
|
104
|
+
to,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
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],
|
|
115
|
+
});
|
|
116
|
+
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],
|
|
124
|
+
});
|
|
125
|
+
break;
|
|
126
|
+
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],
|
|
133
|
+
});
|
|
134
|
+
break;
|
|
135
|
+
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],
|
|
142
|
+
});
|
|
143
|
+
break;
|
|
144
|
+
default: // DOC: Si el modo de coincidencia no es ninguno de los anteriores.
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
210
147
|
}
|
|
211
148
|
});
|
|
212
|
-
|
|
149
|
+
// DOC: Ordenamiento de los resultados.
|
|
150
|
+
if (lazyEvent.sortField) {
|
|
151
|
+
const sortOrder = lazyEvent.sortOrder === 1 ? "ASC" : "DESC";
|
|
152
|
+
queryBuilder.addOrderBy(`locals_company_information_for_the_table.${lazyEvent.sortField}`, sortOrder);
|
|
153
|
+
}
|
|
154
|
+
// DOC: Ejecutamos la consulta y obtenemos los resultados.
|
|
155
|
+
const [data, totalRecords] = await queryBuilder.getManyAndCount();
|
|
156
|
+
return {
|
|
157
|
+
data,
|
|
158
|
+
totalRecords,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
return {
|
|
163
|
+
data: [],
|
|
164
|
+
totalRecords: 0,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
213
167
|
}
|
|
214
168
|
exports.getLocalsCompanyInformation = getLocalsCompanyInformation;
|