test-entity-library-asm 2.1.5 → 2.1.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/AuthenticationCredential.d.ts +9 -0
- package/dist/entities/AuthenticationCredential.js +61 -0
- package/dist/entities/Local.d.ts +3 -0
- package/dist/entities/Local.js +20 -0
- package/dist/entities/PosSystem.d.ts +11 -0
- package/dist/entities/PosSystem.js +75 -0
- package/dist/entities.views.routes.d.ts +2 -0
- package/dist/entities.views.routes.js +5 -1
- package/dist/views/LocalsCompany.d.ts +10 -0
- package/dist/views/LocalsCompany.js +50 -0
- package/package.json +1 -1
- package/src/entities/AuthenticationCredential.ts +43 -0
- package/src/entities/Local.ts +19 -0
- package/src/entities/PosSystem.ts +63 -0
- package/src/entities.views.routes.ts +2 -0
- package/src/views/LocalsCompany.ts +42 -0
|
@@ -0,0 +1,61 @@
|
|
|
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.AuthenticationCredential = void 0;
|
|
13
|
+
var typeorm_1 = require("typeorm");
|
|
14
|
+
var __1 = require("..");
|
|
15
|
+
var AuthenticationCredential = /** @class */ (function () {
|
|
16
|
+
function AuthenticationCredential() {
|
|
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
|
+
], AuthenticationCredential.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({
|
|
26
|
+
length: 30,
|
|
27
|
+
comment: 'Tipo de autenticación que va a tener el sistema:\r\n1. auth_basic: username/email y password para autenticación básica y JWT.\r\n\r\n2. auth_token: client_id y client_secret junto con username y password para OAuth 2.0 Password Grant.\r\n\r\n3. auth_oauth: client_id, redirect_uri, response_type, scope, y state para OAuth 2.0 Authorization Code Grant.\r\n\r\n4. auth_api_key: api_key para autenticación basada en claves API.\r\n\r\nAcá toca tener en cuenta cada tipo para hacer la respectiva autenticación, para esto ver ejemplos y usos de cada uno.',
|
|
28
|
+
}),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], AuthenticationCredential.prototype, "type", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ length: 30, comment: 'Nombre del tipo de autenticación.' }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], AuthenticationCredential.prototype, "name", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({
|
|
37
|
+
length: 200,
|
|
38
|
+
comment: 'Variables que se necesitan separadas por ,\r\nejemplo: username,password....\r\n\r\nEsto se tiene en cuenta para crear los elementos en el frontend y poder guardarlos en la tabla (pos_system -> settings).',
|
|
39
|
+
}),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], AuthenticationCredential.prototype, "variables", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({
|
|
44
|
+
default: 1,
|
|
45
|
+
comment: 'Estado del tipo de autenticación:\r\n0: Inactivo.\r\n1: Activo.',
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Number)
|
|
48
|
+
], AuthenticationCredential.prototype, "status", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.OneToMany)(function () { return __1.PosSystem; }, function (posSystem) { return posSystem.authentication_credentials; }),
|
|
51
|
+
__metadata("design:type", Array)
|
|
52
|
+
], AuthenticationCredential.prototype, "authenticationCredentials", void 0);
|
|
53
|
+
AuthenticationCredential = __decorate([
|
|
54
|
+
(0, typeorm_1.Entity)({
|
|
55
|
+
name: 'authentication_credential',
|
|
56
|
+
comment: 'Tabla creada para almacenar los tipos de autenticación que van a tener los sistemas POS.',
|
|
57
|
+
})
|
|
58
|
+
], AuthenticationCredential);
|
|
59
|
+
return AuthenticationCredential;
|
|
60
|
+
}());
|
|
61
|
+
exports.AuthenticationCredential = AuthenticationCredential;
|
package/dist/entities/Local.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { Terminal } from './Terminal';
|
|
|
10
10
|
import { User } from './User';
|
|
11
11
|
import { Partner } from './Partner';
|
|
12
12
|
import { BusinessTypeProduct } from './BusinessTypeProduct';
|
|
13
|
+
import { PosSystem } from '..';
|
|
13
14
|
export declare class Local {
|
|
14
15
|
id: number;
|
|
15
16
|
company: Company;
|
|
@@ -23,6 +24,8 @@ export declare class Local {
|
|
|
23
24
|
updated: Date;
|
|
24
25
|
updated_by: Partner;
|
|
25
26
|
square: Square;
|
|
27
|
+
pos_system: PosSystem;
|
|
28
|
+
pos_system_settings: string;
|
|
26
29
|
status: number;
|
|
27
30
|
locals_partners: Partner[];
|
|
28
31
|
products: Product[];
|
package/dist/entities/Local.js
CHANGED
|
@@ -23,6 +23,8 @@ var Terminal_1 = require("./Terminal");
|
|
|
23
23
|
var User_1 = require("./User");
|
|
24
24
|
var Partner_1 = require("./Partner");
|
|
25
25
|
var BusinessTypeProduct_1 = require("./BusinessTypeProduct");
|
|
26
|
+
var __1 = require("..");
|
|
27
|
+
var jsonTransformer_1 = require("../transformers/jsonTransformer");
|
|
26
28
|
var Local = /** @class */ (function () {
|
|
27
29
|
function Local() {
|
|
28
30
|
}
|
|
@@ -68,6 +70,7 @@ var Local = /** @class */ (function () {
|
|
|
68
70
|
(0, typeorm_1.Column)({
|
|
69
71
|
type: 'longtext',
|
|
70
72
|
nullable: true,
|
|
73
|
+
transformer: jsonTransformer_1.jsonTransformer,
|
|
71
74
|
comment: 'Campo de tipo JSON por si es necesario agregar información adicional',
|
|
72
75
|
}),
|
|
73
76
|
__metadata("design:type", String)
|
|
@@ -96,6 +99,23 @@ var Local = /** @class */ (function () {
|
|
|
96
99
|
(0, typeorm_1.JoinColumn)({ name: 'square' }),
|
|
97
100
|
__metadata("design:type", Square_1.Square)
|
|
98
101
|
], Local.prototype, "square", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.ManyToOne)(function () { return __1.PosSystem; }, function (posSystem) { return posSystem.locals_pos_system; }, {
|
|
104
|
+
onDelete: 'RESTRICT',
|
|
105
|
+
onUpdate: 'NO ACTION',
|
|
106
|
+
}),
|
|
107
|
+
(0, typeorm_1.JoinColumn)({ name: 'pos_system' }),
|
|
108
|
+
__metadata("design:type", __1.PosSystem)
|
|
109
|
+
], Local.prototype, "pos_system", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)({
|
|
112
|
+
type: 'text',
|
|
113
|
+
nullable: true,
|
|
114
|
+
transformer: jsonTransformer_1.jsonTransformer,
|
|
115
|
+
comment: 'Campo de tipo JSON por si es necesario agregar información adicional',
|
|
116
|
+
}),
|
|
117
|
+
__metadata("design:type", String)
|
|
118
|
+
], Local.prototype, "pos_system_settings", void 0);
|
|
99
119
|
__decorate([
|
|
100
120
|
(0, typeorm_1.Column)({
|
|
101
121
|
default: 1,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AuthenticationCredential, Local } from '..';
|
|
2
|
+
export declare class PosSystem {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
endpoint_products: string;
|
|
7
|
+
endpoint_order: string;
|
|
8
|
+
authentication_credentials: AuthenticationCredential;
|
|
9
|
+
status: number;
|
|
10
|
+
locals_pos_system: Local[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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.PosSystem = void 0;
|
|
13
|
+
var typeorm_1 = require("typeorm");
|
|
14
|
+
var __1 = require("..");
|
|
15
|
+
var PosSystem = /** @class */ (function () {
|
|
16
|
+
function PosSystem() {
|
|
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
|
+
], PosSystem.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({ length: 50, comment: 'Nombre del registro.' }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], PosSystem.prototype, "name", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ length: 300, nullable: true, comment: 'Descripción del registro.' }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], PosSystem.prototype, "description", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)({
|
|
34
|
+
type: 'text',
|
|
35
|
+
comment: 'Esto será un JSON, donde va a tener información de lo que necesita para poder una petición hacia el sistema POS para traer los productos, es decir:\r\n\r\n1. type: Tipo de endpoint que tiene los productos (GET o POST)\r\n\r\n2. endpoint_name: Este es un string que será la url de la solicitud para traerse los productos que hay en el sistema POS.\r\n\r\n3. query_parameters: Este un objeto donde se van a guardar los clave valor de cada item qué necesitemos, es decir:\r\n{"productId": "product_id"...}\r\n{"ProductId: "product_id"...}\r\n{"productid": "product_id"...}\r\n\r\nEntonces, con este elemento se puede saber el parámetro que nosotros (asumano) usamos, y el parámetro que necesita el api (POS).\r\n',
|
|
36
|
+
}),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], PosSystem.prototype, "endpoint_products", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({
|
|
41
|
+
type: 'text',
|
|
42
|
+
comment: 'Esto será un JSON, donde va a tener información de lo que necesita para poder una petición hacia el sistema POS para realizar un pedido, es decir:\r\n\r\n1. type: Tipo de endpoint que tiene los pedidos (GET o POST) (Acá todos los desarrolladores deberían usar POST, ya que es una creación, pero hay casos en que no los usan, toca validar).\r\n\r\n2. endpoint_name: Este es un string que será la url de la solicitud para crear un pedido en el sistema POS.\r\n\r\n3. query_parameters: Este un objeto donde se van a guardar los clave valor de cada item qué necesitemos, es decir:\r\n{"productId": "product_id"...}\r\n{"ProductId: "product_id"...}\r\n{"productid": "product_id"...}\r\n\r\nEntonces, con este elemento se puede saber el parámetro que nosotros (asumano) usamos, y el parámetro que necesita el api (POS) para poder crear el pedido.\r\n',
|
|
43
|
+
}),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], PosSystem.prototype, "endpoint_order", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.ManyToOne)(function () { return __1.AuthenticationCredential; }, function (authenticationCredential) {
|
|
48
|
+
return authenticationCredential.authenticationCredentials;
|
|
49
|
+
}, {
|
|
50
|
+
onDelete: 'RESTRICT',
|
|
51
|
+
onUpdate: 'NO ACTION',
|
|
52
|
+
}),
|
|
53
|
+
(0, typeorm_1.JoinColumn)({ name: 'authentication_credentials' }),
|
|
54
|
+
__metadata("design:type", __1.AuthenticationCredential)
|
|
55
|
+
], PosSystem.prototype, "authentication_credentials", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({
|
|
58
|
+
default: 1,
|
|
59
|
+
comment: 'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], PosSystem.prototype, "status", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typeorm_1.OneToMany)(function () { return __1.Local; }, function (local) { return local.pos_system; }),
|
|
65
|
+
__metadata("design:type", Array)
|
|
66
|
+
], PosSystem.prototype, "locals_pos_system", void 0);
|
|
67
|
+
PosSystem = __decorate([
|
|
68
|
+
(0, typeorm_1.Entity)({
|
|
69
|
+
name: 'pos_system',
|
|
70
|
+
comment: 'Tabla creada para almacenar los sistemas POS que se quieran enlazar con nuestro sistema y así tener una integración más completa.',
|
|
71
|
+
})
|
|
72
|
+
], PosSystem);
|
|
73
|
+
return PosSystem;
|
|
74
|
+
}());
|
|
75
|
+
exports.PosSystem = PosSystem;
|
|
@@ -39,3 +39,5 @@ export { User } from './entities/User';
|
|
|
39
39
|
export { UserAddress } from './entities/UserAddress';
|
|
40
40
|
export { LocalsCompany } from './views/LocalsCompany';
|
|
41
41
|
export { BusinessType } from './entities/BusinessType';
|
|
42
|
+
export { AuthenticationCredential } from './entities/AuthenticationCredential';
|
|
43
|
+
export { PosSystem } from './entities/PosSystem';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BusinessType = exports.LocalsCompany = 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;
|
|
3
|
+
exports.PosSystem = exports.AuthenticationCredential = exports.BusinessType = exports.LocalsCompany = 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;
|
|
4
4
|
var BusinessTypeProduct_1 = require("./entities/BusinessTypeProduct");
|
|
5
5
|
Object.defineProperty(exports, "BusinessTypeProduct", { enumerable: true, get: function () { return BusinessTypeProduct_1.BusinessTypeProduct; } });
|
|
6
6
|
var Category_1 = require("./entities/Category");
|
|
@@ -83,3 +83,7 @@ var LocalsCompany_1 = require("./views/LocalsCompany");
|
|
|
83
83
|
Object.defineProperty(exports, "LocalsCompany", { enumerable: true, get: function () { return LocalsCompany_1.LocalsCompany; } });
|
|
84
84
|
var BusinessType_1 = require("./entities/BusinessType");
|
|
85
85
|
Object.defineProperty(exports, "BusinessType", { enumerable: true, get: function () { return BusinessType_1.BusinessType; } });
|
|
86
|
+
var AuthenticationCredential_1 = require("./entities/AuthenticationCredential");
|
|
87
|
+
Object.defineProperty(exports, "AuthenticationCredential", { enumerable: true, get: function () { return AuthenticationCredential_1.AuthenticationCredential; } });
|
|
88
|
+
var PosSystem_1 = require("./entities/PosSystem");
|
|
89
|
+
Object.defineProperty(exports, "PosSystem", { enumerable: true, get: function () { return PosSystem_1.PosSystem; } });
|
|
@@ -28,4 +28,14 @@ export declare class LocalsCompany {
|
|
|
28
28
|
square_status: number;
|
|
29
29
|
partners_count: number;
|
|
30
30
|
request_count: number;
|
|
31
|
+
pos_system_id: number;
|
|
32
|
+
pos_system_name: string;
|
|
33
|
+
pos_system_description: string;
|
|
34
|
+
pos_system_endpoint_products: object;
|
|
35
|
+
pos_system_endpoint_order: object;
|
|
36
|
+
pos_system_authentication_credentials: number;
|
|
37
|
+
pos_system_settings: object;
|
|
38
|
+
pos_system_created: string;
|
|
39
|
+
pos_system_expiration: string;
|
|
40
|
+
pos_system_status: number;
|
|
31
41
|
}
|
|
@@ -10,12 +10,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.LocalsCompany = void 0;
|
|
13
|
+
var moment = require("moment-timezone");
|
|
13
14
|
var typeorm_1 = require("typeorm");
|
|
15
|
+
var __1 = require("..");
|
|
14
16
|
// JSON Transformer
|
|
15
17
|
var jsonTransformer = {
|
|
16
18
|
to: function (value) { return JSON.stringify(value); },
|
|
17
19
|
from: function (value) { return JSON.parse(value); },
|
|
18
20
|
};
|
|
21
|
+
var DateTransformer = {
|
|
22
|
+
to: function (value) {
|
|
23
|
+
return moment.utc(value).format('YYYY-MM-DD HH:mm:ss');
|
|
24
|
+
},
|
|
25
|
+
from: function (value) {
|
|
26
|
+
return moment.utc(value).tz((0, __1.getTimeZone)()).format('YYYY-MM-DD HH:mm:ss');
|
|
27
|
+
},
|
|
28
|
+
};
|
|
19
29
|
var LocalsCompany = /** @class */ (function () {
|
|
20
30
|
function LocalsCompany() {
|
|
21
31
|
}
|
|
@@ -135,6 +145,46 @@ var LocalsCompany = /** @class */ (function () {
|
|
|
135
145
|
(0, typeorm_1.ViewColumn)(),
|
|
136
146
|
__metadata("design:type", Number)
|
|
137
147
|
], LocalsCompany.prototype, "request_count", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
(0, typeorm_1.ViewColumn)(),
|
|
150
|
+
__metadata("design:type", Number)
|
|
151
|
+
], LocalsCompany.prototype, "pos_system_id", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, typeorm_1.ViewColumn)(),
|
|
154
|
+
__metadata("design:type", String)
|
|
155
|
+
], LocalsCompany.prototype, "pos_system_name", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, typeorm_1.ViewColumn)(),
|
|
158
|
+
__metadata("design:type", String)
|
|
159
|
+
], LocalsCompany.prototype, "pos_system_description", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
|
|
162
|
+
__metadata("design:type", Object)
|
|
163
|
+
], LocalsCompany.prototype, "pos_system_endpoint_products", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
|
|
166
|
+
__metadata("design:type", Object)
|
|
167
|
+
], LocalsCompany.prototype, "pos_system_endpoint_order", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, typeorm_1.ViewColumn)(),
|
|
170
|
+
__metadata("design:type", Number)
|
|
171
|
+
], LocalsCompany.prototype, "pos_system_authentication_credentials", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, typeorm_1.ViewColumn)({ transformer: jsonTransformer }),
|
|
174
|
+
__metadata("design:type", Object)
|
|
175
|
+
], LocalsCompany.prototype, "pos_system_settings", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
(0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
|
|
178
|
+
__metadata("design:type", String)
|
|
179
|
+
], LocalsCompany.prototype, "pos_system_created", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, typeorm_1.ViewColumn)({ transformer: DateTransformer }),
|
|
182
|
+
__metadata("design:type", String)
|
|
183
|
+
], LocalsCompany.prototype, "pos_system_expiration", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, typeorm_1.ViewColumn)(),
|
|
186
|
+
__metadata("design:type", Number)
|
|
187
|
+
], LocalsCompany.prototype, "pos_system_status", void 0);
|
|
138
188
|
LocalsCompany = __decorate([
|
|
139
189
|
(0, typeorm_1.ViewEntity)({
|
|
140
190
|
name: 'locals_company',
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
+
import { PosSystem } from '..'
|
|
3
|
+
|
|
4
|
+
@Entity({
|
|
5
|
+
name: 'authentication_credential',
|
|
6
|
+
comment:
|
|
7
|
+
'Tabla creada para almacenar los tipos de autenticación que van a tener los sistemas POS.',
|
|
8
|
+
})
|
|
9
|
+
export class AuthenticationCredential {
|
|
10
|
+
@PrimaryGeneratedColumn({
|
|
11
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
12
|
+
})
|
|
13
|
+
id: number
|
|
14
|
+
|
|
15
|
+
@Column({
|
|
16
|
+
length: 30,
|
|
17
|
+
comment:
|
|
18
|
+
'Tipo de autenticación que va a tener el sistema:\r\n1. auth_basic: username/email y password para autenticación básica y JWT.\r\n\r\n2. auth_token: client_id y client_secret junto con username y password para OAuth 2.0 Password Grant.\r\n\r\n3. auth_oauth: client_id, redirect_uri, response_type, scope, y state para OAuth 2.0 Authorization Code Grant.\r\n\r\n4. auth_api_key: api_key para autenticación basada en claves API.\r\n\r\nAcá toca tener en cuenta cada tipo para hacer la respectiva autenticación, para esto ver ejemplos y usos de cada uno.',
|
|
19
|
+
})
|
|
20
|
+
type: string
|
|
21
|
+
|
|
22
|
+
@Column({ length: 30, comment: 'Nombre del tipo de autenticación.' })
|
|
23
|
+
name: string
|
|
24
|
+
|
|
25
|
+
@Column({
|
|
26
|
+
length: 200,
|
|
27
|
+
comment:
|
|
28
|
+
'Variables que se necesitan separadas por ,\r\nejemplo: username,password....\r\n\r\nEsto se tiene en cuenta para crear los elementos en el frontend y poder guardarlos en la tabla (pos_system -> settings).',
|
|
29
|
+
})
|
|
30
|
+
variables: string
|
|
31
|
+
|
|
32
|
+
@Column({
|
|
33
|
+
default: 1,
|
|
34
|
+
comment: 'Estado del tipo de autenticación:\r\n0: Inactivo.\r\n1: Activo.',
|
|
35
|
+
})
|
|
36
|
+
status: number
|
|
37
|
+
|
|
38
|
+
@OneToMany(
|
|
39
|
+
() => PosSystem,
|
|
40
|
+
(posSystem) => posSystem.authentication_credentials
|
|
41
|
+
)
|
|
42
|
+
authenticationCredentials: PosSystem[]
|
|
43
|
+
}
|
package/src/entities/Local.ts
CHANGED
|
@@ -20,6 +20,8 @@ import { Terminal } from './Terminal'
|
|
|
20
20
|
import { User } from './User'
|
|
21
21
|
import { Partner } from './Partner'
|
|
22
22
|
import { BusinessTypeProduct } from './BusinessTypeProduct'
|
|
23
|
+
import { PosSystem } from '..'
|
|
24
|
+
import { jsonTransformer } from '../transformers/jsonTransformer'
|
|
23
25
|
|
|
24
26
|
@Entity({ comment: 'Locales disponibles de las empresas (company).' })
|
|
25
27
|
export class Local {
|
|
@@ -57,6 +59,7 @@ export class Local {
|
|
|
57
59
|
@Column({
|
|
58
60
|
type: 'longtext',
|
|
59
61
|
nullable: true,
|
|
62
|
+
transformer: jsonTransformer,
|
|
60
63
|
comment:
|
|
61
64
|
'Campo de tipo JSON por si es necesario agregar información adicional',
|
|
62
65
|
})
|
|
@@ -82,6 +85,22 @@ export class Local {
|
|
|
82
85
|
@JoinColumn({ name: 'square' })
|
|
83
86
|
square: Square
|
|
84
87
|
|
|
88
|
+
@ManyToOne(() => PosSystem, (posSystem) => posSystem.locals_pos_system, {
|
|
89
|
+
onDelete: 'RESTRICT',
|
|
90
|
+
onUpdate: 'NO ACTION',
|
|
91
|
+
})
|
|
92
|
+
@JoinColumn({ name: 'pos_system' })
|
|
93
|
+
pos_system: PosSystem
|
|
94
|
+
|
|
95
|
+
@Column({
|
|
96
|
+
type: 'text',
|
|
97
|
+
nullable: true,
|
|
98
|
+
transformer: jsonTransformer,
|
|
99
|
+
comment:
|
|
100
|
+
'Campo de tipo JSON por si es necesario agregar información adicional',
|
|
101
|
+
})
|
|
102
|
+
pos_system_settings: string
|
|
103
|
+
|
|
85
104
|
@Column({
|
|
86
105
|
default: 1,
|
|
87
106
|
comment:
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Entity,
|
|
4
|
+
JoinColumn,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
OneToMany,
|
|
7
|
+
PrimaryGeneratedColumn,
|
|
8
|
+
} from 'typeorm'
|
|
9
|
+
import { AuthenticationCredential, Local } from '..'
|
|
10
|
+
|
|
11
|
+
@Entity({
|
|
12
|
+
name: 'pos_system',
|
|
13
|
+
comment:
|
|
14
|
+
'Tabla creada para almacenar los sistemas POS que se quieran enlazar con nuestro sistema y así tener una integración más completa.',
|
|
15
|
+
})
|
|
16
|
+
export class PosSystem {
|
|
17
|
+
@PrimaryGeneratedColumn({
|
|
18
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
19
|
+
})
|
|
20
|
+
id: number
|
|
21
|
+
|
|
22
|
+
@Column({ length: 50, comment: 'Nombre del registro.' })
|
|
23
|
+
name: string
|
|
24
|
+
|
|
25
|
+
@Column({ length: 300, nullable: true, comment: 'Descripción del registro.' })
|
|
26
|
+
description: string
|
|
27
|
+
|
|
28
|
+
@Column({
|
|
29
|
+
type: 'text',
|
|
30
|
+
comment:
|
|
31
|
+
'Esto será un JSON, donde va a tener información de lo que necesita para poder una petición hacia el sistema POS para traer los productos, es decir:\r\n\r\n1. type: Tipo de endpoint que tiene los productos (GET o POST)\r\n\r\n2. endpoint_name: Este es un string que será la url de la solicitud para traerse los productos que hay en el sistema POS.\r\n\r\n3. query_parameters: Este un objeto donde se van a guardar los clave valor de cada item qué necesitemos, es decir:\r\n{"productId": "product_id"...}\r\n{"ProductId: "product_id"...}\r\n{"productid": "product_id"...}\r\n\r\nEntonces, con este elemento se puede saber el parámetro que nosotros (asumano) usamos, y el parámetro que necesita el api (POS).\r\n',
|
|
32
|
+
})
|
|
33
|
+
endpoint_products: string
|
|
34
|
+
|
|
35
|
+
@Column({
|
|
36
|
+
type: 'text',
|
|
37
|
+
comment:
|
|
38
|
+
'Esto será un JSON, donde va a tener información de lo que necesita para poder una petición hacia el sistema POS para realizar un pedido, es decir:\r\n\r\n1. type: Tipo de endpoint que tiene los pedidos (GET o POST) (Acá todos los desarrolladores deberían usar POST, ya que es una creación, pero hay casos en que no los usan, toca validar).\r\n\r\n2. endpoint_name: Este es un string que será la url de la solicitud para crear un pedido en el sistema POS.\r\n\r\n3. query_parameters: Este un objeto donde se van a guardar los clave valor de cada item qué necesitemos, es decir:\r\n{"productId": "product_id"...}\r\n{"ProductId: "product_id"...}\r\n{"productid": "product_id"...}\r\n\r\nEntonces, con este elemento se puede saber el parámetro que nosotros (asumano) usamos, y el parámetro que necesita el api (POS) para poder crear el pedido.\r\n',
|
|
39
|
+
})
|
|
40
|
+
endpoint_order: string
|
|
41
|
+
|
|
42
|
+
@ManyToOne(
|
|
43
|
+
() => AuthenticationCredential,
|
|
44
|
+
(authenticationCredential) =>
|
|
45
|
+
authenticationCredential.authenticationCredentials,
|
|
46
|
+
{
|
|
47
|
+
onDelete: 'RESTRICT',
|
|
48
|
+
onUpdate: 'NO ACTION',
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
@JoinColumn({ name: 'authentication_credentials' })
|
|
52
|
+
authentication_credentials: AuthenticationCredential
|
|
53
|
+
|
|
54
|
+
@Column({
|
|
55
|
+
default: 1,
|
|
56
|
+
comment:
|
|
57
|
+
'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
|
|
58
|
+
})
|
|
59
|
+
status: number
|
|
60
|
+
|
|
61
|
+
@OneToMany(() => Local, (local) => local.pos_system)
|
|
62
|
+
locals_pos_system: Local[]
|
|
63
|
+
}
|
|
@@ -39,3 +39,5 @@ export { User } from './entities/User'
|
|
|
39
39
|
export { UserAddress } from './entities/UserAddress'
|
|
40
40
|
export { LocalsCompany } from './views/LocalsCompany'
|
|
41
41
|
export { BusinessType } from './entities/BusinessType'
|
|
42
|
+
export { AuthenticationCredential } from './entities/AuthenticationCredential'
|
|
43
|
+
export { PosSystem } from './entities/PosSystem'
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import moment = require('moment-timezone')
|
|
1
2
|
import { ViewEntity, ViewColumn } from 'typeorm'
|
|
3
|
+
import { getTimeZone } from '..'
|
|
2
4
|
|
|
3
5
|
// JSON Transformer
|
|
4
6
|
const jsonTransformer = {
|
|
5
7
|
to: (value: any) => JSON.stringify(value),
|
|
6
8
|
from: (value: string) => JSON.parse(value),
|
|
7
9
|
}
|
|
10
|
+
|
|
11
|
+
const DateTransformer = {
|
|
12
|
+
to(value: Date | string): string {
|
|
13
|
+
return moment.utc(value).format('YYYY-MM-DD HH:mm:ss')
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
from(value: string): string {
|
|
17
|
+
return moment.utc(value).tz(getTimeZone()).format('YYYY-MM-DD HH:mm:ss')
|
|
18
|
+
},
|
|
19
|
+
}
|
|
8
20
|
@ViewEntity({
|
|
9
21
|
name: 'locals_company',
|
|
10
22
|
})
|
|
@@ -95,4 +107,34 @@ export class LocalsCompany {
|
|
|
95
107
|
|
|
96
108
|
@ViewColumn()
|
|
97
109
|
request_count: number
|
|
110
|
+
|
|
111
|
+
@ViewColumn()
|
|
112
|
+
pos_system_id: number
|
|
113
|
+
|
|
114
|
+
@ViewColumn()
|
|
115
|
+
pos_system_name: string
|
|
116
|
+
|
|
117
|
+
@ViewColumn()
|
|
118
|
+
pos_system_description: string
|
|
119
|
+
|
|
120
|
+
@ViewColumn({ transformer: jsonTransformer })
|
|
121
|
+
pos_system_endpoint_products: object
|
|
122
|
+
|
|
123
|
+
@ViewColumn({ transformer: jsonTransformer })
|
|
124
|
+
pos_system_endpoint_order: object
|
|
125
|
+
|
|
126
|
+
@ViewColumn()
|
|
127
|
+
pos_system_authentication_credentials: number
|
|
128
|
+
|
|
129
|
+
@ViewColumn({ transformer: jsonTransformer })
|
|
130
|
+
pos_system_settings: object
|
|
131
|
+
|
|
132
|
+
@ViewColumn({ transformer: DateTransformer })
|
|
133
|
+
pos_system_created: string
|
|
134
|
+
|
|
135
|
+
@ViewColumn({ transformer: DateTransformer })
|
|
136
|
+
pos_system_expiration: string
|
|
137
|
+
|
|
138
|
+
@ViewColumn()
|
|
139
|
+
pos_system_status: number
|
|
98
140
|
}
|