test-entity-library-asm 1.1.0 → 1.1.2
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/Category.d.ts +8 -0
- package/dist/entities/Category.js +44 -0
- package/dist/entities/City.d.ts +13 -0
- package/dist/entities/City.js +55 -0
- package/dist/entities/CodeRedemptionHistoryCompany.d.ts +9 -0
- package/dist/entities/CodeRedemptionHistoryCompany.js +46 -0
- package/dist/entities/CodeRedemptionHistoryUser.d.ts +9 -0
- package/dist/entities/CodeRedemptionHistoryUser.js +46 -0
- package/dist/entities/Company.d.ts +29 -0
- package/dist/entities/Company.js +132 -0
- package/dist/entities/Configuration.d.ts +4 -0
- package/dist/entities/Configuration.js +33 -0
- package/dist/entities/Country.d.ts +12 -0
- package/dist/entities/Country.js +68 -0
- package/dist/entities/Day.d.ts +5 -0
- package/dist/entities/Day.js +34 -0
- package/dist/entities/DiscountCodeCompany.d.ts +15 -0
- package/dist/entities/DiscountCodeCompany.js +77 -0
- package/dist/entities/DiscountCodeUser.d.ts +17 -0
- package/dist/entities/DiscountCodeUser.js +82 -0
- package/dist/entities/Local.d.ts +21 -0
- package/dist/entities/Local.js +108 -0
- package/dist/entities/Master.d.ts +6 -0
- package/dist/entities/Master.js +36 -0
- package/dist/entities/Permission.d.ts +9 -0
- package/dist/entities/Permission.js +56 -0
- package/dist/entities/Plan.d.ts +14 -0
- package/dist/entities/Plan.js +75 -0
- package/dist/entities/Product.d.ts +17 -0
- package/dist/entities/Product.js +87 -0
- package/dist/entities/ProductGroup.d.ts +14 -0
- package/dist/entities/ProductGroup.js +74 -0
- package/dist/entities/ProductTopping.d.ts +9 -0
- package/dist/entities/ProductTopping.js +50 -0
- package/dist/entities/Region.d.ts +9 -0
- package/dist/entities/Region.js +45 -0
- package/dist/entities/Role.d.ts +12 -0
- package/dist/entities/Role.js +74 -0
- package/dist/entities/RoleVisibleTo.d.ts +6 -0
- package/dist/entities/RoleVisibleTo.js +39 -0
- package/dist/entities/ScheduleCategory.d.ts +9 -0
- package/dist/entities/ScheduleCategory.js +48 -0
- package/dist/entities/Terminal.d.ts +10 -0
- package/dist/entities/Terminal.js +63 -0
- package/dist/entities/TerminalSession.d.ts +10 -0
- package/dist/entities/TerminalSession.js +55 -0
- package/dist/entities/TypeFood.d.ts +7 -0
- package/dist/entities/TypeFood.js +42 -0
- package/dist/entities/User.d.ts +38 -0
- package/dist/entities/User.js +147 -0
- package/dist/entities/productGroupComplement.d.ts +8 -0
- package/dist/entities/productGroupComplement.js +46 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +30 -0
- package/dist/interfaces.d.ts +16 -0
- package/dist/interfaces.js +2 -0
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/interfaces.ts +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
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.User = void 0;
|
|
13
|
+
var typeorm_1 = require("typeorm");
|
|
14
|
+
var City_1 = require("./City");
|
|
15
|
+
var Terminal_1 = require("./Terminal");
|
|
16
|
+
var TerminalSession_1 = require("./TerminalSession");
|
|
17
|
+
var Plan_1 = require("./Plan");
|
|
18
|
+
var Company_1 = require("./Company");
|
|
19
|
+
var Local_1 = require("./Local");
|
|
20
|
+
var DiscountCodeCompany_1 = require("./DiscountCodeCompany");
|
|
21
|
+
var DiscountCodeUser_1 = require("./DiscountCodeUser");
|
|
22
|
+
var CodeRedemptionHistoryUser_1 = require("./CodeRedemptionHistoryUser");
|
|
23
|
+
var Master_1 = require("./Master");
|
|
24
|
+
var User = /** @class */ (function () {
|
|
25
|
+
function User() {
|
|
26
|
+
}
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], User.prototype, "id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ length: 30, unique: true }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], User.prototype, "code", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)(),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], User.prototype, "document", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ length: 50 }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], User.prototype, "name", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ length: 50 }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], User.prototype, "surname", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ length: 60, unique: true }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], User.prototype, "email", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ length: 12, unique: true }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], User.prototype, "phone", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.ManyToOne)(function () { return City_1.City; }, function (city) { return city.users; }),
|
|
57
|
+
(0, typeorm_1.JoinColumn)({ name: 'city' }),
|
|
58
|
+
__metadata("design:type", City_1.City)
|
|
59
|
+
], User.prototype, "city", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ nullable: true, length: 100 }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], User.prototype, "address", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
|
|
66
|
+
__metadata("design:type", Number)
|
|
67
|
+
], User.prototype, "latitude", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
|
|
70
|
+
__metadata("design:type", Number)
|
|
71
|
+
], User.prototype, "longitude", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.Column)({ length: 20 }),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], User.prototype, "password", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typeorm_1.Column)({
|
|
78
|
+
type: 'longtext',
|
|
79
|
+
nullable: true,
|
|
80
|
+
comment: 'Campo de tipo JSON donde se guarda información necesaria para el usuario',
|
|
81
|
+
}),
|
|
82
|
+
__metadata("design:type", String)
|
|
83
|
+
], User.prototype, "profile", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, typeorm_1.Column)({ type: 'datetime' }),
|
|
86
|
+
__metadata("design:type", Date)
|
|
87
|
+
], User.prototype, "created", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.Column)({ type: 'datetime' }),
|
|
90
|
+
__metadata("design:type", Date)
|
|
91
|
+
], User.prototype, "updated", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.Column)({ default: 1 }),
|
|
94
|
+
__metadata("design:type", Number)
|
|
95
|
+
], User.prototype, "status", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.ManyToMany)(function () { return Terminal_1.Terminal; }),
|
|
98
|
+
(0, typeorm_1.JoinTable)({
|
|
99
|
+
name: 'user_terminal',
|
|
100
|
+
}),
|
|
101
|
+
__metadata("design:type", Array)
|
|
102
|
+
], User.prototype, "terminals", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.OneToMany)(function () { return TerminalSession_1.TerminalSession; }, function (terminalSession) { return terminalSession.user; }),
|
|
105
|
+
__metadata("design:type", Array)
|
|
106
|
+
], User.prototype, "terminalUsers", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, typeorm_1.OneToMany)(function () { return Plan_1.Plan; }, function (plan) { return plan.created_by; }),
|
|
109
|
+
__metadata("design:type", Array)
|
|
110
|
+
], User.prototype, "plans", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, typeorm_1.OneToMany)(function () { return Company_1.Company; }, function (company) { return company.user; }),
|
|
113
|
+
__metadata("design:type", Array)
|
|
114
|
+
], User.prototype, "companies", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, typeorm_1.OneToMany)(function () { return Local_1.Local; }, function (local) { return local.updated_by; }),
|
|
117
|
+
__metadata("design:type", Array)
|
|
118
|
+
], User.prototype, "locals", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, typeorm_1.OneToMany)(function () { return DiscountCodeCompany_1.DiscountCodeCompany; }, function (discountCodeCompany) { return discountCodeCompany.updated_by; }),
|
|
121
|
+
__metadata("design:type", Array)
|
|
122
|
+
], User.prototype, "discount_code_companies", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
(0, typeorm_1.OneToMany)(function () { return DiscountCodeUser_1.DiscountCodeUser; }, function (discountCodeUser) { return discountCodeUser.updated_by; }),
|
|
125
|
+
__metadata("design:type", Array)
|
|
126
|
+
], User.prototype, "discount_code_users", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, typeorm_1.OneToMany)(function () { return CodeRedemptionHistoryUser_1.CodeRedemptionHistoryUser; }, function (codeRedemptionHistoryUser) { return codeRedemptionHistoryUser.user; }),
|
|
129
|
+
__metadata("design:type", Array)
|
|
130
|
+
], User.prototype, "code_redemption_history_users", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, typeorm_1.ManyToMany)(function () { return Local_1.Local; }),
|
|
133
|
+
(0, typeorm_1.JoinTable)({
|
|
134
|
+
name: 'local_user',
|
|
135
|
+
}),
|
|
136
|
+
__metadata("design:type", Array)
|
|
137
|
+
], User.prototype, "locals_user", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.OneToMany)(function () { return Master_1.Master; }, function (master) { return master.user; }),
|
|
140
|
+
__metadata("design:type", Array)
|
|
141
|
+
], User.prototype, "masters", void 0);
|
|
142
|
+
User = __decorate([
|
|
143
|
+
(0, typeorm_1.Entity)()
|
|
144
|
+
], User);
|
|
145
|
+
return User;
|
|
146
|
+
}());
|
|
147
|
+
exports.User = User;
|
|
@@ -0,0 +1,46 @@
|
|
|
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.ProductGroupComplement = void 0;
|
|
13
|
+
var typeorm_1 = require("typeorm");
|
|
14
|
+
var ProductGroup_1 = require("./ProductGroup");
|
|
15
|
+
var ProductGroupComplement = /** @class */ (function () {
|
|
16
|
+
function ProductGroupComplement() {
|
|
17
|
+
}
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], ProductGroupComplement.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.ManyToOne)(function () { return ProductGroup_1.ProductGroup; }, function (productGroup) { return productGroup.groups_complement; }),
|
|
24
|
+
(0, typeorm_1.JoinColumn)({ name: 'group_id' }),
|
|
25
|
+
__metadata("design:type", ProductGroup_1.ProductGroup)
|
|
26
|
+
], ProductGroupComplement.prototype, "group_id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)({ length: 30 }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], ProductGroupComplement.prototype, "name", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ length: 20 }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], ProductGroupComplement.prototype, "price", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)(),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], ProductGroupComplement.prototype, "position", void 0);
|
|
39
|
+
ProductGroupComplement = __decorate([
|
|
40
|
+
(0, typeorm_1.Entity)('product_group_complement', {
|
|
41
|
+
comment: 'Los complementos que tiene el grupo de un producto.',
|
|
42
|
+
})
|
|
43
|
+
], ProductGroupComplement);
|
|
44
|
+
return ProductGroupComplement;
|
|
45
|
+
}());
|
|
46
|
+
exports.ProductGroupComplement = ProductGroupComplement;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
import { IDataBaseSource, IShowEntity } from './interfaces';
|
|
3
|
+
export declare function createDataBaseSource({ type, host, port, username, password, database, synchronize, entitiesRoute, }: IDataBaseSource): DataSource;
|
|
4
|
+
export declare function showEntity({ entityName, connection }: IShowEntity): any;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showEntity = exports.createDataBaseSource = void 0;
|
|
4
|
+
var typeorm_1 = require("typeorm");
|
|
5
|
+
// DOCUMENTATION: Función para crear la conexión de la base de datos
|
|
6
|
+
// AUTHOR: jgomezp97@gmail.com
|
|
7
|
+
function createDataBaseSource(_a) {
|
|
8
|
+
var type = _a.type, host = _a.host, port = _a.port, username = _a.username, password = _a.password, database = _a.database, synchronize = _a.synchronize, entitiesRoute = _a.entitiesRoute;
|
|
9
|
+
return new typeorm_1.DataSource({
|
|
10
|
+
type: type !== null && type !== void 0 ? type : 'mysql',
|
|
11
|
+
host: host,
|
|
12
|
+
port: port,
|
|
13
|
+
username: username,
|
|
14
|
+
password: password,
|
|
15
|
+
database: database,
|
|
16
|
+
synchronize: synchronize,
|
|
17
|
+
logging: true,
|
|
18
|
+
entities: [__dirname + "/entities/".concat(entitiesRoute, "/*{.js,.ts}")],
|
|
19
|
+
subscribers: [],
|
|
20
|
+
migrations: [],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.createDataBaseSource = createDataBaseSource;
|
|
24
|
+
// DOCUMENTATION: Función para retornar la entidad de una base de datos en específico por medio de un DataSource
|
|
25
|
+
// AUTHOR: jgomezp97@gmail.com
|
|
26
|
+
function showEntity(_a) {
|
|
27
|
+
var entityName = _a.entityName, connection = _a.connection;
|
|
28
|
+
return connection.getRepository(entityName);
|
|
29
|
+
}
|
|
30
|
+
exports.showEntity = showEntity;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
export interface IShowEntity {
|
|
3
|
+
entityName: string;
|
|
4
|
+
connection: DataSource;
|
|
5
|
+
}
|
|
6
|
+
export interface IDataBaseSource {
|
|
7
|
+
type?: IType;
|
|
8
|
+
host: string;
|
|
9
|
+
port: number;
|
|
10
|
+
username: string;
|
|
11
|
+
password: string;
|
|
12
|
+
database: string;
|
|
13
|
+
synchronize: boolean;
|
|
14
|
+
entitiesRoute: string;
|
|
15
|
+
}
|
|
16
|
+
export type IType = 'mysql' | 'mariadb';
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -22,7 +22,10 @@ export function createDataBaseSource({
|
|
|
22
22
|
database: database,
|
|
23
23
|
synchronize: synchronize,
|
|
24
24
|
logging: true,
|
|
25
|
-
entities: [
|
|
25
|
+
entities: [
|
|
26
|
+
__dirname +
|
|
27
|
+
`/entities${entitiesRoute ? `/${entitiesRoute}` : ''}/*{.js,.ts}`,
|
|
28
|
+
],
|
|
26
29
|
subscribers: [],
|
|
27
30
|
migrations: [],
|
|
28
31
|
})
|