test-entity-library-asm 1.1.9 → 1.2.1

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.
Files changed (102) hide show
  1. package/dist/entities/Category.d.ts +5 -3
  2. package/dist/entities/Category.js +38 -13
  3. package/dist/entities/CategorySchedule.d.ts +10 -0
  4. package/dist/entities/CategorySchedule.js +67 -0
  5. package/dist/entities/City.d.ts +3 -2
  6. package/dist/entities/City.js +35 -10
  7. package/dist/entities/CodeRedemptionHistoryCompany.d.ts +4 -3
  8. package/dist/entities/CodeRedemptionHistoryCompany.js +31 -10
  9. package/dist/entities/CodeRedemptionHistoryUser.js +13 -6
  10. package/dist/entities/Company.d.ts +2 -1
  11. package/dist/entities/Company.js +64 -18
  12. package/dist/entities/Configuration.d.ts +2 -1
  13. package/dist/entities/Configuration.js +26 -4
  14. package/dist/entities/Country.js +14 -9
  15. package/dist/entities/Day.d.ts +2 -1
  16. package/dist/entities/Day.js +31 -6
  17. package/dist/entities/DiscountCodeCompany.d.ts +2 -1
  18. package/dist/entities/DiscountCodeCompany.js +42 -12
  19. package/dist/entities/DiscountCodeUser.js +24 -13
  20. package/dist/entities/Local.d.ts +14 -2
  21. package/dist/entities/Local.js +73 -13
  22. package/dist/entities/LocalQualification.d.ts +10 -0
  23. package/dist/entities/LocalQualification.js +76 -0
  24. package/dist/entities/Master.d.ts +2 -1
  25. package/dist/entities/Master.js +26 -4
  26. package/dist/entities/PaymentMethod.d.ts +13 -0
  27. package/dist/entities/PaymentMethod.js +102 -0
  28. package/dist/entities/Permission.d.ts +2 -1
  29. package/dist/entities/Permission.js +32 -8
  30. package/dist/entities/Plan.d.ts +2 -1
  31. package/dist/entities/Plan.js +38 -10
  32. package/dist/entities/Product.d.ts +8 -1
  33. package/dist/entities/Product.js +62 -12
  34. package/dist/entities/ProductGroup.js +16 -8
  35. package/dist/entities/ProductIngredient.d.ts +12 -0
  36. package/dist/entities/ProductIngredient.js +84 -0
  37. package/dist/entities/ProductTopping.d.ts +2 -1
  38. package/dist/entities/ProductTopping.js +33 -7
  39. package/dist/entities/Region.d.ts +3 -2
  40. package/dist/entities/Region.js +40 -10
  41. package/dist/entities/Request.d.ts +21 -0
  42. package/dist/entities/Request.js +137 -0
  43. package/dist/entities/RequestProduct.d.ts +12 -0
  44. package/dist/entities/RequestProduct.js +85 -0
  45. package/dist/entities/RequestProductGroupComplement.d.ts +11 -0
  46. package/dist/entities/RequestProductGroupComplement.js +80 -0
  47. package/dist/entities/RequestStatus.d.ts +11 -0
  48. package/dist/entities/RequestStatus.js +85 -0
  49. package/dist/entities/Role.js +11 -4
  50. package/dist/entities/RoleVisibleTo.d.ts +2 -1
  51. package/dist/entities/RoleVisibleTo.js +30 -5
  52. package/dist/entities/Square.d.ts +13 -0
  53. package/dist/entities/Square.js +97 -0
  54. package/dist/entities/Terminal.d.ts +2 -0
  55. package/dist/entities/Terminal.js +21 -4
  56. package/dist/entities/TerminalSession.d.ts +3 -2
  57. package/dist/entities/TerminalSession.js +41 -8
  58. package/dist/entities/TypeFood.d.ts +2 -1
  59. package/dist/entities/TypeFood.js +33 -6
  60. package/dist/entities/TypeMeasureIngredient.d.ts +9 -0
  61. package/dist/entities/TypeMeasureIngredient.js +73 -0
  62. package/dist/entities/User.d.ts +17 -7
  63. package/dist/entities/User.js +104 -25
  64. package/dist/entities/productGroupComplement.d.ts +4 -1
  65. package/dist/entities/productGroupComplement.js +35 -8
  66. package/package.json +1 -1
  67. package/src/entities/Category.ts +33 -15
  68. package/src/entities/CategorySchedule.ts +35 -0
  69. package/src/entities/City.ts +18 -8
  70. package/src/entities/CodeRedemptionHistoryCompany.ts +17 -9
  71. package/src/entities/CodeRedemptionHistoryUser.ts +15 -6
  72. package/src/entities/Company.ts +51 -17
  73. package/src/entities/Configuration.ts +10 -4
  74. package/src/entities/Country.ts +16 -10
  75. package/src/entities/Day.ts +16 -6
  76. package/src/entities/DiscountCodeCompany.ts +26 -11
  77. package/src/entities/DiscountCodeUser.ts +25 -12
  78. package/src/entities/Local.ts +54 -12
  79. package/src/entities/LocalQualification.ts +45 -0
  80. package/src/entities/Master.ts +17 -4
  81. package/src/entities/PaymentMethod.ts +72 -0
  82. package/src/entities/Permission.ts +16 -7
  83. package/src/entities/Plan.ts +22 -9
  84. package/src/entities/Product.ts +47 -11
  85. package/src/entities/ProductGroup.ts +18 -8
  86. package/src/entities/ProductIngredient.ts +55 -0
  87. package/src/entities/ProductTopping.ts +17 -6
  88. package/src/entities/Region.ts +24 -8
  89. package/src/entities/Request.ts +107 -0
  90. package/src/entities/RequestProduct.ts +51 -0
  91. package/src/entities/RequestProductGroupComplement.ts +55 -0
  92. package/src/entities/RequestStatus.ts +55 -0
  93. package/src/entities/Role.ts +12 -4
  94. package/src/entities/RoleVisibleTo.ts +13 -4
  95. package/src/entities/Square.ts +56 -0
  96. package/src/entities/Terminal.ts +24 -4
  97. package/src/entities/TerminalSession.ts +28 -10
  98. package/src/entities/TypeFood.ts +18 -5
  99. package/src/entities/TypeMeasureIngredient.ts +46 -0
  100. package/src/entities/User.ts +93 -28
  101. package/src/entities/productGroupComplement.ts +23 -7
  102. package/src/entities/ScheduleCategory.ts +0 -32
@@ -1,4 +1,19 @@
1
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
+ })();
2
17
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
18
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
19
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -12,85 +27,126 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
27
  exports.User = void 0;
13
28
  var typeorm_1 = require("typeorm");
14
29
  var City_1 = require("./City");
15
- var Terminal_1 = require("./Terminal");
16
- var TerminalSession_1 = require("./TerminalSession");
17
- var Plan_1 = require("./Plan");
30
+ var CodeRedemptionHistoryUser_1 = require("./CodeRedemptionHistoryUser");
18
31
  var Company_1 = require("./Company");
19
- var Local_1 = require("./Local");
20
32
  var DiscountCodeCompany_1 = require("./DiscountCodeCompany");
21
33
  var DiscountCodeUser_1 = require("./DiscountCodeUser");
22
- var CodeRedemptionHistoryUser_1 = require("./CodeRedemptionHistoryUser");
34
+ var Local_1 = require("./Local");
35
+ var LocalQualification_1 = require("./LocalQualification");
23
36
  var Master_1 = require("./Master");
24
- var User = /** @class */ (function () {
37
+ var Plan_1 = require("./Plan");
38
+ var Request_1 = require("./Request");
39
+ var RequestProduct_1 = require("./RequestProduct");
40
+ var RequestProductGroupComplement_1 = require("./RequestProductGroupComplement");
41
+ var Terminal_1 = require("./Terminal");
42
+ var TerminalSession_1 = require("./TerminalSession");
43
+ var User = /** @class */ (function (_super) {
44
+ __extends(User, _super);
25
45
  function User() {
46
+ return _super !== null && _super.apply(this, arguments) || this;
26
47
  }
27
48
  __decorate([
28
- (0, typeorm_1.PrimaryGeneratedColumn)(),
49
+ (0, typeorm_1.PrimaryGeneratedColumn)({
50
+ comment: 'Número de identificación (ID) único de cada registro.',
51
+ }),
29
52
  __metadata("design:type", Number)
30
53
  ], User.prototype, "id", void 0);
31
54
  __decorate([
32
- (0, typeorm_1.Column)({ length: 30, unique: true }),
55
+ (0, typeorm_1.Column)({ length: 30, unique: true, comment: 'Código único del usuario.' }),
33
56
  __metadata("design:type", String)
34
57
  ], User.prototype, "code", void 0);
35
58
  __decorate([
36
- (0, typeorm_1.Column)(),
37
- __metadata("design:type", Number)
59
+ (0, typeorm_1.Column)({
60
+ length: 14,
61
+ unique: true,
62
+ comment: 'Número de documento del usuario.',
63
+ }),
64
+ __metadata("design:type", String)
38
65
  ], User.prototype, "document", void 0);
39
66
  __decorate([
40
- (0, typeorm_1.Column)({ length: 50 }),
67
+ (0, typeorm_1.Column)({ length: 50, comment: 'Nombre del usuario.' }),
41
68
  __metadata("design:type", String)
42
69
  ], User.prototype, "name", void 0);
43
70
  __decorate([
44
- (0, typeorm_1.Column)({ length: 50 }),
71
+ (0, typeorm_1.Column)({ length: 50, comment: 'Apellidos del usuario.' }),
45
72
  __metadata("design:type", String)
46
73
  ], User.prototype, "surname", void 0);
47
74
  __decorate([
48
- (0, typeorm_1.Column)({ length: 60, unique: true }),
75
+ (0, typeorm_1.Column)({
76
+ length: 60,
77
+ unique: true,
78
+ comment: 'Correo electrónico del usuario.',
79
+ }),
49
80
  __metadata("design:type", String)
50
81
  ], User.prototype, "email", void 0);
51
82
  __decorate([
52
- (0, typeorm_1.Column)({ length: 12, unique: true }),
83
+ (0, typeorm_1.Column)({
84
+ length: 12,
85
+ unique: true,
86
+ comment: 'Número de celular del usuario.',
87
+ }),
53
88
  __metadata("design:type", String)
54
89
  ], User.prototype, "phone", void 0);
55
90
  __decorate([
56
- (0, typeorm_1.ManyToOne)(function () { return City_1.City; }, function (city) { return city.users; }),
91
+ (0, typeorm_1.ManyToOne)(function () { return City_1.City; }, function (city) { return city.users; }, {
92
+ onDelete: 'RESTRICT',
93
+ onUpdate: 'NO ACTION',
94
+ }),
57
95
  (0, typeorm_1.JoinColumn)({ name: 'city' }),
58
96
  __metadata("design:type", City_1.City)
59
97
  ], User.prototype, "city", void 0);
60
98
  __decorate([
61
- (0, typeorm_1.Column)({ nullable: true, length: 100 }),
99
+ (0, typeorm_1.Column)({ nullable: true, length: 100, comment: 'Dirección del usuario.' }),
62
100
  __metadata("design:type", String)
63
101
  ], User.prototype, "address", void 0);
64
102
  __decorate([
65
- (0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
103
+ (0, typeorm_1.Column)({
104
+ type: 'decimal',
105
+ precision: 10,
106
+ scale: 8,
107
+ nullable: true,
108
+ comment: 'Latitude de la dirección del usuario.',
109
+ }),
66
110
  __metadata("design:type", Number)
67
111
  ], User.prototype, "latitude", void 0);
68
112
  __decorate([
69
- (0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
113
+ (0, typeorm_1.Column)({
114
+ type: 'decimal',
115
+ precision: 10,
116
+ scale: 8,
117
+ nullable: true,
118
+ comment: 'Longitude de la dirección del usuario.',
119
+ }),
70
120
  __metadata("design:type", Number)
71
121
  ], User.prototype, "longitude", void 0);
72
122
  __decorate([
73
- (0, typeorm_1.Column)({ length: 20 }),
123
+ (0, typeorm_1.Column)({
124
+ length: 20,
125
+ comment: 'Contraseña almacenada tipo MD5 del usuario.',
126
+ }),
74
127
  __metadata("design:type", String)
75
128
  ], User.prototype, "password", void 0);
76
129
  __decorate([
77
130
  (0, typeorm_1.Column)({
78
131
  type: 'longtext',
79
132
  nullable: true,
80
- comment: 'Campo de tipo JSON donde se guarda información necesaria para el usuario',
133
+ comment: 'Campo de tipo JSON donde se guarda información necesaria para el registro.',
81
134
  }),
82
135
  __metadata("design:type", String)
83
136
  ], User.prototype, "profile", void 0);
84
137
  __decorate([
85
- (0, typeorm_1.Column)({ type: 'datetime' }),
138
+ (0, typeorm_1.Column)({ type: 'datetime', comment: 'Fecha de creación del registro.' }),
86
139
  __metadata("design:type", Date)
87
140
  ], User.prototype, "created", void 0);
88
141
  __decorate([
89
- (0, typeorm_1.Column)({ type: 'datetime' }),
142
+ (0, typeorm_1.Column)({ type: 'datetime', comment: 'Fecha de actualización del registro.' }),
90
143
  __metadata("design:type", Date)
91
144
  ], User.prototype, "updated", void 0);
92
145
  __decorate([
93
- (0, typeorm_1.Column)({ default: 1 }),
146
+ (0, typeorm_1.Column)({
147
+ default: 1,
148
+ comment: '¿El usuario tiene acceso a la plataforma?:\r\n1. Activo: El usuario tiene acceso.\r\n0. Inactivo: El usuario no tiene acceso a la plataforma.',
149
+ }),
94
150
  __metadata("design:type", Number)
95
151
  ], User.prototype, "status", void 0);
96
152
  __decorate([
@@ -139,9 +195,32 @@ var User = /** @class */ (function () {
139
195
  (0, typeorm_1.OneToMany)(function () { return Master_1.Master; }, function (master) { return master.user; }),
140
196
  __metadata("design:type", Array)
141
197
  ], User.prototype, "masters", void 0);
198
+ __decorate([
199
+ (0, typeorm_1.OneToMany)(function () { return LocalQualification_1.LocalQualification; }, function (localQualification) { return localQualification.user; }),
200
+ __metadata("design:type", Array)
201
+ ], User.prototype, "qualifications", void 0);
202
+ __decorate([
203
+ (0, typeorm_1.OneToMany)(function () { return Request_1.Request; }, function (request) { return request.user; }),
204
+ __metadata("design:type", Array)
205
+ ], User.prototype, "requests", void 0);
206
+ __decorate([
207
+ (0, typeorm_1.ManyToMany)(function () { return Request_1.Request; }),
208
+ (0, typeorm_1.JoinTable)({
209
+ name: 'request_group',
210
+ }),
211
+ __metadata("design:type", Array)
212
+ ], User.prototype, "requests_group", void 0);
213
+ __decorate([
214
+ (0, typeorm_1.OneToMany)(function () { return RequestProduct_1.RequestProduct; }, function (requestProduct) { return requestProduct.user; }),
215
+ __metadata("design:type", Array)
216
+ ], User.prototype, "request_products", void 0);
217
+ __decorate([
218
+ (0, typeorm_1.OneToMany)(function () { return RequestProductGroupComplement_1.RequestProductGroupComplement; }, function (requestProduct) { return requestProduct.user; }),
219
+ __metadata("design:type", Array)
220
+ ], User.prototype, "request_product_group_complements", void 0);
142
221
  User = __decorate([
143
- (0, typeorm_1.Entity)()
222
+ (0, typeorm_1.Entity)({ comment: 'Usuarios registrados en la plataforma.' })
144
223
  ], User);
145
224
  return User;
146
- }());
225
+ }(typeorm_1.BaseEntity));
147
226
  exports.User = User;
@@ -1,8 +1,11 @@
1
+ import { BaseEntity } from 'typeorm';
1
2
  import { ProductGroup } from './ProductGroup';
2
- export declare class ProductGroupComplement {
3
+ import { RequestProductGroupComplement } from './RequestProductGroupComplement';
4
+ export declare class ProductGroupComplement extends BaseEntity {
3
5
  id: number;
4
6
  group_id: ProductGroup;
5
7
  name: string;
6
8
  price: string;
7
9
  position: number;
10
+ request_product_group_complements: RequestProductGroupComplement[];
8
11
  }
@@ -1,4 +1,19 @@
1
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
+ })();
2
17
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
18
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
19
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -12,35 +27,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
27
  exports.ProductGroupComplement = void 0;
13
28
  var typeorm_1 = require("typeorm");
14
29
  var ProductGroup_1 = require("./ProductGroup");
15
- var ProductGroupComplement = /** @class */ (function () {
30
+ var RequestProductGroupComplement_1 = require("./RequestProductGroupComplement");
31
+ var ProductGroupComplement = /** @class */ (function (_super) {
32
+ __extends(ProductGroupComplement, _super);
16
33
  function ProductGroupComplement() {
34
+ return _super !== null && _super.apply(this, arguments) || this;
17
35
  }
18
36
  __decorate([
19
- (0, typeorm_1.PrimaryGeneratedColumn)(),
37
+ (0, typeorm_1.PrimaryGeneratedColumn)({
38
+ comment: 'Número de identificación (ID) único de cada registro.',
39
+ }),
20
40
  __metadata("design:type", Number)
21
41
  ], ProductGroupComplement.prototype, "id", void 0);
22
42
  __decorate([
23
- (0, typeorm_1.ManyToOne)(function () { return ProductGroup_1.ProductGroup; }, function (productGroup) { return productGroup.groups_complement; }),
43
+ (0, typeorm_1.ManyToOne)(function () { return ProductGroup_1.ProductGroup; }, function (productGroup) { return productGroup.groups_complement; }, {
44
+ onDelete: 'CASCADE',
45
+ onUpdate: 'NO ACTION',
46
+ }),
24
47
  (0, typeorm_1.JoinColumn)({ name: 'group_id' }),
25
48
  __metadata("design:type", ProductGroup_1.ProductGroup)
26
49
  ], ProductGroupComplement.prototype, "group_id", void 0);
27
50
  __decorate([
28
- (0, typeorm_1.Column)({ length: 30 }),
51
+ (0, typeorm_1.Column)({ length: 30, comment: 'Nombre del complemento.' }),
29
52
  __metadata("design:type", String)
30
53
  ], ProductGroupComplement.prototype, "name", void 0);
31
54
  __decorate([
32
- (0, typeorm_1.Column)({ length: 20 }),
55
+ (0, typeorm_1.Column)({ length: 20, comment: 'Precio del complemento.' }),
33
56
  __metadata("design:type", String)
34
57
  ], ProductGroupComplement.prototype, "price", void 0);
35
58
  __decorate([
36
- (0, typeorm_1.Column)(),
59
+ (0, typeorm_1.Column)({ comment: 'El orden en que aparece los grupos en el producto.' }),
37
60
  __metadata("design:type", Number)
38
61
  ], ProductGroupComplement.prototype, "position", void 0);
62
+ __decorate([
63
+ (0, typeorm_1.OneToMany)(function () { return RequestProductGroupComplement_1.RequestProductGroupComplement; }, function (requestProduct) { return requestProduct.product_group_complement; }),
64
+ __metadata("design:type", Array)
65
+ ], ProductGroupComplement.prototype, "request_product_group_complements", void 0);
39
66
  ProductGroupComplement = __decorate([
40
67
  (0, typeorm_1.Entity)('product_group_complement', {
41
- comment: 'Los complementos que tiene el grupo de un producto.',
68
+ comment: 'Los complementos que tiene el grupo de un producto (product_group_complement).',
42
69
  })
43
70
  ], ProductGroupComplement);
44
71
  return ProductGroupComplement;
45
- }());
72
+ }(typeorm_1.BaseEntity));
46
73
  exports.ProductGroupComplement = ProductGroupComplement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "1.1.9",
3
+ "version": "1.2.1",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,21 +1,39 @@
1
- import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from 'typeorm';
2
- import { Local } from './Local';
1
+ import {
2
+ Entity,
3
+ Column,
4
+ PrimaryGeneratedColumn,
5
+ ManyToOne,
6
+ JoinColumn,
7
+ Unique,
8
+ OneToMany,
9
+ BaseEntity,
10
+ } from 'typeorm'
11
+ import { Local } from './Local'
12
+ import { Product } from './Product'
3
13
 
4
- @Entity()
5
- export class Category {
6
- @PrimaryGeneratedColumn()
7
- id: number;
14
+ @Entity({
15
+ comment:
16
+ 'Lista de categorías que tiene un local en su menú: promos, de la semana, completo...\r\n\r\nEsas categorías será visibles a nivel app como un menu horizontal donde cada categoría tendrá sus productos.',
17
+ })
18
+ export class Category extends BaseEntity {
19
+ @PrimaryGeneratedColumn({
20
+ comment: 'Número de identificación (ID) único de cada registro.',
21
+ })
22
+ id: number
8
23
 
9
- @Column()
10
- localId: number;
24
+ @ManyToOne(() => Local, (local) => local.categories, {
25
+ onDelete: 'CASCADE',
26
+ onUpdate: 'NO ACTION',
27
+ })
28
+ @JoinColumn({ name: 'local' })
29
+ local: Local
11
30
 
12
- @Column({ length: 30 })
13
- name: string;
31
+ @Column({ length: 30, comment: 'Nombre de la categoría.' })
32
+ name: string
14
33
 
15
- @Column()
16
- position: number;
34
+ @Column({ comment: '¿En qué posición se va a mostrar esta categoría?' })
35
+ position: number
17
36
 
18
- @ManyToOne(() => Local)
19
- @JoinColumn({ name: 'localId' })
20
- local: Local;
37
+ @OneToMany(() => Product, (product) => product.category)
38
+ products: Product[]
21
39
  }
@@ -0,0 +1,35 @@
1
+ import {
2
+ Entity,
3
+ Column,
4
+ PrimaryGeneratedColumn,
5
+ ManyToOne,
6
+ JoinColumn,
7
+ BaseEntity,
8
+ } from 'typeorm'
9
+ import { Category } from './Category'
10
+ import { Day } from './Day'
11
+
12
+ @Entity('category_schedule', {
13
+ comment:
14
+ 'Horarios en que se puede ver una categoría, si se desea que una categoría esté los lunes de 7 am a 5 pm se puede hacer.',
15
+ })
16
+ export class ScheduleCategory extends BaseEntity {
17
+ @PrimaryGeneratedColumn({
18
+ comment: 'Número de identificación (ID) único de cada registro.',
19
+ })
20
+ id: number
21
+
22
+ @ManyToOne(() => Category, { onDelete: 'CASCADE', onUpdate: 'NO ACTION' })
23
+ @JoinColumn({ name: 'category' })
24
+ category: Category
25
+
26
+ @ManyToOne(() => Day, { onDelete: 'RESTRICT', onUpdate: 'NO ACTION' })
27
+ @JoinColumn({ name: 'day' })
28
+ day: Day
29
+
30
+ @Column({ comment: 'Hora de inicio.' })
31
+ start_time: string
32
+
33
+ @Column({ comment: 'Hora de finalización.' })
34
+ end_time: string
35
+ }
@@ -5,25 +5,35 @@ import {
5
5
  ManyToOne,
6
6
  JoinColumn,
7
7
  OneToMany,
8
+ BaseEntity,
8
9
  } from 'typeorm'
9
10
  import { Region } from './Region'
10
11
  import { User } from './User'
11
12
  import { Company } from './Company'
12
13
  import { Local } from './Local'
13
14
 
14
- @Entity()
15
- export class City {
16
- @PrimaryGeneratedColumn()
15
+ @Entity({ comment: 'Ciudades donde está visible la plataforma.' })
16
+ export class City extends BaseEntity {
17
+ @PrimaryGeneratedColumn({
18
+ comment: 'Número de identificación (ID) único de cada registro.',
19
+ })
17
20
  id: number
18
21
 
19
- @Column({ length: 50 })
20
- name: string
21
-
22
- @ManyToOne(() => Region, (region) => region.cities)
22
+ @ManyToOne(() => Region, (region) => region.cities, {
23
+ onDelete: 'RESTRICT',
24
+ onUpdate: 'RESTRICT',
25
+ })
23
26
  @JoinColumn({ name: 'region' })
24
27
  region: Region
25
28
 
26
- @Column({ default: 1 })
29
+ @Column({ length: 50, comment: 'Nombre de la ciudad.' })
30
+ name: string
31
+
32
+ @Column({
33
+ default: 1,
34
+ comment:
35
+ 'Estado de la ciudad, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
36
+ })
27
37
  status: number
28
38
 
29
39
  @OneToMany(() => User, (user) => user.city)
@@ -4,32 +4,40 @@ import {
4
4
  PrimaryGeneratedColumn,
5
5
  ManyToOne,
6
6
  JoinColumn,
7
+ BaseEntity,
7
8
  } from 'typeorm'
8
9
  import { DiscountCodeCompany } from './DiscountCodeCompany'
9
10
  import { Company } from './Company'
10
11
 
11
- @Entity('code_redemption_history_company')
12
- export class CodeRedemptionHistoryCompany {
13
- @PrimaryGeneratedColumn()
12
+ @Entity('code_redemption_history_company', {
13
+ comment:
14
+ 'Historial de códigos redimidos por la empresa, si en algún momento cuando una empresa se registre en la plataforma, entonces se le puede dar un descuento o un plan personalizado.',
15
+ })
16
+ export class CodeRedemptionHistoryCompany extends BaseEntity {
17
+ @PrimaryGeneratedColumn({
18
+ comment: 'Número de identificación (ID) único de cada registro.',
19
+ })
14
20
  id: number
15
21
 
16
22
  @ManyToOne(
17
23
  () => DiscountCodeCompany,
18
- (company) => company.code_redemptions_history_company
24
+ (company) => company.code_redemptions_history_company,
25
+ { onDelete: 'CASCADE', onUpdate: 'NO ACTION' }
19
26
  )
20
27
  @JoinColumn({ name: 'discount_code_company' })
21
28
  discount_code_company: DiscountCodeCompany
22
29
 
23
30
  @ManyToOne(
24
31
  () => Company,
25
- (company) => company.code_redemption_history_company
32
+ (company) => company.code_redemption_history_company,
33
+ { onDelete: 'CASCADE', onUpdate: 'NO ACTION' }
26
34
  )
27
35
  @JoinColumn({ name: 'company' })
28
36
  company: Company
29
37
 
30
- @Column({ type: 'datetime' })
31
- dateUsed: Date
38
+ @Column({ type: 'datetime', comment: 'Fecha cuando se usó el descuento.' })
39
+ date_used: Date
32
40
 
33
- @Column({ length: 10 })
34
- discountApplied: string
41
+ @Column({ length: 10, comment: 'El valor del descuento aplicado.' })
42
+ discount_applied: string
35
43
  }
@@ -8,25 +8,34 @@ import {
8
8
  import { User } from './User'
9
9
  import { DiscountCodeUser } from './DiscountCodeUser'
10
10
 
11
- @Entity('code_redemption_history_user')
11
+ @Entity('code_redemption_history_user', {
12
+ comment:
13
+ 'Historial de los códigos redimidos por los usuarios, es decir, si un local desea agregar un código de descuento para qué los usuarios puedan tener un descuento, entonces acá van a estar los que lo redimieron.',
14
+ })
12
15
  export class CodeRedemptionHistoryUser {
13
- @PrimaryGeneratedColumn()
16
+ @PrimaryGeneratedColumn({
17
+ comment: 'Número de identificación (ID) único de cada registro.',
18
+ })
14
19
  id: number
15
20
 
16
21
  @ManyToOne(
17
22
  () => DiscountCodeUser,
18
- (discountCodeUser) => discountCodeUser.code_redemptions_history_users
23
+ (discountCodeUser) => discountCodeUser.code_redemptions_history_users,
24
+ { onDelete: 'CASCADE', onUpdate: 'NO ACTION' }
19
25
  )
20
26
  @JoinColumn({ name: 'discount_code_user' })
21
27
  discount_code_user: DiscountCodeUser
22
28
 
23
- @ManyToOne(() => User, (user) => user.code_redemption_history_users)
29
+ @ManyToOne(() => User, (user) => user.code_redemption_history_users, {
30
+ onDelete: 'CASCADE',
31
+ onUpdate: 'NO ACTION',
32
+ })
24
33
  @JoinColumn({ name: 'user' })
25
34
  user: User
26
35
 
27
- @Column({ type: 'datetime' })
36
+ @Column({ type: 'datetime', comment: 'Fecha cuando se usó el descuento.' })
28
37
  date_used: Date
29
38
 
30
- @Column({ length: 10 })
39
+ @Column({ length: 10, comment: 'El valor del descuento aplicado.' })
31
40
  discount_applied: string
32
41
  }
@@ -7,6 +7,7 @@ import {
7
7
  ManyToMany,
8
8
  JoinTable,
9
9
  OneToMany,
10
+ BaseEntity,
10
11
  } from 'typeorm'
11
12
  import { City } from './City'
12
13
  import { User } from './User'
@@ -17,19 +18,30 @@ import { CodeRedemptionHistoryCompany } from './CodeRedemptionHistoryCompany'
17
18
  import { DiscountCodeUser } from './DiscountCodeUser'
18
19
  import { ProductTopping } from './ProductTopping'
19
20
 
20
- @Entity()
21
- export class Company {
22
- @PrimaryGeneratedColumn()
21
+ @Entity({
22
+ comment:
23
+ 'Tabla creada para las empresas de comida rápida que deseen registrarse en la plataforma.',
24
+ })
25
+ export class Company extends BaseEntity {
26
+ @PrimaryGeneratedColumn({
27
+ comment: 'Número de identificación (ID) único de cada empresa.',
28
+ })
23
29
  id: number
24
30
 
25
- @Column({ length: 50 })
31
+ @Column({ length: 50, comment: 'Nombre de la empresa.' })
26
32
  name: string
27
33
 
28
- @ManyToOne(() => City, (city) => city.companies)
34
+ @ManyToOne(() => City, (city) => city.companies, {
35
+ onDelete: 'RESTRICT',
36
+ onUpdate: 'NO ACTION',
37
+ })
29
38
  @JoinColumn({ name: 'city' })
30
39
  city: City
31
40
 
32
- @ManyToOne(() => User, (city) => city.companies)
41
+ @ManyToOne(() => User, (city) => city.companies, {
42
+ onDelete: 'CASCADE',
43
+ onUpdate: 'NO ACTION',
44
+ })
33
45
  @JoinColumn({ name: 'user' })
34
46
  user: User
35
47
 
@@ -37,21 +49,29 @@ export class Company {
37
49
  type: 'longtext',
38
50
  nullable: true,
39
51
  comment:
40
- 'Campo de tipo JSON donde se guarda información necesaria para la empresa',
52
+ 'Campo de tipo JSON donde se guarda información necesaria para la empresa.',
41
53
  })
42
54
  profile: string
43
55
 
44
- @Column({ default: 1 })
56
+ @Column({
57
+ default: 1,
58
+ comment:
59
+ 'Cantidad de locales qué la empresa de comida rápida puede tener por defecto, por defecto es un solo local.',
60
+ })
45
61
  quantity_locals: number
46
62
 
47
- @Column({ default: 6 })
63
+ @Column({
64
+ default: 6,
65
+ comment:
66
+ 'La cantidad de usuarios que puede asociar a la empresa, es decir, si la empresa desea agregar cajeros, administradores para cada punto lo puede hacer. Por defecto, la cantidad de usuarios que puede tener la empresa es de 6.',
67
+ })
48
68
  quantity_users: number
49
69
 
50
70
  @Column({
51
71
  type: 'longtext',
52
72
  nullable: true,
53
73
  comment:
54
- 'Información de tipo JSON donde se guarda la información legal de la empresa',
74
+ 'Información de tipo JSON donde se guarda la información legal de la empresa.',
55
75
  })
56
76
  legal_information: string
57
77
 
@@ -59,27 +79,41 @@ export class Company {
59
79
  type: 'longtext',
60
80
  nullable: true,
61
81
  comment:
62
- 'Información de tipo JSON donde se guarda la información del representante legal del representante',
82
+ 'Información de tipo JSON donde se guarda la información del representante legal del representante.',
63
83
  })
64
84
  legal_agent: string
65
85
 
66
- @ManyToOne(() => Plan, (plan) => plan.companies)
86
+ @ManyToOne(() => Plan, (plan) => plan.companies, {
87
+ onDelete: 'RESTRICT',
88
+ onUpdate: 'RESTRICT',
89
+ })
67
90
  @JoinColumn({ name: 'plan' })
68
91
  plan: Plan
69
92
 
70
- @Column({ type: 'datetime' })
93
+ @Column({ type: 'datetime', comment: 'Fecha creación de la empresa.' })
71
94
  created: Date
72
95
 
73
- @Column({ type: 'date', nullable: true })
96
+ @Column({
97
+ type: 'date',
98
+ nullable: true,
99
+ comment: 'Cuándo expira el plan de la empresa.',
100
+ })
74
101
  expiration: Date
75
102
 
76
- @Column({ type: 'datetime' })
103
+ @Column({
104
+ type: 'datetime',
105
+ comment: 'Fecha de actualización de la empresa.',
106
+ })
77
107
  updated: Date
78
108
 
79
- @Column({ default: 1 })
109
+ @Column({
110
+ default: 1,
111
+ comment:
112
+ 'Estado de la empresa, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
113
+ })
80
114
  status: number
81
115
 
82
- @ManyToMany(() => TypeFood)
116
+ @ManyToMany(() => TypeFood, { onDelete: 'CASCADE', onUpdate: 'NO ACTION' })
83
117
  @JoinTable({
84
118
  name: 'type_food_company',
85
119
  })