test-entity-library-asm 2.6.15 → 2.6.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.
- package/dist/entities/Permission.d.ts +9 -9
- package/dist/entities/Permission.js +63 -63
- package/dist/entities/Role.d.ts +12 -12
- package/dist/entities/Role.js +81 -81
- package/dist/entities/RoleVisibleTo.d.ts +6 -6
- package/dist/entities/RoleVisibleTo.js +47 -47
- package/dist/entities/ScheduleCategory.d.ts +9 -9
- package/dist/entities/ScheduleCategory.js +48 -48
- package/dist/entities/TypeFood.d.ts +8 -8
- package/dist/entities/TypeFood.js +68 -68
- package/dist/middlewares/timezoneMiddleware.d.ts +3 -3
- package/dist/middlewares/timezoneMiddleware.js +22 -22
- package/dist/repositories/VerifyLocalRepository.d.ts +4 -4
- package/dist/repositories/VerifyLocalRepository.js +142 -142
- package/dist/transformations.d.ts +4 -4
- package/dist/transformations.js +16 -16
- package/dist/views/Partners.d.ts +17 -20
- package/dist/views/Partners.js +31 -43
- package/dist/views/UserInformation.d.ts +39 -39
- package/dist/views/UserInformation.js +187 -187
- package/package.json +1 -1
- package/src/views/Partners.ts +26 -35
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TypeFood = void 0;
|
|
13
|
-
var typeorm_1 = require("typeorm");
|
|
14
|
-
var Company_1 = require("./Company");
|
|
15
|
-
var TypeFood = /** @class */ (function () {
|
|
16
|
-
function TypeFood() {
|
|
17
|
-
}
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
20
|
-
comment: 'Número de identificación (ID) único de cada registro.',
|
|
21
|
-
}),
|
|
22
|
-
__metadata("design:type", Number)
|
|
23
|
-
], TypeFood.prototype, "id", void 0);
|
|
24
|
-
__decorate([
|
|
25
|
-
(0, typeorm_1.Column)({
|
|
26
|
-
length: 40,
|
|
27
|
-
comment: 'ID de la variable que se encuentra en los archivos `locales` para el multilenguaje.',
|
|
28
|
-
}),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], TypeFood.prototype, "name", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, typeorm_1.Column)({
|
|
33
|
-
length: 500,
|
|
34
|
-
nullable: true,
|
|
35
|
-
comment: 'Imagen para el tipo de comida.',
|
|
36
|
-
}),
|
|
37
|
-
__metadata("design:type", String)
|
|
38
|
-
], TypeFood.prototype, "photo", void 0);
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, typeorm_1.Column)({
|
|
41
|
-
default: 1,
|
|
42
|
-
comment: 'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
|
|
43
|
-
}),
|
|
44
|
-
__metadata("design:type", Number)
|
|
45
|
-
], TypeFood.prototype, "status", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, typeorm_1.ManyToMany)(function () { return Company_1.Company; }),
|
|
48
|
-
(0, typeorm_1.JoinTable)({
|
|
49
|
-
name: 'type_food_company',
|
|
50
|
-
joinColumn: {
|
|
51
|
-
name: 'company',
|
|
52
|
-
referencedColumnName: 'id',
|
|
53
|
-
},
|
|
54
|
-
inverseJoinColumn: {
|
|
55
|
-
name: 'type_food',
|
|
56
|
-
referencedColumnName: 'id',
|
|
57
|
-
},
|
|
58
|
-
}),
|
|
59
|
-
__metadata("design:type", Array)
|
|
60
|
-
], TypeFood.prototype, "companies", void 0);
|
|
61
|
-
TypeFood = __decorate([
|
|
62
|
-
(0, typeorm_1.Entity)('type_food', {
|
|
63
|
-
comment: 'Tipo de comida que va a tener la plataforma.',
|
|
64
|
-
})
|
|
65
|
-
], TypeFood);
|
|
66
|
-
return TypeFood;
|
|
67
|
-
}());
|
|
68
|
-
exports.TypeFood = TypeFood;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TypeFood = void 0;
|
|
13
|
+
var typeorm_1 = require("typeorm");
|
|
14
|
+
var Company_1 = require("./Company");
|
|
15
|
+
var TypeFood = /** @class */ (function () {
|
|
16
|
+
function TypeFood() {
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
20
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
21
|
+
}),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], TypeFood.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({
|
|
26
|
+
length: 40,
|
|
27
|
+
comment: 'ID de la variable que se encuentra en los archivos `locales` para el multilenguaje.',
|
|
28
|
+
}),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], TypeFood.prototype, "name", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({
|
|
33
|
+
length: 500,
|
|
34
|
+
nullable: true,
|
|
35
|
+
comment: 'Imagen para el tipo de comida.',
|
|
36
|
+
}),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], TypeFood.prototype, "photo", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({
|
|
41
|
+
default: 1,
|
|
42
|
+
comment: 'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
|
|
43
|
+
}),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], TypeFood.prototype, "status", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.ManyToMany)(function () { return Company_1.Company; }),
|
|
48
|
+
(0, typeorm_1.JoinTable)({
|
|
49
|
+
name: 'type_food_company',
|
|
50
|
+
joinColumn: {
|
|
51
|
+
name: 'company',
|
|
52
|
+
referencedColumnName: 'id',
|
|
53
|
+
},
|
|
54
|
+
inverseJoinColumn: {
|
|
55
|
+
name: 'type_food',
|
|
56
|
+
referencedColumnName: 'id',
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
__metadata("design:type", Array)
|
|
60
|
+
], TypeFood.prototype, "companies", void 0);
|
|
61
|
+
TypeFood = __decorate([
|
|
62
|
+
(0, typeorm_1.Entity)('type_food', {
|
|
63
|
+
comment: 'Tipo de comida que va a tener la plataforma.',
|
|
64
|
+
})
|
|
65
|
+
], TypeFood);
|
|
66
|
+
return TypeFood;
|
|
67
|
+
}());
|
|
68
|
+
exports.TypeFood = TypeFood;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from 'express';
|
|
2
|
-
export declare function timezoneMiddleware(req: Request, res: Response, next: NextFunction): void;
|
|
3
|
-
export declare function getTimeZone(): string;
|
|
1
|
+
import { NextFunction, Request, Response } from 'express';
|
|
2
|
+
export declare function timezoneMiddleware(req: Request, res: Response, next: NextFunction): void;
|
|
3
|
+
export declare function getTimeZone(): string;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTimeZone = exports.timezoneMiddleware = void 0;
|
|
4
|
-
var async_hooks_1 = require("async_hooks");
|
|
5
|
-
var asyncLocalStorage = new async_hooks_1.AsyncLocalStorage();
|
|
6
|
-
function timezoneMiddleware(req, res, next) {
|
|
7
|
-
var userTimeZone = req.headers['user-timezone'];
|
|
8
|
-
if (Array.isArray(userTimeZone)) {
|
|
9
|
-
userTimeZone = userTimeZone[0];
|
|
10
|
-
}
|
|
11
|
-
userTimeZone = userTimeZone || 'UTC';
|
|
12
|
-
asyncLocalStorage.run(new Map([['timezone', userTimeZone]]), function () {
|
|
13
|
-
next();
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
exports.timezoneMiddleware = timezoneMiddleware;
|
|
17
|
-
function getTimeZone() {
|
|
18
|
-
var _a;
|
|
19
|
-
var store = asyncLocalStorage.getStore();
|
|
20
|
-
return (_a = store === null || store === void 0 ? void 0 : store.get('timezone')) !== null && _a !== void 0 ? _a : 'UTC';
|
|
21
|
-
}
|
|
22
|
-
exports.getTimeZone = getTimeZone;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTimeZone = exports.timezoneMiddleware = void 0;
|
|
4
|
+
var async_hooks_1 = require("async_hooks");
|
|
5
|
+
var asyncLocalStorage = new async_hooks_1.AsyncLocalStorage();
|
|
6
|
+
function timezoneMiddleware(req, res, next) {
|
|
7
|
+
var userTimeZone = req.headers['user-timezone'];
|
|
8
|
+
if (Array.isArray(userTimeZone)) {
|
|
9
|
+
userTimeZone = userTimeZone[0];
|
|
10
|
+
}
|
|
11
|
+
userTimeZone = userTimeZone || 'UTC';
|
|
12
|
+
asyncLocalStorage.run(new Map([['timezone', userTimeZone]]), function () {
|
|
13
|
+
next();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.timezoneMiddleware = timezoneMiddleware;
|
|
17
|
+
function getTimeZone() {
|
|
18
|
+
var _a;
|
|
19
|
+
var store = asyncLocalStorage.getStore();
|
|
20
|
+
return (_a = store === null || store === void 0 ? void 0 : store.get('timezone')) !== null && _a !== void 0 ? _a : 'UTC';
|
|
21
|
+
}
|
|
22
|
+
exports.getTimeZone = getTimeZone;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSource, EntityTarget, Repository, ObjectLiteral } from 'typeorm';
|
|
2
|
-
export declare const createCustomRepository: <T extends ObjectLiteral>(entity: EntityTarget<T>, dataSource: DataSource) => Repository<T> & {
|
|
3
|
-
getVerifyLocals: Function;
|
|
4
|
-
};
|
|
1
|
+
import { DataSource, EntityTarget, Repository, ObjectLiteral } from 'typeorm';
|
|
2
|
+
export declare const createCustomRepository: <T extends ObjectLiteral>(entity: EntityTarget<T>, dataSource: DataSource) => Repository<T> & {
|
|
3
|
+
getVerifyLocals: Function;
|
|
4
|
+
};
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.createCustomRepository = void 0;
|
|
55
|
-
var typeorm_1 = require("typeorm");
|
|
56
|
-
var CustomRepository = /** @class */ (function (_super) {
|
|
57
|
-
__extends(CustomRepository, _super);
|
|
58
|
-
function CustomRepository() {
|
|
59
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
60
|
-
}
|
|
61
|
-
CustomRepository.prototype.getVerifyLocals = function (status, page, pageSize, filters) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var queryBuilder, globalValue, _a, data, total;
|
|
64
|
-
return __generator(this, function (_b) {
|
|
65
|
-
switch (_b.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
queryBuilder = this.createQueryBuilder('verifyLocal')
|
|
68
|
-
.skip((page - 1) * pageSize)
|
|
69
|
-
.take(pageSize);
|
|
70
|
-
// Filtro por estado si está definido
|
|
71
|
-
if (status !== null && status >= 0) {
|
|
72
|
-
queryBuilder.andWhere('verifyLocal.status = :status', { status: status });
|
|
73
|
-
}
|
|
74
|
-
// Filtro global que busca en múltiples campos
|
|
75
|
-
if (filters['global'] && filters['global'].value) {
|
|
76
|
-
globalValue = "%".concat(filters['global'].value, "%");
|
|
77
|
-
queryBuilder.andWhere('(JSON_EXTRACT(verifyLocal.local_information, "$.name") LIKE :globalValue ' +
|
|
78
|
-
'OR JSON_EXTRACT(verifyLocal.local_information, "$.square.address") LIKE :globalValue ' +
|
|
79
|
-
'OR JSON_EXTRACT(verifyLocal.local_information, "$.address.formatted_address") LIKE :globalValue ' +
|
|
80
|
-
'OR verifyLocal.status LIKE :globalValue)', { globalValue: globalValue });
|
|
81
|
-
}
|
|
82
|
-
// Filtros específicos de columnas
|
|
83
|
-
Object.keys(filters).forEach(function (key) {
|
|
84
|
-
var _a, _b, _c, _d;
|
|
85
|
-
if (key !== 'global' && filters[key].constraints) {
|
|
86
|
-
var filter = filters[key];
|
|
87
|
-
var value = filter.constraints[0].value;
|
|
88
|
-
var matchMode = filter.constraints[0].matchMode;
|
|
89
|
-
if (value !== null) {
|
|
90
|
-
var jsonPath = key
|
|
91
|
-
.split('.')
|
|
92
|
-
.map(function (segment) { return "$.".concat(segment); })
|
|
93
|
-
.join('');
|
|
94
|
-
switch (matchMode) {
|
|
95
|
-
case 'startsWith':
|
|
96
|
-
queryBuilder.andWhere("JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\") LIKE :").concat(key), (_a = {},
|
|
97
|
-
_a[key] = "".concat(value, "%"),
|
|
98
|
-
_a));
|
|
99
|
-
break;
|
|
100
|
-
case 'contains':
|
|
101
|
-
queryBuilder.andWhere("JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\") LIKE :").concat(key), (_b = {},
|
|
102
|
-
_b[key] = "%".concat(value, "%"),
|
|
103
|
-
_b));
|
|
104
|
-
break;
|
|
105
|
-
case 'equals':
|
|
106
|
-
queryBuilder.andWhere("JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\") = :").concat(key), (_c = {},
|
|
107
|
-
_c[key] = value,
|
|
108
|
-
_c));
|
|
109
|
-
break;
|
|
110
|
-
case 'dateIs':
|
|
111
|
-
queryBuilder.andWhere("DATE(JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\")) = :").concat(key), (_d = {},
|
|
112
|
-
_d[key] = value,
|
|
113
|
-
_d));
|
|
114
|
-
break;
|
|
115
|
-
// Agregar otros modos de coincidencia según sea necesario
|
|
116
|
-
default:
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return [4 /*yield*/, queryBuilder.getManyAndCount()];
|
|
123
|
-
case 1:
|
|
124
|
-
_a = _b.sent(), data = _a[0], total = _a[1];
|
|
125
|
-
return [2 /*return*/, {
|
|
126
|
-
data: data,
|
|
127
|
-
total: total,
|
|
128
|
-
page: page,
|
|
129
|
-
pageSize: pageSize,
|
|
130
|
-
totalPages: Math.ceil(total / pageSize),
|
|
131
|
-
}];
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
return CustomRepository;
|
|
137
|
-
}(typeorm_1.Repository));
|
|
138
|
-
var createCustomRepository = function (entity, dataSource) {
|
|
139
|
-
var baseRepository = dataSource.getRepository(entity);
|
|
140
|
-
return baseRepository.extend(CustomRepository.prototype);
|
|
141
|
-
};
|
|
142
|
-
exports.createCustomRepository = createCustomRepository;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.createCustomRepository = void 0;
|
|
55
|
+
var typeorm_1 = require("typeorm");
|
|
56
|
+
var CustomRepository = /** @class */ (function (_super) {
|
|
57
|
+
__extends(CustomRepository, _super);
|
|
58
|
+
function CustomRepository() {
|
|
59
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
60
|
+
}
|
|
61
|
+
CustomRepository.prototype.getVerifyLocals = function (status, page, pageSize, filters) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
+
var queryBuilder, globalValue, _a, data, total;
|
|
64
|
+
return __generator(this, function (_b) {
|
|
65
|
+
switch (_b.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
queryBuilder = this.createQueryBuilder('verifyLocal')
|
|
68
|
+
.skip((page - 1) * pageSize)
|
|
69
|
+
.take(pageSize);
|
|
70
|
+
// Filtro por estado si está definido
|
|
71
|
+
if (status !== null && status >= 0) {
|
|
72
|
+
queryBuilder.andWhere('verifyLocal.status = :status', { status: status });
|
|
73
|
+
}
|
|
74
|
+
// Filtro global que busca en múltiples campos
|
|
75
|
+
if (filters['global'] && filters['global'].value) {
|
|
76
|
+
globalValue = "%".concat(filters['global'].value, "%");
|
|
77
|
+
queryBuilder.andWhere('(JSON_EXTRACT(verifyLocal.local_information, "$.name") LIKE :globalValue ' +
|
|
78
|
+
'OR JSON_EXTRACT(verifyLocal.local_information, "$.square.address") LIKE :globalValue ' +
|
|
79
|
+
'OR JSON_EXTRACT(verifyLocal.local_information, "$.address.formatted_address") LIKE :globalValue ' +
|
|
80
|
+
'OR verifyLocal.status LIKE :globalValue)', { globalValue: globalValue });
|
|
81
|
+
}
|
|
82
|
+
// Filtros específicos de columnas
|
|
83
|
+
Object.keys(filters).forEach(function (key) {
|
|
84
|
+
var _a, _b, _c, _d;
|
|
85
|
+
if (key !== 'global' && filters[key].constraints) {
|
|
86
|
+
var filter = filters[key];
|
|
87
|
+
var value = filter.constraints[0].value;
|
|
88
|
+
var matchMode = filter.constraints[0].matchMode;
|
|
89
|
+
if (value !== null) {
|
|
90
|
+
var jsonPath = key
|
|
91
|
+
.split('.')
|
|
92
|
+
.map(function (segment) { return "$.".concat(segment); })
|
|
93
|
+
.join('');
|
|
94
|
+
switch (matchMode) {
|
|
95
|
+
case 'startsWith':
|
|
96
|
+
queryBuilder.andWhere("JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\") LIKE :").concat(key), (_a = {},
|
|
97
|
+
_a[key] = "".concat(value, "%"),
|
|
98
|
+
_a));
|
|
99
|
+
break;
|
|
100
|
+
case 'contains':
|
|
101
|
+
queryBuilder.andWhere("JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\") LIKE :").concat(key), (_b = {},
|
|
102
|
+
_b[key] = "%".concat(value, "%"),
|
|
103
|
+
_b));
|
|
104
|
+
break;
|
|
105
|
+
case 'equals':
|
|
106
|
+
queryBuilder.andWhere("JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\") = :").concat(key), (_c = {},
|
|
107
|
+
_c[key] = value,
|
|
108
|
+
_c));
|
|
109
|
+
break;
|
|
110
|
+
case 'dateIs':
|
|
111
|
+
queryBuilder.andWhere("DATE(JSON_EXTRACT(verifyLocal.".concat(key.split('.')[0], ", \"").concat(jsonPath, "\")) = :").concat(key), (_d = {},
|
|
112
|
+
_d[key] = value,
|
|
113
|
+
_d));
|
|
114
|
+
break;
|
|
115
|
+
// Agregar otros modos de coincidencia según sea necesario
|
|
116
|
+
default:
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return [4 /*yield*/, queryBuilder.getManyAndCount()];
|
|
123
|
+
case 1:
|
|
124
|
+
_a = _b.sent(), data = _a[0], total = _a[1];
|
|
125
|
+
return [2 /*return*/, {
|
|
126
|
+
data: data,
|
|
127
|
+
total: total,
|
|
128
|
+
page: page,
|
|
129
|
+
pageSize: pageSize,
|
|
130
|
+
totalPages: Math.ceil(total / pageSize),
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
return CustomRepository;
|
|
137
|
+
}(typeorm_1.Repository));
|
|
138
|
+
var createCustomRepository = function (entity, dataSource) {
|
|
139
|
+
var baseRepository = dataSource.getRepository(entity);
|
|
140
|
+
return baseRepository.extend(CustomRepository.prototype);
|
|
141
|
+
};
|
|
142
|
+
exports.createCustomRepository = createCustomRepository;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const jsonTransformer: {
|
|
2
|
-
to: (value: any) => string;
|
|
3
|
-
from: (value: string) => any;
|
|
4
|
-
};
|
|
1
|
+
export declare const jsonTransformer: {
|
|
2
|
+
to: (value: any) => string;
|
|
3
|
+
from: (value: string) => any;
|
|
4
|
+
};
|
package/dist/transformations.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsonTransformer = void 0;
|
|
4
|
-
// DOCUMENTATION: Variable creada para poder transformar los elementos a tipo objeto a los que están en la base de datos como strings que son objetos.
|
|
5
|
-
exports.jsonTransformer = {
|
|
6
|
-
to: function (value) { return JSON.stringify(value); },
|
|
7
|
-
from: function (value) {
|
|
8
|
-
try {
|
|
9
|
-
return JSON.parse(value);
|
|
10
|
-
}
|
|
11
|
-
catch (error) {
|
|
12
|
-
console.error('Error parsing JSON:', error);
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonTransformer = void 0;
|
|
4
|
+
// DOCUMENTATION: Variable creada para poder transformar los elementos a tipo objeto a los que están en la base de datos como strings que son objetos.
|
|
5
|
+
exports.jsonTransformer = {
|
|
6
|
+
to: function (value) { return JSON.stringify(value); },
|
|
7
|
+
from: function (value) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(value);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
console.error('Error parsing JSON:', error);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
};
|
package/dist/views/Partners.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export declare class Partners {
|
|
2
2
|
id: number;
|
|
3
|
+
company: number;
|
|
3
4
|
code: string;
|
|
4
5
|
document: string;
|
|
5
6
|
name: string;
|
|
6
7
|
surname: string;
|
|
7
8
|
email: string;
|
|
8
9
|
phone: string;
|
|
10
|
+
city: number;
|
|
9
11
|
address: string;
|
|
10
12
|
password: string;
|
|
11
13
|
profile: any;
|
|
@@ -14,24 +16,19 @@ export declare class Partners {
|
|
|
14
16
|
updated: string;
|
|
15
17
|
status: number;
|
|
16
18
|
visible: number;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
status_company: number;
|
|
33
|
-
locals_asigned: any;
|
|
34
|
-
roles_asigned: any;
|
|
35
|
-
terminals_asigned: any;
|
|
36
|
-
count_locals_asigned: number;
|
|
19
|
+
city_region: number;
|
|
20
|
+
city_name: string;
|
|
21
|
+
city_status: number;
|
|
22
|
+
region_country: number;
|
|
23
|
+
region_name: string;
|
|
24
|
+
region_status: number;
|
|
25
|
+
country_code: string;
|
|
26
|
+
country_name: string;
|
|
27
|
+
country_currency: string;
|
|
28
|
+
country_prefix: string;
|
|
29
|
+
country_structure_phone: string;
|
|
30
|
+
country_legal_information: any;
|
|
31
|
+
country_details: any;
|
|
32
|
+
country_status: number;
|
|
33
|
+
assigned_local: number;
|
|
37
34
|
}
|