test-entity-library-asm 2.8.18 → 2.9.1
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.d.ts +7 -11
- package/dist/CustomRepository.js +14 -667
- package/dist/filters/DiscountsCodeCompanyInformation.d.ts +6 -0
- package/dist/filters/DiscountsCodeCompanyInformation.js +212 -0
- package/dist/filters/DiscountsCodeUserInformation.d.ts +6 -0
- package/dist/filters/DiscountsCodeUserInformation.js +234 -0
- package/dist/filters/LocalsCompanyInformation.d.ts +1 -1
- package/dist/filters/LocalsCompanyInformation.js +4 -1
- package/dist/filters/VerifyLocalsInformation.js +42 -33
- package/dist/views/MasterNotifications.d.ts +6 -15
- package/dist/views/MasterNotifications.js +24 -60
- package/package.json +1 -1
- package/src/CustomRepository.ts +9 -817
- package/src/filters/DiscountsCodeCompanyInformation.ts +216 -0
- package/src/filters/DiscountsCodeUserInformation.ts +251 -0
- package/src/filters/LocalsCompanyInformation.ts +4 -1
- package/src/filters/VerifyLocalsInformation.ts +179 -169
- package/src/views/MasterNotifications.ts +21 -45
|
@@ -0,0 +1,212 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getDiscountsCodeCompanyInformation = void 0;
|
|
40
|
+
var utils_1 = require("../utils");
|
|
41
|
+
var __1 = require("..");
|
|
42
|
+
function getDiscountsCodeCompanyInformation(repository_1, _a) {
|
|
43
|
+
return __awaiter(this, arguments, void 0, function (repository, _b) {
|
|
44
|
+
var timezone_1, queryBuilder_1, globalValue, filters_1, order, _c, discountsCodeCompany, totalRecords, error_1;
|
|
45
|
+
var 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("discount")
|
|
53
|
+
.leftJoinAndSelect("discount.updated_by", "master")
|
|
54
|
+
.skip(lazyEvent.first)
|
|
55
|
+
.take(lazyEvent.rows);
|
|
56
|
+
if (lazyEvent.filters["global"] && lazyEvent.filters["global"].value) {
|
|
57
|
+
globalValue = "%".concat(lazyEvent.filters["global"].value.toLowerCase(), "%");
|
|
58
|
+
queryBuilder_1.andWhere("LOWER(discount.code) LIKE :globalValue OR LOWER(discount.discount) LIKE :globalValue OR LOWER(discount.use_limit) LIKE :globalValue OR LOWER(discount.repeat_days) LIKE :globalValue OR LOWER(discount.updated) LIKE :globalValue OR LOWER(discount.start) LIKE :globalValue OR LOWER(discount.created) LIKE :globalValue OR LOWER(discount.expiration) LIKE :globalValue OR LOWER(master.name) LIKE :globalValue OR LOWER(master.surname) LIKE :globalValue", {
|
|
59
|
+
globalValue: globalValue ||
|
|
60
|
+
(0, utils_1.getStatusBasic)(lazyEvent.filters["global"].value.toLowerCase()) ||
|
|
61
|
+
(0, utils_1.getSeverityNameDiscountType)(lazyEvent.filters["global"].value.toLowerCase()),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
filters_1 = lazyEvent.filters;
|
|
65
|
+
Object.keys(filters_1).forEach(function (key) {
|
|
66
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
67
|
+
var _l, _m;
|
|
68
|
+
var value = filters_1[key].value;
|
|
69
|
+
if ((Array.isArray(value) && value.length > 0) ||
|
|
70
|
+
(!Array.isArray(value) && value && key !== "global")) {
|
|
71
|
+
var matchMode = filters_1[key].matchMode;
|
|
72
|
+
if (!Array.isArray(value) && value) {
|
|
73
|
+
value = filters_1[key].value.toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
var accessKey = key.split(".").length > 1 ? "".concat(key) : "discount.".concat(key);
|
|
76
|
+
switch (matchMode) {
|
|
77
|
+
case "custom":
|
|
78
|
+
if ((key === "number_of_times_used" || key === "use_limit") &&
|
|
79
|
+
matchMode === "custom") {
|
|
80
|
+
var _o = value || [null, null], from = _o[0], to = _o[1];
|
|
81
|
+
if (from !== null && to === null) {
|
|
82
|
+
queryBuilder_1.andWhere("discount.".concat(key, " >= :from"), {
|
|
83
|
+
from: from,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
else if (from === null && to !== null) {
|
|
87
|
+
queryBuilder_1.andWhere("discount.".concat(key, " <= :to"), {
|
|
88
|
+
to: to,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else if (from !== null && to !== null) {
|
|
92
|
+
queryBuilder_1.andWhere("discount.".concat(key, " BETWEEN :from AND :to"), {
|
|
93
|
+
from: from,
|
|
94
|
+
to: to,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case "contains":
|
|
100
|
+
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_a = {},
|
|
101
|
+
_a[key] = "%".concat(value, "%"),
|
|
102
|
+
_a));
|
|
103
|
+
break;
|
|
104
|
+
case "startsWith":
|
|
105
|
+
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_b = {},
|
|
106
|
+
_b[key] = "".concat(value, "%"),
|
|
107
|
+
_b));
|
|
108
|
+
break;
|
|
109
|
+
case "endsWith":
|
|
110
|
+
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_c = {},
|
|
111
|
+
_c[key] = "%".concat(value),
|
|
112
|
+
_c));
|
|
113
|
+
break;
|
|
114
|
+
case "equals":
|
|
115
|
+
if (key === "status") {
|
|
116
|
+
queryBuilder_1.andWhere("discount.status = :status", {
|
|
117
|
+
status: (0, utils_1.getStatusBasic)((_l = filters_1[key].value) !== null && _l !== void 0 ? _l : ""),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else if (key === "typeText") {
|
|
121
|
+
queryBuilder_1.andWhere("discount.type = :type", {
|
|
122
|
+
type: (0, utils_1.getSeverityNameDiscountType)((_m = filters_1[key].value) !== null && _m !== void 0 ? _m : ""),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
else if (key === "updated_by") {
|
|
126
|
+
var updatedByIds = filters_1[key].value.map(function (element) { return element.id; });
|
|
127
|
+
if (updatedByIds.length > 0) {
|
|
128
|
+
queryBuilder_1.andWhere("discount.updated_by IN (:...updatedByIds)", {
|
|
129
|
+
updatedByIds: updatedByIds,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
queryBuilder_1.andWhere("".concat(accessKey, " = :").concat(key), (_d = {},
|
|
135
|
+
_d[key] = value,
|
|
136
|
+
_d));
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "notContains":
|
|
140
|
+
queryBuilder_1.andWhere("".concat(accessKey, " NOT LIKE :").concat(key), (_e = {},
|
|
141
|
+
_e[key] = "%".concat(value, "%"),
|
|
142
|
+
_e));
|
|
143
|
+
break;
|
|
144
|
+
case "notEquals":
|
|
145
|
+
queryBuilder_1.andWhere("".concat(accessKey, " != :").concat(key), (_f = {},
|
|
146
|
+
_f[key] = value,
|
|
147
|
+
_f));
|
|
148
|
+
break;
|
|
149
|
+
case "dateIs":
|
|
150
|
+
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
151
|
+
? "DATE(CONVERT_TZ("
|
|
152
|
+
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
153
|
+
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
154
|
+
: "", " = :").concat(key), (_g = {},
|
|
155
|
+
_g[key] = value.split("T")[0],
|
|
156
|
+
_g));
|
|
157
|
+
break;
|
|
158
|
+
case "dateIsNot":
|
|
159
|
+
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
160
|
+
? "DATE(CONVERT_TZ("
|
|
161
|
+
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
162
|
+
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
163
|
+
: "", " != :").concat(key), (_h = {},
|
|
164
|
+
_h[key] = value.split("T")[0],
|
|
165
|
+
_h));
|
|
166
|
+
break;
|
|
167
|
+
case "dateBefore":
|
|
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), (_j = {},
|
|
173
|
+
_j[key] = value.split("T")[0],
|
|
174
|
+
_j));
|
|
175
|
+
break;
|
|
176
|
+
case "dateAfter":
|
|
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), (_k = {},
|
|
182
|
+
_k[key] = value.split("T")[0],
|
|
183
|
+
_k));
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
if (lazyEvent.sortField) {
|
|
191
|
+
order = lazyEvent.sortOrder === 1 ? "ASC" : "DESC";
|
|
192
|
+
queryBuilder_1.orderBy("discount.".concat(lazyEvent.sortField), order);
|
|
193
|
+
}
|
|
194
|
+
return [4 /*yield*/, queryBuilder_1.getManyAndCount()];
|
|
195
|
+
case 1:
|
|
196
|
+
_c = _d.sent(), discountsCodeCompany = _c[0], totalRecords = _c[1];
|
|
197
|
+
return [2 /*return*/, {
|
|
198
|
+
data: discountsCodeCompany,
|
|
199
|
+
totalRecords: totalRecords,
|
|
200
|
+
}];
|
|
201
|
+
case 2:
|
|
202
|
+
error_1 = _d.sent();
|
|
203
|
+
return [2 /*return*/, {
|
|
204
|
+
data: [],
|
|
205
|
+
totalRecords: 0,
|
|
206
|
+
}];
|
|
207
|
+
case 3: return [2 /*return*/];
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
exports.getDiscountsCodeCompanyInformation = getDiscountsCodeCompanyInformation;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Repository } from "typeorm";
|
|
2
|
+
import { IPropsDiscountUserOrCompany } from "../interfaces";
|
|
3
|
+
export declare function getDiscountsCodeUserInformation(repository: Repository<any>, { status, company, lazyEvent }: IPropsDiscountUserOrCompany): Promise<{
|
|
4
|
+
data: any[];
|
|
5
|
+
totalRecords: number;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getDiscountsCodeUserInformation = void 0;
|
|
40
|
+
var __1 = require("..");
|
|
41
|
+
function getDiscountsCodeUserInformation(repository_1, _a) {
|
|
42
|
+
return __awaiter(this, arguments, void 0, function (repository, _b) {
|
|
43
|
+
var timezone_1, queryBuilder_1, globalValue, filters_1, order, _c, discountsCodeUser, totalRecords, error_1;
|
|
44
|
+
var status = _b.status, company = _b.company, lazyEvent = _b.lazyEvent;
|
|
45
|
+
return __generator(this, function (_d) {
|
|
46
|
+
switch (_d.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
_d.trys.push([0, 2, , 3]);
|
|
49
|
+
timezone_1 = (0, __1.getTimezoneOffset)((0, __1.getTimeZone)());
|
|
50
|
+
queryBuilder_1 = repository
|
|
51
|
+
.createQueryBuilder("discount_code_user")
|
|
52
|
+
.skip(lazyEvent.first)
|
|
53
|
+
.take(lazyEvent.rows);
|
|
54
|
+
// DOC: Filtro global
|
|
55
|
+
if (lazyEvent.filters["global"] && lazyEvent.filters["global"].value) {
|
|
56
|
+
globalValue = "%".concat(lazyEvent.filters["global"].value.toLowerCase(), "%");
|
|
57
|
+
queryBuilder_1.andWhere("(LOWER(discount_code_user.local_name) LIKE :globalValue OR LOWER(partner_surname) LIKE :globalValue OR LOWER(discount_code_user.code) LIKE :globalValue OR LOWER(discount_code_user.discount) LIKE :globalValue OR LOWER(partner_name) LIKE :globalValue)", {
|
|
58
|
+
globalValue: globalValue ||
|
|
59
|
+
(0, __1.getStatusBasic)(lazyEvent.filters["global"].value.toLowerCase()) ||
|
|
60
|
+
(0, __1.getSeverityNameDiscountType)(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("discount_code_user.status = :status", {
|
|
66
|
+
status: status,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// DOC: Filtro por company FILTRO POR DEFECTO
|
|
70
|
+
if (!!company && company >= 0) {
|
|
71
|
+
queryBuilder_1.andWhere("discount_code_user.company = :company", {
|
|
72
|
+
company: company,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
filters_1 = lazyEvent.filters;
|
|
76
|
+
Object.keys(filters_1).forEach(function (key) {
|
|
77
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
78
|
+
var _l, _m;
|
|
79
|
+
var value = filters_1[key].value;
|
|
80
|
+
if ((Array.isArray(value) && value.length > 0) ||
|
|
81
|
+
(!Array.isArray(value) && value && key !== "global")) {
|
|
82
|
+
var matchMode = filters_1[key].matchMode;
|
|
83
|
+
if (!Array.isArray(value) && value) {
|
|
84
|
+
value = filters_1[key].value.toLowerCase();
|
|
85
|
+
}
|
|
86
|
+
var accessKey = key.split(".").length > 1 ? "".concat(key) : "discount_code_user.".concat(key);
|
|
87
|
+
switch (matchMode) {
|
|
88
|
+
case "custom":
|
|
89
|
+
if ((key === "number_of_times_used" || key === "use_limit") &&
|
|
90
|
+
matchMode === "custom") {
|
|
91
|
+
var _o = value || [null, null], from = _o[0], to = _o[1];
|
|
92
|
+
if (from !== null && to === null) {
|
|
93
|
+
queryBuilder_1.andWhere("discount_code_user.".concat(key, " >= :from"), {
|
|
94
|
+
from: from,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else if (from === null && to !== null) {
|
|
98
|
+
queryBuilder_1.andWhere("discount_code_user.".concat(key, " <= :to"), {
|
|
99
|
+
to: to,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else if (from !== null && to !== null) {
|
|
103
|
+
queryBuilder_1.andWhere("discount_code_user.".concat(key, " BETWEEN :from AND :to"), { from: from, to: to });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case "contains":
|
|
108
|
+
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_a = {},
|
|
109
|
+
_a[key] = "%".concat(value, "%"),
|
|
110
|
+
_a));
|
|
111
|
+
break;
|
|
112
|
+
case "startsWith":
|
|
113
|
+
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_b = {},
|
|
114
|
+
_b[key] = "".concat(value, "%"),
|
|
115
|
+
_b));
|
|
116
|
+
break;
|
|
117
|
+
case "endsWith":
|
|
118
|
+
queryBuilder_1.andWhere("".concat(accessKey, " LIKE :").concat(key), (_c = {},
|
|
119
|
+
_c[key] = "%".concat(value),
|
|
120
|
+
_c));
|
|
121
|
+
break;
|
|
122
|
+
case "equals":
|
|
123
|
+
if (key === "status") {
|
|
124
|
+
queryBuilder_1.andWhere("discount_code_user.status = :status", {
|
|
125
|
+
status: (0, __1.getStatusBasic)((_l = filters_1[key].value) !== null && _l !== void 0 ? _l : ""),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
else if (key === "typeText") {
|
|
129
|
+
queryBuilder_1.andWhere("discount_code_user.type = :type", {
|
|
130
|
+
type: (0, __1.getSeverityNameDiscountType)((_m = filters_1[key].value) !== null && _m !== void 0 ? _m : ""),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
else if (key === "updated_by") {
|
|
134
|
+
var updatedByIds = filters_1[key].value.map(function (element) { return element.id; });
|
|
135
|
+
if (updatedByIds.length > 0) {
|
|
136
|
+
queryBuilder_1.andWhere("discount_code_user.updated_by IN (:...updatedByIds)", {
|
|
137
|
+
updatedByIds: updatedByIds,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
queryBuilder_1.andWhere("".concat(accessKey, " = :").concat(key), (_d = {},
|
|
143
|
+
_d[key] = value,
|
|
144
|
+
_d));
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
case "notContains":
|
|
148
|
+
queryBuilder_1.andWhere("".concat(accessKey, " NOT LIKE :").concat(key), (_e = {},
|
|
149
|
+
_e[key] = "%".concat(value, "%"),
|
|
150
|
+
_e));
|
|
151
|
+
break;
|
|
152
|
+
case "notEquals":
|
|
153
|
+
queryBuilder_1.andWhere("".concat(accessKey, " != :").concat(key), (_f = {},
|
|
154
|
+
_f[key] = value,
|
|
155
|
+
_f));
|
|
156
|
+
break;
|
|
157
|
+
case "dateIs":
|
|
158
|
+
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
159
|
+
? "DATE(CONVERT_TZ("
|
|
160
|
+
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
161
|
+
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
162
|
+
: "", " = :").concat(key), (_g = {},
|
|
163
|
+
_g[key] = value.split("T")[0],
|
|
164
|
+
_g));
|
|
165
|
+
break;
|
|
166
|
+
case "dateIsNot":
|
|
167
|
+
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
168
|
+
? "DATE(CONVERT_TZ("
|
|
169
|
+
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
170
|
+
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
171
|
+
: "", " != :").concat(key), (_h = {},
|
|
172
|
+
_h[key] = value.split("T")[0],
|
|
173
|
+
_h));
|
|
174
|
+
break;
|
|
175
|
+
case "dateBefore":
|
|
176
|
+
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
177
|
+
? "DATE(CONVERT_TZ("
|
|
178
|
+
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
179
|
+
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
180
|
+
: "", " < :").concat(key), (_j = {},
|
|
181
|
+
_j[key] = value.split("T")[0],
|
|
182
|
+
_j));
|
|
183
|
+
break;
|
|
184
|
+
case "dateAfter":
|
|
185
|
+
queryBuilder_1.andWhere("".concat(key !== "expiration" && key !== "start"
|
|
186
|
+
? "DATE(CONVERT_TZ("
|
|
187
|
+
: "", " ").concat(accessKey, " ").concat(key !== "expiration" && key !== "start"
|
|
188
|
+
? ", '+00:00', '".concat(timezone_1, "'))")
|
|
189
|
+
: "", " > :").concat(key), (_k = {},
|
|
190
|
+
_k[key] = value.split("T")[0],
|
|
191
|
+
_k));
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
// DOC: Ordenamiento
|
|
199
|
+
if (lazyEvent.sortField) {
|
|
200
|
+
order = lazyEvent.sortOrder === 1 ? "ASC" : "DESC";
|
|
201
|
+
if (lazyEvent.sortField === "local.name") {
|
|
202
|
+
queryBuilder_1.orderBy("local.name", order);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
if (lazyEvent.sortField === "typeText") {
|
|
206
|
+
queryBuilder_1.orderBy("discount_code_user.type", order);
|
|
207
|
+
}
|
|
208
|
+
else if (lazyEvent.sortField === "status") {
|
|
209
|
+
queryBuilder_1.orderBy("discount_code_user.status", order);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
queryBuilder_1.orderBy("discount_code_user.".concat(lazyEvent.sortField), order);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return [4 /*yield*/, queryBuilder_1.getManyAndCount()];
|
|
217
|
+
case 1:
|
|
218
|
+
_c = _d.sent(), discountsCodeUser = _c[0], totalRecords = _c[1];
|
|
219
|
+
return [2 /*return*/, {
|
|
220
|
+
data: discountsCodeUser,
|
|
221
|
+
totalRecords: totalRecords,
|
|
222
|
+
}];
|
|
223
|
+
case 2:
|
|
224
|
+
error_1 = _d.sent();
|
|
225
|
+
return [2 /*return*/, {
|
|
226
|
+
data: [],
|
|
227
|
+
totalRecords: 0,
|
|
228
|
+
}];
|
|
229
|
+
case 3: return [2 /*return*/];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
exports.getDiscountsCodeUserInformation = getDiscountsCodeUserInformation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Repository } from "typeorm";
|
|
2
2
|
import { IBasicCompany } from "../interfaces";
|
|
3
|
-
export declare function getLocalsCompanyInformation(repository: Repository<any>, { company, status, visible, lazyEvent }: IBasicCompany): Promise<
|
|
3
|
+
export declare function getLocalsCompanyInformation(repository: Repository<any>, { company, status, visible, lazyEvent }: IBasicCompany): Promise<{
|
|
4
4
|
data: any[];
|
|
5
5
|
totalRecords: number;
|
|
6
6
|
}>;
|
|
@@ -218,7 +218,10 @@ function getLocalsCompanyInformation(repository_1, _a) {
|
|
|
218
218
|
}];
|
|
219
219
|
case 2:
|
|
220
220
|
error_1 = _d.sent();
|
|
221
|
-
return [2 /*return*/,
|
|
221
|
+
return [2 /*return*/, {
|
|
222
|
+
data: [],
|
|
223
|
+
totalRecords: 0,
|
|
224
|
+
}];
|
|
222
225
|
case 3: return [2 /*return*/];
|
|
223
226
|
}
|
|
224
227
|
});
|