test-entity-library-asm 2.6.5 → 2.6.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/entities/Local.d.ts +1 -0
- package/dist/entities/Local.js +7 -0
- package/dist/entities/Master.d.ts +1 -0
- package/dist/entities/Master.js +7 -0
- package/dist/entities/Partner.d.ts +1 -0
- package/dist/entities/Partner.js +7 -0
- 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/entities/User.d.ts +1 -0
- package/dist/entities/User.js +7 -0
- package/dist/entities.views.routes.d.ts +1 -0
- package/dist/entities.views.routes.js +3 -1
- 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/UserInformation.d.ts +43 -0
- package/dist/views/UserInformation.js +203 -0
- package/package.json +1 -1
- package/src/entities/Local.ts +7 -0
- package/src/entities/Master.ts +7 -0
- package/src/entities/Partner.ts +7 -0
- package/src/entities/User.ts +7 -0
- package/src/entities.views.routes.ts +1 -0
- package/src/views/UserInformation.ts +146 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Company } from './Company';
|
|
2
|
-
export declare class TypeFood {
|
|
3
|
-
id: number;
|
|
4
|
-
name: string;
|
|
5
|
-
photo: string;
|
|
6
|
-
status: number;
|
|
7
|
-
companies: Company[];
|
|
8
|
-
}
|
|
1
|
+
import { Company } from './Company';
|
|
2
|
+
export declare class TypeFood {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
photo: string;
|
|
6
|
+
status: number;
|
|
7
|
+
companies: Company[];
|
|
8
|
+
}
|
|
@@ -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;
|
package/dist/entities/User.d.ts
CHANGED
package/dist/entities/User.js
CHANGED
|
@@ -105,6 +105,13 @@ var User = /** @class */ (function () {
|
|
|
105
105
|
}),
|
|
106
106
|
__metadata("design:type", Number)
|
|
107
107
|
], User.prototype, "status", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, typeorm_1.Column)({
|
|
110
|
+
default: 1,
|
|
111
|
+
comment: 'Es el estado para verificar si se envia en la papelara o no.',
|
|
112
|
+
}),
|
|
113
|
+
__metadata("design:type", Number)
|
|
114
|
+
], User.prototype, "visible", void 0);
|
|
108
115
|
__decorate([
|
|
109
116
|
(0, typeorm_1.OneToMany)(function () { return CodeRedemptionHistoryUser_1.CodeRedemptionHistoryUser; }, function (codeRedemptionHistoryUser) { return codeRedemptionHistoryUser.user; }),
|
|
110
117
|
__metadata("design:type", Array)
|
|
@@ -46,5 +46,6 @@ export { ReassignReview } from './entities/ReassignReview';
|
|
|
46
46
|
export { LocalsCompany } from './views/LocalsCompany';
|
|
47
47
|
export { VerifyLocals } from './views/VerifyLocals';
|
|
48
48
|
export { MasterNotifications } from './views/MasterNotifications';
|
|
49
|
+
export { UserInformation } from './views/UserInformation';
|
|
49
50
|
export { CustomRepository } from './CustomRepository';
|
|
50
51
|
export * from './utils';
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.CustomRepository = exports.MasterNotifications = exports.VerifyLocals = exports.LocalsCompany = exports.ReassignReview = exports.MasterNotification = exports.VerifyLocal = exports.PosSystem = exports.AuthenticationCredential = exports.BusinessType = exports.UserAddress = exports.User = exports.TypeMeasureIngredient = exports.TerminalSession = exports.Terminal = exports.Square = exports.RequestStatus = exports.RequestProductGroupComplement = exports.RequestProduct = exports.Request = exports.Region = exports.ProductTopping = exports.ProductIngredient = exports.ProductGroupComplement = exports.ProductGroup = exports.Product = exports.Plan = exports.PaymentMethod = exports.PartnerRole = exports.PartnerPermission = exports.PartnerNotification = exports.Partner = exports.MasterRole = exports.MasterPermission = exports.Master = exports.LocalQualification = exports.Local = exports.DiscountCodeUser = exports.DiscountCodeCompany = exports.Day = exports.Country = exports.Configuration = exports.Company = exports.CodeRedemptionHistoryUser = exports.CodeRedemptionHistoryCompany = exports.City = exports.ScheduleCategory = exports.Category = exports.BusinessTypeProduct = void 0;
|
|
17
|
+
exports.CustomRepository = exports.UserInformation = exports.MasterNotifications = exports.VerifyLocals = exports.LocalsCompany = exports.ReassignReview = exports.MasterNotification = exports.VerifyLocal = exports.PosSystem = exports.AuthenticationCredential = exports.BusinessType = exports.UserAddress = exports.User = exports.TypeMeasureIngredient = exports.TerminalSession = exports.Terminal = exports.Square = exports.RequestStatus = exports.RequestProductGroupComplement = exports.RequestProduct = exports.Request = exports.Region = exports.ProductTopping = exports.ProductIngredient = exports.ProductGroupComplement = exports.ProductGroup = exports.Product = exports.Plan = exports.PaymentMethod = exports.PartnerRole = exports.PartnerPermission = exports.PartnerNotification = exports.Partner = exports.MasterRole = exports.MasterPermission = exports.Master = exports.LocalQualification = exports.Local = exports.DiscountCodeUser = exports.DiscountCodeCompany = exports.Day = exports.Country = exports.Configuration = exports.Company = exports.CodeRedemptionHistoryUser = exports.CodeRedemptionHistoryCompany = exports.City = exports.ScheduleCategory = exports.Category = exports.BusinessTypeProduct = void 0;
|
|
18
18
|
var BusinessTypeProduct_1 = require("./entities/BusinessTypeProduct");
|
|
19
19
|
Object.defineProperty(exports, "BusinessTypeProduct", { enumerable: true, get: function () { return BusinessTypeProduct_1.BusinessTypeProduct; } });
|
|
20
20
|
var Category_1 = require("./entities/Category");
|
|
@@ -111,6 +111,8 @@ var VerifyLocals_1 = require("./views/VerifyLocals");
|
|
|
111
111
|
Object.defineProperty(exports, "VerifyLocals", { enumerable: true, get: function () { return VerifyLocals_1.VerifyLocals; } });
|
|
112
112
|
var MasterNotifications_1 = require("./views/MasterNotifications");
|
|
113
113
|
Object.defineProperty(exports, "MasterNotifications", { enumerable: true, get: function () { return MasterNotifications_1.MasterNotifications; } });
|
|
114
|
+
var UserInformation_1 = require("./views/UserInformation");
|
|
115
|
+
Object.defineProperty(exports, "UserInformation", { enumerable: true, get: function () { return UserInformation_1.UserInformation; } });
|
|
114
116
|
var CustomRepository_1 = require("./CustomRepository");
|
|
115
117
|
Object.defineProperty(exports, "CustomRepository", { enumerable: true, get: function () { return CustomRepository_1.CustomRepository; } });
|
|
116
118
|
__exportStar(require("./utils"), exports);
|
|
@@ -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
|
+
};
|