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,230 +1,181 @@
|
|
|
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
|
-
|
|
42
|
-
function getLocalsCompanyInformation(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
async function getLocalsCompanyInformation(repository, { company, status, visible, lazyEvent }) {
|
|
7
|
+
try {
|
|
8
|
+
const timezone = (0, __1.getTimezoneOffset)((0, __1.getTimeZone)());
|
|
9
|
+
const queryBuilder = repository
|
|
10
|
+
.createQueryBuilder("view_locals_companies")
|
|
11
|
+
.skip(lazyEvent.first)
|
|
12
|
+
.take(lazyEvent.rows);
|
|
13
|
+
// DOC: Filtro global
|
|
14
|
+
if (lazyEvent.filters["global"] && lazyEvent.filters["global"].value) {
|
|
15
|
+
const globalValue = `%${lazyEvent.filters["global"].value.toLowerCase()}%`;
|
|
16
|
+
queryBuilder.andWhere("(LOWER(view_locals_companies.name_local) LIKE :globalValue OR LOWER(view_locals_companies.country_name) LIKE :globalValue OR LOWER(view_locals_companies.city_name) LIKE :globalValue OR LOWER(view_locals_companies.address) LIKE :globalValue OR LOWER(view_locals_companies.cellphone) LIKE :globalValue OR LOWER(view_locals_companies.email) LIKE :globalValue OR LOWER(view_locals_companies.pos_system_name) LIKE :globalValue OR LOWER(view_locals_companies.created_local) LIKE :globalValue OR LOWER(view_locals_companies.updated_local) LIKE :globalValue)", {
|
|
17
|
+
globalValue: globalValue ||
|
|
18
|
+
(0, utils_1.getStatusBasic)(lazyEvent.filters["global"].value.toLowerCase()),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
// DOC: Filtro por estado FILTRO POR DEFECTO
|
|
22
|
+
if (status !== null && status >= 0) {
|
|
23
|
+
queryBuilder.andWhere("view_locals_companies.status = :status", {
|
|
24
|
+
status: status,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// DOC: Filtro por company FILTRO POR DEFECTO
|
|
28
|
+
if (company !== null && company >= 0) {
|
|
29
|
+
queryBuilder.andWhere("view_locals_companies.company = :company", {
|
|
30
|
+
company: company,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (visible !== null) {
|
|
34
|
+
queryBuilder.andWhere("view_locals_companies.visible = :visible", {
|
|
35
|
+
visible: visible,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const filters = lazyEvent.filters;
|
|
39
|
+
Object.keys(filters).forEach((key) => {
|
|
40
|
+
let value = filters[key].value;
|
|
41
|
+
if ((Array.isArray(value) && value.length > 0) ||
|
|
42
|
+
(!Array.isArray(value) && value && key !== "global")) {
|
|
43
|
+
const matchMode = filters[key].matchMode;
|
|
44
|
+
if (!Array.isArray(value) && value) {
|
|
45
|
+
value = filters[key].value.toLowerCase();
|
|
46
|
+
}
|
|
47
|
+
const accessKey = key.split(".").length > 1 ? `${key}` : `view_locals_companies.${key}`;
|
|
48
|
+
switch (matchMode) {
|
|
49
|
+
case "custom":
|
|
50
|
+
if (key === "total_partners" && matchMode === "custom") {
|
|
51
|
+
const [from, to] = value || [null, null];
|
|
52
|
+
if (from !== null && to === null) {
|
|
53
|
+
queryBuilder.andWhere(`view_locals_companies.${key} >= :from`, {
|
|
54
|
+
from,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else if (from === null && to !== null) {
|
|
58
|
+
queryBuilder.andWhere(`view_locals_companies.${key} <= :to`, {
|
|
59
|
+
to,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
else if (from !== null && to !== null) {
|
|
63
|
+
queryBuilder.andWhere(`view_locals_companies.${key} BETWEEN :from AND :to`, { from, to });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case "contains":
|
|
68
|
+
queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
|
|
69
|
+
[key]: `%${value}%`,
|
|
67
70
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
company: company,
|
|
71
|
+
break;
|
|
72
|
+
case "startsWith":
|
|
73
|
+
queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
|
|
74
|
+
[key]: `${value}%`,
|
|
73
75
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
break;
|
|
77
|
+
case "endsWith":
|
|
78
|
+
queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
|
|
79
|
+
[key]: `${value}%`,
|
|
78
80
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
to: to,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
else if (from !== null && to !== null) {
|
|
107
|
-
queryBuilder_1.andWhere("view_locals_companies.".concat(key, " BETWEEN :from AND :to"), { from: from, to: to });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
break;
|
|
111
|
-
case "contains":
|
|
112
|
-
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_a = {},
|
|
113
|
-
_a[key] = "%".concat(value, "%"),
|
|
114
|
-
_a));
|
|
115
|
-
break;
|
|
116
|
-
case "startsWith":
|
|
117
|
-
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_b = {},
|
|
118
|
-
_b[key] = "".concat(value, "%"),
|
|
119
|
-
_b));
|
|
120
|
-
break;
|
|
121
|
-
case "endsWith":
|
|
122
|
-
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_c = {},
|
|
123
|
-
_c[key] = "".concat(value, "%"),
|
|
124
|
-
_c));
|
|
125
|
-
break;
|
|
126
|
-
case "equals":
|
|
127
|
-
if (key === "status") {
|
|
128
|
-
queryBuilder_1.andWhere("view_locals_companies.status = :status", {
|
|
129
|
-
status: (0, utils_1.getStatusBasic)((_l = filters_1[key].value) !== null && _l !== void 0 ? _l : ""),
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
else if (key === "typeText") {
|
|
133
|
-
queryBuilder_1.andWhere("view_locals_companies.type = :type", {
|
|
134
|
-
type: (0, utils_1.getSeverityNameDiscountType)((_m = filters_1[key].value) !== null && _m !== void 0 ? _m : ""),
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
else if (key === "has_square") {
|
|
138
|
-
var hasSI = filters_1[key].value.includes("SI");
|
|
139
|
-
var hasNO = filters_1[key].value.includes("NO");
|
|
140
|
-
var queryPlazolet = hasSI && hasNO
|
|
141
|
-
? ""
|
|
142
|
-
: hasSI
|
|
143
|
-
? "view_locals_companies.has_square IS NOT NULL"
|
|
144
|
-
: hasNO
|
|
145
|
-
? "view_locals_companies.has_square IS NULL"
|
|
146
|
-
: "";
|
|
147
|
-
if (queryPlazolet !== "") {
|
|
148
|
-
queryBuilder_1.andWhere(queryPlazolet);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
queryBuilder_1.andWhere("".concat(accessKey, " = :").concat(key), (_d = {},
|
|
153
|
-
_d[key] = value,
|
|
154
|
-
_d));
|
|
155
|
-
}
|
|
156
|
-
break;
|
|
157
|
-
case "notContains":
|
|
158
|
-
queryBuilder_1.andWhere("".concat(accessKey, " NOT LIKE :").concat(key), (_e = {},
|
|
159
|
-
_e[key] = "%".concat(value, "%"),
|
|
160
|
-
_e));
|
|
161
|
-
break;
|
|
162
|
-
case "notEquals":
|
|
163
|
-
queryBuilder_1.andWhere("".concat(accessKey, " != :").concat(key), (_f = {},
|
|
164
|
-
_f[key] = value,
|
|
165
|
-
_f));
|
|
166
|
-
break;
|
|
167
|
-
case "dateIs":
|
|
168
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
169
|
-
? "DATE(CONVERT_TZ("
|
|
170
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
171
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
172
|
-
: "", " = :").concat(key), (_g = {},
|
|
173
|
-
_g[key] = value.split("T")[0],
|
|
174
|
-
_g));
|
|
175
|
-
break;
|
|
176
|
-
case "dateIsNot":
|
|
177
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
178
|
-
? "DATE(CONVERT_TZ("
|
|
179
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
180
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
181
|
-
: "", " != :").concat(key), (_h = {},
|
|
182
|
-
_h[key] = value.split("T")[0],
|
|
183
|
-
_h));
|
|
184
|
-
break;
|
|
185
|
-
case "dateBefore":
|
|
186
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
187
|
-
? "DATE(CONVERT_TZ("
|
|
188
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
189
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
190
|
-
: "", " < :").concat(key), (_j = {},
|
|
191
|
-
_j[key] = value.split("T")[0],
|
|
192
|
-
_j));
|
|
193
|
-
break;
|
|
194
|
-
case "dateAfter":
|
|
195
|
-
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
196
|
-
? "DATE(CONVERT_TZ("
|
|
197
|
-
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
198
|
-
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
199
|
-
: "", " > :").concat(key), (_k = {},
|
|
200
|
-
_k[key] = value.split("T")[0],
|
|
201
|
-
_k));
|
|
202
|
-
break;
|
|
203
|
-
default:
|
|
204
|
-
break;
|
|
81
|
+
break;
|
|
82
|
+
case "equals":
|
|
83
|
+
if (key === "status") {
|
|
84
|
+
queryBuilder.andWhere("view_locals_companies.status = :status", {
|
|
85
|
+
status: (0, utils_1.getStatusBasic)(filters[key].value ?? ""),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else if (key === "typeText") {
|
|
89
|
+
queryBuilder.andWhere("view_locals_companies.type = :type", {
|
|
90
|
+
type: (0, utils_1.getSeverityNameDiscountType)(filters[key].value ?? ""),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else if (key === "has_square") {
|
|
94
|
+
const hasSI = filters[key].value.includes("SI");
|
|
95
|
+
const hasNO = filters[key].value.includes("NO");
|
|
96
|
+
const queryPlazolet = hasSI && hasNO
|
|
97
|
+
? ""
|
|
98
|
+
: hasSI
|
|
99
|
+
? "view_locals_companies.has_square IS NOT NULL"
|
|
100
|
+
: hasNO
|
|
101
|
+
? "view_locals_companies.has_square IS NULL"
|
|
102
|
+
: "";
|
|
103
|
+
if (queryPlazolet !== "") {
|
|
104
|
+
queryBuilder.andWhere(queryPlazolet);
|
|
205
105
|
}
|
|
206
106
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
107
|
+
else {
|
|
108
|
+
queryBuilder.andWhere(`${accessKey} = :${key}`, {
|
|
109
|
+
[key]: value,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
case "notContains":
|
|
114
|
+
queryBuilder.andWhere(`${accessKey} NOT LIKE :${key}`, {
|
|
115
|
+
[key]: `%${value}%`,
|
|
116
|
+
});
|
|
117
|
+
break;
|
|
118
|
+
case "notEquals":
|
|
119
|
+
queryBuilder.andWhere(`${accessKey} != :${key}`, {
|
|
120
|
+
[key]: value,
|
|
121
|
+
});
|
|
122
|
+
break;
|
|
123
|
+
case "dateIs":
|
|
124
|
+
queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
|
|
125
|
+
? "DATE(CONVERT_TZ("
|
|
126
|
+
: ""} ${accessKey} ${key !== "expiration" && key !== "start"
|
|
127
|
+
? `, '+00:00', '${timezone}'))`
|
|
128
|
+
: ""} = :${key}`, {
|
|
129
|
+
[key]: value.split("T")[0],
|
|
130
|
+
});
|
|
131
|
+
break;
|
|
132
|
+
case "dateIsNot":
|
|
133
|
+
queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
|
|
134
|
+
? "DATE(CONVERT_TZ("
|
|
135
|
+
: ""} ${accessKey} ${key !== "expiration" && key !== "start"
|
|
136
|
+
? `, '+00:00', '${timezone}'))`
|
|
137
|
+
: ""} != :${key}`, {
|
|
138
|
+
[key]: value.split("T")[0],
|
|
139
|
+
});
|
|
140
|
+
break;
|
|
141
|
+
case "dateBefore":
|
|
142
|
+
queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
|
|
143
|
+
? "DATE(CONVERT_TZ("
|
|
144
|
+
: ""} ${accessKey} ${key !== "expiration" && key !== "start"
|
|
145
|
+
? `, '+00:00', '${timezone}'))`
|
|
146
|
+
: ""} < :${key}`, {
|
|
147
|
+
[key]: value.split("T")[0],
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
case "dateAfter":
|
|
151
|
+
queryBuilder.andWhere(`${key !== "expiration" && key !== "start"
|
|
152
|
+
? "DATE(CONVERT_TZ("
|
|
153
|
+
: ""} ${accessKey} ${key !== "expiration" && key !== "start"
|
|
154
|
+
? `, '+00:00', '${timezone}'))`
|
|
155
|
+
: ""} > :${key}`, {
|
|
156
|
+
[key]: value.split("T")[0],
|
|
157
|
+
});
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
226
162
|
}
|
|
227
163
|
});
|
|
228
|
-
|
|
164
|
+
if (lazyEvent.sortField) {
|
|
165
|
+
const order = lazyEvent.sortOrder === 1 ? "ASC" : "DESC";
|
|
166
|
+
queryBuilder.orderBy(`view_locals_companies.${lazyEvent.sortField}`, order);
|
|
167
|
+
}
|
|
168
|
+
const [locals, totalRecords] = await queryBuilder.getManyAndCount();
|
|
169
|
+
return {
|
|
170
|
+
data: locals,
|
|
171
|
+
totalRecords,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
return {
|
|
176
|
+
data: [],
|
|
177
|
+
totalRecords: 0,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
229
180
|
}
|
|
230
181
|
exports.getLocalsCompanyInformation = getLocalsCompanyInformation;
|