test-entity-library-asm 2.8.16 → 2.8.17

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.
@@ -68,7 +68,7 @@ var MasterNotification = /** @class */ (function () {
68
68
  __decorate([
69
69
  (0, typeorm_1.Column)({
70
70
  default: 1,
71
- comment: "Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.",
71
+ comment: "Estado de la notificación: \r\n0. Inactiva. \r\n1. Activa.\r\n2. Reasignada.",
72
72
  }),
73
73
  __metadata("design:type", Number)
74
74
  ], MasterNotification.prototype, "status", void 0);
@@ -0,0 +1,6 @@
1
+ import { Repository } from "typeorm";
2
+ import { IBasicCompany } from "../interfaces";
3
+ export declare function getLocalsCompanyInformation(repository: Repository<any>, { company, status, visible, lazyEvent }: IBasicCompany): Promise<false | {
4
+ data: any[];
5
+ totalRecords: number;
6
+ }>;
@@ -0,0 +1,227 @@
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.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,
67
+ });
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,
73
+ });
74
+ }
75
+ if (visible !== null) {
76
+ queryBuilder_1.andWhere("view_locals_companies.visible = :visible", {
77
+ visible: visible,
78
+ });
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;
205
+ }
206
+ }
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*/, false];
222
+ case 3: return [2 /*return*/];
223
+ }
224
+ });
225
+ });
226
+ }
227
+ exports.getLocalsCompanyInformation = getLocalsCompanyInformation;
@@ -15,6 +15,7 @@ export declare class VerifyLocals {
15
15
  status: number;
16
16
  master_notification_id: number;
17
17
  master_notification_settings: any;
18
+ master_notification_status: number;
18
19
  master_id: number;
19
20
  master_name: string;
20
21
  master_surname: string;
@@ -93,6 +93,10 @@ var VerifyLocals = /** @class */ (function () {
93
93
  (0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
94
94
  __metadata("design:type", Object)
95
95
  ], VerifyLocals.prototype, "master_notification_settings", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.ViewColumn)(),
98
+ __metadata("design:type", Number)
99
+ ], VerifyLocals.prototype, "master_notification_status", void 0);
96
100
  __decorate([
97
101
  (0, typeorm_1.ViewColumn)(),
98
102
  __metadata("design:type", Number)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "2.8.16",
3
+ "version": "2.8.17",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",