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.
Files changed (103) hide show
  1. package/dist/CustomRepository.js +21 -109
  2. package/dist/entities/AuthenticationCredential.js +54 -57
  3. package/dist/entities/Bank.js +50 -53
  4. package/dist/entities/BusinessType.js +47 -50
  5. package/dist/entities/BusinessTypeProduct.js +68 -71
  6. package/dist/entities/Category.js +148 -151
  7. package/dist/entities/CategoryDate.js +39 -42
  8. package/dist/entities/CategorySchedule.js +41 -44
  9. package/dist/entities/City.js +70 -73
  10. package/dist/entities/CodeRedemptionHistoryCompany.js +44 -47
  11. package/dist/entities/CodeRedemptionHistoryUser.js +54 -57
  12. package/dist/entities/Company.js +169 -172
  13. package/dist/entities/Configuration.d.ts +1 -1
  14. package/dist/entities/Configuration.js +25 -26
  15. package/dist/entities/Country.js +91 -94
  16. package/dist/entities/Day.js +38 -41
  17. package/dist/entities/DecorationReserve.js +46 -49
  18. package/dist/entities/DiscountCodeCompany.js +124 -129
  19. package/dist/entities/DiscountCodeUser.js +139 -142
  20. package/dist/entities/Gallery.js +88 -91
  21. package/dist/entities/Local.js +239 -242
  22. package/dist/entities/LocalDecorationReserve.js +64 -67
  23. package/dist/entities/LocalPaymentMethod.js +41 -44
  24. package/dist/entities/LocalPlan.js +88 -91
  25. package/dist/entities/LocalQualification.js +51 -54
  26. package/dist/entities/LocalReserve.js +177 -180
  27. package/dist/entities/LocalReserveStatus.js +85 -88
  28. package/dist/entities/LocalTable.js +163 -166
  29. package/dist/entities/LocalTableReserve.js +22 -25
  30. package/dist/entities/LocalTableReservePayment.js +156 -159
  31. package/dist/entities/LocalTableZone.js +84 -87
  32. package/dist/entities/Master.js +182 -185
  33. package/dist/entities/MasterNotification.js +96 -99
  34. package/dist/entities/MasterPermission.js +65 -68
  35. package/dist/entities/MasterRole.js +83 -86
  36. package/dist/entities/Partner.js +306 -309
  37. package/dist/entities/PartnerNotification.js +97 -100
  38. package/dist/entities/PartnerPlatform.js +66 -69
  39. package/dist/entities/PartnerPlatformSection.js +74 -79
  40. package/dist/entities/PartnerPlatformSectionPermission.js +113 -118
  41. package/dist/entities/PartnerPlatformSectionPermissionAssociate.js +26 -29
  42. package/dist/entities/PartnerRole.js +93 -96
  43. package/dist/entities/PartnerSession.js +94 -97
  44. package/dist/entities/PaymentMethod.js +91 -94
  45. package/dist/entities/Plan.js +86 -89
  46. package/dist/entities/PosSystem.js +69 -74
  47. package/dist/entities/Product.js +219 -222
  48. package/dist/entities/ProductDate.js +39 -42
  49. package/dist/entities/ProductGroup.js +76 -79
  50. package/dist/entities/ProductImage.js +33 -36
  51. package/dist/entities/ProductIngredient.js +54 -57
  52. package/dist/entities/ProductSchedule.js +41 -44
  53. package/dist/entities/ProductTopping.js +47 -50
  54. package/dist/entities/ReceiptConfig.js +184 -187
  55. package/dist/entities/Region.js +46 -49
  56. package/dist/entities/Request.js +152 -155
  57. package/dist/entities/RequestInvoice.js +125 -128
  58. package/dist/entities/RequestInvoiceCategory.js +34 -37
  59. package/dist/entities/RequestLocal.js +164 -169
  60. package/dist/entities/RequestLocalHistory.js +61 -64
  61. package/dist/entities/RequestLocalPayment.js +154 -157
  62. package/dist/entities/RequestLocalTable.js +34 -37
  63. package/dist/entities/RequestPrint.js +60 -63
  64. package/dist/entities/RequestProduct.js +58 -61
  65. package/dist/entities/RequestProductGroupComplement.js +51 -56
  66. package/dist/entities/ServiceDiscountsPlan.js +30 -33
  67. package/dist/entities/ServicePlan.js +84 -87
  68. package/dist/entities/Square.js +130 -133
  69. package/dist/entities/ToppingImage.js +56 -59
  70. package/dist/entities/TypeMeasureIngredient.js +45 -48
  71. package/dist/entities/User.js +234 -237
  72. package/dist/entities/UserAddress.js +114 -117
  73. package/dist/entities/UserPaymentMethod.js +118 -121
  74. package/dist/entities/VerificationCode.js +60 -63
  75. package/dist/entities/VerifyLocal.js +142 -145
  76. package/dist/entities/productGroupComplement.js +117 -120
  77. package/dist/filters/DiscountsCodeCompanyInformation.js +153 -202
  78. package/dist/filters/DiscountsCodeUserInformation.js +173 -220
  79. package/dist/filters/LocalReservesInformation.js +35 -81
  80. package/dist/filters/LocalsCompanyInformation.js +169 -218
  81. package/dist/filters/LocalsCompanyInformationForTheTable.js +157 -203
  82. package/dist/filters/VerifyLocalsInformation.js +131 -179
  83. package/dist/index.js +55 -130
  84. package/dist/transformers/dateTransformer.js +10 -13
  85. package/dist/transformers/jsonEncryptionTransformer.d.ts +2 -0
  86. package/dist/transformers/jsonEncryptionTransformer.js +72 -0
  87. package/dist/transformers/jsonTransformer.js +2 -2
  88. package/dist/utils.js +3 -3
  89. package/dist/views/DiscountsCodeUser.js +120 -123
  90. package/dist/views/LocalReserves.js +280 -283
  91. package/dist/views/LocalTableZonesFilter.js +76 -79
  92. package/dist/views/LocalsCompany.js +172 -175
  93. package/dist/views/LocalsCompanyInformationForTheMap.js +276 -279
  94. package/dist/views/LocalsCompanyInformationForTheTable.js +384 -387
  95. package/dist/views/MasterNotifications.js +132 -135
  96. package/dist/views/PartnerNotifications.js +104 -107
  97. package/dist/views/Partners.js +140 -143
  98. package/dist/views/VerifyLocals.js +152 -155
  99. package/dist/views/ViewLocalsCompanies.js +100 -103
  100. package/package.json +3 -2
  101. package/src/entities/Configuration.ts +3 -1
  102. package/src/transformers/jsonEncryptionTransformer.ts +78 -0
  103. 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
- var __1 = require("..");
41
- var utils_1 = require("../utils");
42
- function getLocalsCompanyInformation(repository_1, _a) {
43
- return __awaiter(this, arguments, void 0, function (repository, _b) {
44
- var timezone_1, queryBuilder_1, globalValue, filters_1, order, _c, locals, totalRecords, error_1;
45
- var company = _b.company, status = _b.status, visible = _b.visible, lazyEvent = _b.lazyEvent;
46
- return __generator(this, function (_d) {
47
- switch (_d.label) {
48
- case 0:
49
- _d.trys.push([0, 2, , 3]);
50
- timezone_1 = (0, __1.getTimezoneOffset)((0, __1.getTimeZone)());
51
- queryBuilder_1 = repository
52
- .createQueryBuilder("view_locals_companies")
53
- .skip(lazyEvent.first)
54
- .take(lazyEvent.rows);
55
- // DOC: Filtro global
56
- if (lazyEvent.filters["global"] && lazyEvent.filters["global"].value) {
57
- globalValue = "%".concat(lazyEvent.filters["global"].value.toLowerCase(), "%");
58
- queryBuilder_1.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)", {
59
- globalValue: globalValue ||
60
- (0, utils_1.getStatusBasic)(lazyEvent.filters["global"].value.toLowerCase()),
61
- });
62
- }
63
- // DOC: Filtro por estado FILTRO POR DEFECTO
64
- if (status !== null && status >= 0) {
65
- queryBuilder_1.andWhere("view_locals_companies.status = :status", {
66
- status: status,
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
- // DOC: Filtro por company FILTRO POR DEFECTO
70
- if (company !== null && company >= 0) {
71
- queryBuilder_1.andWhere("view_locals_companies.company = :company", {
72
- company: company,
71
+ break;
72
+ case "startsWith":
73
+ queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
74
+ [key]: `${value}%`,
73
75
  });
74
- }
75
- if (visible !== null) {
76
- queryBuilder_1.andWhere("view_locals_companies.visible = :visible", {
77
- visible: visible,
76
+ break;
77
+ case "endsWith":
78
+ queryBuilder.andWhere(`${accessKey} LIKE :${key}`, {
79
+ [key]: `${value}%`,
78
80
  });
79
- }
80
- filters_1 = lazyEvent.filters;
81
- Object.keys(filters_1).forEach(function (key) {
82
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
83
- var _l, _m;
84
- var value = filters_1[key].value;
85
- if ((Array.isArray(value) && value.length > 0) ||
86
- (!Array.isArray(value) && value && key !== "global")) {
87
- var matchMode = filters_1[key].matchMode;
88
- if (!Array.isArray(value) && value) {
89
- value = filters_1[key].value.toLowerCase();
90
- }
91
- var accessKey = key.split(".").length > 1 ? "".concat(key) : "view_locals_companies.".concat(key);
92
- switch (matchMode) {
93
- case "custom":
94
- if (key === "total_partners" && matchMode === "custom") {
95
- var _o = value || [null, null], from = _o[0], to = _o[1];
96
- if (from !== null && to === null) {
97
- queryBuilder_1.andWhere("view_locals_companies.".concat(key, " >= :from"), {
98
- from: from,
99
- });
100
- }
101
- else if (from === null && to !== null) {
102
- queryBuilder_1.andWhere("view_locals_companies.".concat(key, " <= :to"), {
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
- if (lazyEvent.sortField) {
209
- order = lazyEvent.sortOrder === 1 ? "ASC" : "DESC";
210
- queryBuilder_1.orderBy("view_locals_companies.".concat(lazyEvent.sortField), order);
211
- }
212
- return [4 /*yield*/, queryBuilder_1.getManyAndCount()];
213
- case 1:
214
- _c = _d.sent(), locals = _c[0], totalRecords = _c[1];
215
- return [2 /*return*/, {
216
- data: locals,
217
- totalRecords: totalRecords,
218
- }];
219
- case 2:
220
- error_1 = _d.sent();
221
- return [2 /*return*/, {
222
- data: [],
223
- totalRecords: 0,
224
- }];
225
- case 3: return [2 /*return*/];
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;