test-entity-library-asm 2.9.8 → 3.0.0
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 +12 -2
- package/dist/entities/Category.js +63 -7
- package/dist/entities/CategoryDate.d.ts +8 -0
- package/dist/entities/CategoryDate.js +54 -0
- package/dist/entities/CategorySchedule.d.ts +2 -2
- package/dist/entities/CategorySchedule.js +15 -9
- package/dist/entities/Day.d.ts +3 -0
- package/dist/entities/Day.js +12 -3
- package/dist/entities/Local.d.ts +0 -2
- package/dist/entities/Local.js +0 -5
- package/dist/entities/Partner.d.ts +5 -1
- package/dist/entities/Partner.js +16 -0
- package/dist/entities/Product.d.ts +13 -7
- package/dist/entities/Product.js +66 -27
- package/dist/entities/ProductDate.d.ts +8 -0
- package/dist/entities/ProductDate.js +54 -0
- package/dist/entities/ProductSchedule.d.ts +9 -0
- package/dist/entities/ProductSchedule.js +56 -0
- package/dist/entities.views.routes.d.ts +3 -0
- package/dist/entities.views.routes.js +8 -2
- package/package.json +1 -1
- package/src/entities/Category.ts +67 -15
- package/src/entities/CategoryDate.ts +37 -0
- package/src/entities/CategorySchedule.ts +24 -18
- package/src/entities/Day.ts +14 -7
- package/src/entities/Local.ts +1 -4
- package/src/entities/Partner.ts +13 -1
- package/src/entities/Product.ts +86 -48
- package/src/entities/ProductDate.ts +38 -0
- package/src/entities/ProductSchedule.ts +39 -0
- package/src/entities.views.routes.ts +3 -0
|
@@ -0,0 +1,56 @@
|
|
|
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.ProductSchedule = void 0;
|
|
13
|
+
var typeorm_1 = require("typeorm");
|
|
14
|
+
var __1 = require("..");
|
|
15
|
+
var Day_1 = require("./Day");
|
|
16
|
+
var ProductSchedule = /** @class */ (function () {
|
|
17
|
+
function ProductSchedule() {
|
|
18
|
+
}
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
21
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
22
|
+
}),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], ProductSchedule.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.ManyToOne)(function () { return __1.Product; }, function (product) { return product.product_schedules; }, {
|
|
27
|
+
onDelete: "CASCADE",
|
|
28
|
+
onUpdate: "NO ACTION",
|
|
29
|
+
}),
|
|
30
|
+
(0, typeorm_1.JoinColumn)({ name: "product" }),
|
|
31
|
+
__metadata("design:type", __1.Product)
|
|
32
|
+
], ProductSchedule.prototype, "product", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.ManyToOne)(function () { return Day_1.Day; }, function (day) { return day.product_schedules_day; }, {
|
|
35
|
+
onDelete: "RESTRICT",
|
|
36
|
+
onUpdate: "NO ACTION",
|
|
37
|
+
}),
|
|
38
|
+
(0, typeorm_1.JoinColumn)({ name: "day" }),
|
|
39
|
+
__metadata("design:type", Day_1.Day)
|
|
40
|
+
], ProductSchedule.prototype, "day", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ comment: "Hora de inicio." }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], ProductSchedule.prototype, "start_time", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ comment: "Hora de finalización." }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], ProductSchedule.prototype, "end_time", void 0);
|
|
49
|
+
ProductSchedule = __decorate([
|
|
50
|
+
(0, typeorm_1.Entity)("product_schedule", {
|
|
51
|
+
comment: "Horarios en que se puede ver una producto.",
|
|
52
|
+
})
|
|
53
|
+
], ProductSchedule);
|
|
54
|
+
return ProductSchedule;
|
|
55
|
+
}());
|
|
56
|
+
exports.ProductSchedule = ProductSchedule;
|
|
@@ -47,6 +47,9 @@ export { PartnerPermissionSection } from "./entities/PartnerPermissionSection";
|
|
|
47
47
|
export { PartnerPlatform } from "./entities/PartnerPlatform";
|
|
48
48
|
export { ServicePlan } from "./entities/ServicePlan";
|
|
49
49
|
export { Bank } from "./entities/Bank";
|
|
50
|
+
export { CategoryDate } from "./entities/CategoryDate";
|
|
51
|
+
export { ProductSchedule } from "./entities/ProductSchedule";
|
|
52
|
+
export { ProductDate } from "./entities/ProductDate";
|
|
50
53
|
export { LocalsCompany } from "./views/LocalsCompany";
|
|
51
54
|
export { VerifyLocals } from "./views/VerifyLocals";
|
|
52
55
|
export { MasterNotifications } from "./views/MasterNotifications";
|
|
@@ -14,8 +14,8 @@ 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.
|
|
18
|
-
exports.CustomRepository = exports.PartnerNotifications = exports.DiscountsCodeUser = exports.Partners = exports.ViewLocalsCompanies = exports.MasterNotifications = exports.VerifyLocals = void 0;
|
|
17
|
+
exports.CategoryDate = exports.Bank = exports.ServicePlan = exports.PartnerPlatform = exports.PartnerPermissionSection = exports.LocalPlan = 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
|
+
exports.CustomRepository = exports.PartnerNotifications = exports.DiscountsCodeUser = exports.Partners = exports.ViewLocalsCompanies = exports.MasterNotifications = exports.VerifyLocals = exports.LocalsCompany = exports.ProductDate = exports.ProductSchedule = void 0;
|
|
19
19
|
var BusinessTypeProduct_1 = require("./entities/BusinessTypeProduct");
|
|
20
20
|
Object.defineProperty(exports, "BusinessTypeProduct", { enumerable: true, get: function () { return BusinessTypeProduct_1.BusinessTypeProduct; } });
|
|
21
21
|
var Category_1 = require("./entities/Category");
|
|
@@ -114,6 +114,12 @@ var ServicePlan_1 = require("./entities/ServicePlan");
|
|
|
114
114
|
Object.defineProperty(exports, "ServicePlan", { enumerable: true, get: function () { return ServicePlan_1.ServicePlan; } });
|
|
115
115
|
var Bank_1 = require("./entities/Bank");
|
|
116
116
|
Object.defineProperty(exports, "Bank", { enumerable: true, get: function () { return Bank_1.Bank; } });
|
|
117
|
+
var CategoryDate_1 = require("./entities/CategoryDate");
|
|
118
|
+
Object.defineProperty(exports, "CategoryDate", { enumerable: true, get: function () { return CategoryDate_1.CategoryDate; } });
|
|
119
|
+
var ProductSchedule_1 = require("./entities/ProductSchedule");
|
|
120
|
+
Object.defineProperty(exports, "ProductSchedule", { enumerable: true, get: function () { return ProductSchedule_1.ProductSchedule; } });
|
|
121
|
+
var ProductDate_1 = require("./entities/ProductDate");
|
|
122
|
+
Object.defineProperty(exports, "ProductDate", { enumerable: true, get: function () { return ProductDate_1.ProductDate; } });
|
|
117
123
|
var LocalsCompany_1 = require("./views/LocalsCompany");
|
|
118
124
|
Object.defineProperty(exports, "LocalsCompany", { enumerable: true, get: function () { return LocalsCompany_1.LocalsCompany; } });
|
|
119
125
|
var VerifyLocals_1 = require("./views/VerifyLocals");
|
package/package.json
CHANGED
package/src/entities/Category.ts
CHANGED
|
@@ -5,33 +5,85 @@ import {
|
|
|
5
5
|
ManyToOne,
|
|
6
6
|
OneToMany,
|
|
7
7
|
PrimaryGeneratedColumn,
|
|
8
|
-
} from
|
|
9
|
-
import { Local } from
|
|
10
|
-
import { Product } from
|
|
8
|
+
} from "typeorm";
|
|
9
|
+
import { Local } from "./Local";
|
|
10
|
+
import { Product } from "./Product";
|
|
11
|
+
import { CategoryDate, Partner, ScheduleCategory } from "..";
|
|
11
12
|
|
|
12
13
|
@Entity({
|
|
13
14
|
comment:
|
|
14
|
-
|
|
15
|
+
"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.",
|
|
15
16
|
})
|
|
16
17
|
export class Category {
|
|
17
18
|
@PrimaryGeneratedColumn({
|
|
18
|
-
comment:
|
|
19
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
19
20
|
})
|
|
20
|
-
id: number
|
|
21
|
+
id: number;
|
|
21
22
|
|
|
22
23
|
@ManyToOne(() => Local, (local) => local.categories, {
|
|
23
|
-
onDelete:
|
|
24
|
-
onUpdate:
|
|
24
|
+
onDelete: "CASCADE",
|
|
25
|
+
onUpdate: "NO ACTION",
|
|
25
26
|
})
|
|
26
|
-
@JoinColumn({ name:
|
|
27
|
-
local: Local
|
|
27
|
+
@JoinColumn({ name: "local" })
|
|
28
|
+
local: Local;
|
|
28
29
|
|
|
29
|
-
@Column({ length: 30, comment:
|
|
30
|
-
name: string
|
|
30
|
+
@Column({ length: 30, comment: "Nombre de la categoría." })
|
|
31
|
+
name: string;
|
|
31
32
|
|
|
32
|
-
@Column({ comment:
|
|
33
|
-
position: number
|
|
33
|
+
@Column({ comment: "¿En qué posición se va a mostrar esta categoría?" })
|
|
34
|
+
position: number;
|
|
35
|
+
|
|
36
|
+
@Column({
|
|
37
|
+
nullable: true,
|
|
38
|
+
comment:
|
|
39
|
+
"Campo para saber el tipo de horario que se va a mostrar en la aplicación:\n 1. Días. \n2. Fecha específica.",
|
|
40
|
+
default: null,
|
|
41
|
+
})
|
|
42
|
+
type_sales_hours: number;
|
|
43
|
+
|
|
44
|
+
@ManyToOne(() => Partner, (partner) => partner.partners_category_created_by, {
|
|
45
|
+
onDelete: "RESTRICT",
|
|
46
|
+
onUpdate: "NO ACTION",
|
|
47
|
+
})
|
|
48
|
+
@JoinColumn({ name: "created_by" })
|
|
49
|
+
created_by: Partner;
|
|
50
|
+
|
|
51
|
+
@Column({ type: "datetime", comment: "Fecha de creación del registro." })
|
|
52
|
+
created: Date;
|
|
53
|
+
|
|
54
|
+
@Column({ type: "datetime", comment: "Fecha de actualización del registro." })
|
|
55
|
+
updated: Date;
|
|
56
|
+
|
|
57
|
+
@ManyToOne(() => Partner, (partner) => partner.partners_category_update_by, {
|
|
58
|
+
onDelete: "RESTRICT",
|
|
59
|
+
onUpdate: "NO ACTION",
|
|
60
|
+
})
|
|
61
|
+
@JoinColumn({ name: "updated_by" })
|
|
62
|
+
updated_by: Partner;
|
|
63
|
+
|
|
64
|
+
@Column({
|
|
65
|
+
default: 3,
|
|
66
|
+
comment:
|
|
67
|
+
"Estado en el que está el elemento: \n0. Inactivo. \n1. Activo. \n2. Rechazado. \n3. En revisión.",
|
|
68
|
+
})
|
|
69
|
+
status: number;
|
|
70
|
+
|
|
71
|
+
@Column({
|
|
72
|
+
nullable: true,
|
|
73
|
+
length: 600,
|
|
74
|
+
comment: "Comentario del revisor al rechazar una categoría (master).",
|
|
75
|
+
})
|
|
76
|
+
review_comment: string;
|
|
34
77
|
|
|
35
78
|
@OneToMany(() => Product, (product) => product.category)
|
|
36
|
-
products: Product[]
|
|
79
|
+
products: Product[];
|
|
80
|
+
|
|
81
|
+
@OneToMany(
|
|
82
|
+
() => ScheduleCategory,
|
|
83
|
+
(scheduleCategory) => scheduleCategory.category
|
|
84
|
+
)
|
|
85
|
+
category_schedules: ScheduleCategory[];
|
|
86
|
+
|
|
87
|
+
@OneToMany(() => CategoryDate, (categoryDate) => categoryDate.category)
|
|
88
|
+
category_dates: CategoryDate[];
|
|
37
89
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Entity,
|
|
4
|
+
JoinColumn,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
PrimaryGeneratedColumn,
|
|
7
|
+
} from "typeorm";
|
|
8
|
+
import { Category } from "./Category";
|
|
9
|
+
|
|
10
|
+
@Entity("category_date", {
|
|
11
|
+
comment: "Fechas específicas donde se pueden agregar horarios.",
|
|
12
|
+
})
|
|
13
|
+
export class CategoryDate {
|
|
14
|
+
@PrimaryGeneratedColumn({
|
|
15
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
16
|
+
})
|
|
17
|
+
id: number;
|
|
18
|
+
|
|
19
|
+
@ManyToOne(() => Category, (category) => category.category_dates, {
|
|
20
|
+
onDelete: "CASCADE",
|
|
21
|
+
onUpdate: "NO ACTION",
|
|
22
|
+
})
|
|
23
|
+
@JoinColumn({ name: "category" })
|
|
24
|
+
category: Category;
|
|
25
|
+
|
|
26
|
+
@Column({
|
|
27
|
+
type: "date",
|
|
28
|
+
comment: "Fecha en la que va a estar disponible la categoría.",
|
|
29
|
+
})
|
|
30
|
+
date: Date;
|
|
31
|
+
|
|
32
|
+
@Column({ comment: "Hora de inicio." })
|
|
33
|
+
start_time: string;
|
|
34
|
+
|
|
35
|
+
@Column({ comment: "Hora de finalización." })
|
|
36
|
+
end_time: string;
|
|
37
|
+
}
|
|
@@ -3,32 +3,38 @@ import {
|
|
|
3
3
|
Entity,
|
|
4
4
|
JoinColumn,
|
|
5
5
|
ManyToOne,
|
|
6
|
-
PrimaryGeneratedColumn
|
|
7
|
-
} from
|
|
8
|
-
import { Category } from
|
|
9
|
-
import { Day } from
|
|
6
|
+
PrimaryGeneratedColumn,
|
|
7
|
+
} from "typeorm";
|
|
8
|
+
import { Category } from "./Category";
|
|
9
|
+
import { Day } from "./Day";
|
|
10
10
|
|
|
11
|
-
@Entity(
|
|
11
|
+
@Entity("category_schedule", {
|
|
12
12
|
comment:
|
|
13
|
-
|
|
13
|
+
"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.",
|
|
14
14
|
})
|
|
15
15
|
export class ScheduleCategory {
|
|
16
16
|
@PrimaryGeneratedColumn({
|
|
17
|
-
comment:
|
|
17
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
18
18
|
})
|
|
19
|
-
id: number
|
|
19
|
+
id: number;
|
|
20
20
|
|
|
21
|
-
@ManyToOne(() => Category,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
@ManyToOne(() => Category, (category) => category.category_schedules, {
|
|
22
|
+
onDelete: "CASCADE",
|
|
23
|
+
onUpdate: "NO ACTION",
|
|
24
|
+
})
|
|
25
|
+
@JoinColumn({ name: "category" })
|
|
26
|
+
category: Category;
|
|
24
27
|
|
|
25
|
-
@ManyToOne(() => Day,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
@ManyToOne(() => Day, (day) => day.category_schedules_day, {
|
|
29
|
+
onDelete: "RESTRICT",
|
|
30
|
+
onUpdate: "NO ACTION",
|
|
31
|
+
})
|
|
32
|
+
@JoinColumn({ name: "day" })
|
|
33
|
+
day: Day;
|
|
28
34
|
|
|
29
|
-
@Column({ comment:
|
|
30
|
-
start_time: string
|
|
35
|
+
@Column({ comment: "Hora de inicio." })
|
|
36
|
+
start_time: string;
|
|
31
37
|
|
|
32
|
-
@Column({ comment:
|
|
33
|
-
end_time: string
|
|
38
|
+
@Column({ comment: "Hora de finalización." })
|
|
39
|
+
end_time: string;
|
|
34
40
|
}
|
package/src/entities/Day.ts
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from
|
|
1
|
+
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
|
2
|
+
import { CategoryDate, ProductSchedule, ScheduleCategory } from "..";
|
|
2
3
|
|
|
3
|
-
@Entity({ comment:
|
|
4
|
+
@Entity({ comment: "Días de la semana." })
|
|
4
5
|
export class Day {
|
|
5
6
|
@PrimaryGeneratedColumn({
|
|
6
|
-
comment:
|
|
7
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
7
8
|
})
|
|
8
|
-
id: number
|
|
9
|
+
id: number;
|
|
9
10
|
|
|
10
11
|
@Column({
|
|
11
12
|
length: 50,
|
|
12
13
|
comment:
|
|
13
14
|
'Nombre del día.\r\n\r\nID/KEY de la variable que se encuentra en los archivos "locale" para el multilenguaje.',
|
|
14
15
|
})
|
|
15
|
-
name: string
|
|
16
|
+
name: string;
|
|
16
17
|
|
|
17
18
|
@Column({
|
|
18
19
|
default: 1,
|
|
19
20
|
comment:
|
|
20
|
-
|
|
21
|
+
"Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.",
|
|
21
22
|
})
|
|
22
|
-
status: number
|
|
23
|
+
status: number;
|
|
24
|
+
|
|
25
|
+
@OneToMany(() => ScheduleCategory, (scheduleCategory) => scheduleCategory.day)
|
|
26
|
+
category_schedules_day: ScheduleCategory[];
|
|
27
|
+
|
|
28
|
+
@OneToMany(() => ProductSchedule, (productSchedule) => productSchedule.day)
|
|
29
|
+
product_schedules_day: ProductSchedule[];
|
|
23
30
|
}
|
package/src/entities/Local.ts
CHANGED
|
@@ -127,10 +127,7 @@ export class Local {
|
|
|
127
127
|
},
|
|
128
128
|
})
|
|
129
129
|
locals_partners: Partner[]
|
|
130
|
-
|
|
131
|
-
@OneToMany(() => Product, (product) => product.local)
|
|
132
|
-
products: Product[]
|
|
133
|
-
|
|
130
|
+
|
|
134
131
|
@OneToMany(() => Category, (category) => category.local)
|
|
135
132
|
categories: Category[]
|
|
136
133
|
|
package/src/entities/Partner.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { Terminal } from "./Terminal";
|
|
|
19
19
|
import { TerminalSession } from "./TerminalSession";
|
|
20
20
|
import { DateTransformer } from "../transformers/dateTransformer";
|
|
21
21
|
import { PartnerNotification } from "./PartnerNotification";
|
|
22
|
-
import { MasterNotification, VerifyLocal } from "..";
|
|
22
|
+
import { Category, MasterNotification, Product, VerifyLocal } from "..";
|
|
23
23
|
|
|
24
24
|
@Entity({
|
|
25
25
|
comment:
|
|
@@ -217,4 +217,16 @@ export class Partner {
|
|
|
217
217
|
(master_notification) => master_notification.master
|
|
218
218
|
)
|
|
219
219
|
partner_notifications: MasterNotification[];
|
|
220
|
+
|
|
221
|
+
@OneToMany(() => Product, (product) => product.updated_by)
|
|
222
|
+
partners_update_by: Product[];
|
|
223
|
+
|
|
224
|
+
@OneToMany(() => Product, (product) => product.created_by)
|
|
225
|
+
partners_created_by: Product[];
|
|
226
|
+
|
|
227
|
+
@OneToMany(() => Category, (category) => category.updated_by)
|
|
228
|
+
partners_category_update_by: Category[];
|
|
229
|
+
|
|
230
|
+
@OneToMany(() => Category, (category) => category.created_by)
|
|
231
|
+
partners_category_created_by: Category[];
|
|
220
232
|
}
|
package/src/entities/Product.ts
CHANGED
|
@@ -7,102 +7,140 @@ import {
|
|
|
7
7
|
ManyToOne,
|
|
8
8
|
OneToMany,
|
|
9
9
|
PrimaryGeneratedColumn,
|
|
10
|
-
} from
|
|
11
|
-
import { Category } from
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
10
|
+
} from "typeorm";
|
|
11
|
+
import { Category } from "./Category";
|
|
12
|
+
import { ProductGroup } from "./ProductGroup";
|
|
13
|
+
import { ProductIngredient } from "./ProductIngredient";
|
|
14
|
+
import { RequestProduct } from "./RequestProduct";
|
|
15
|
+
import { User } from "./User";
|
|
16
|
+
import { Partner, ProductDate, ProductSchedule } from "..";
|
|
17
17
|
|
|
18
18
|
@Entity({
|
|
19
19
|
comment:
|
|
20
|
-
|
|
20
|
+
"Productos qué serán visibles a los usuarios, estos están asociados a un local.",
|
|
21
21
|
})
|
|
22
22
|
export class Product {
|
|
23
23
|
@PrimaryGeneratedColumn({
|
|
24
|
-
comment:
|
|
24
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
25
25
|
})
|
|
26
|
-
id: number
|
|
27
|
-
|
|
28
|
-
@ManyToOne(() => Local, (local) => local.products, {
|
|
29
|
-
onDelete: 'CASCADE',
|
|
30
|
-
onUpdate: 'NO ACTION',
|
|
31
|
-
})
|
|
32
|
-
@JoinColumn({ name: 'local' })
|
|
33
|
-
local: Local
|
|
26
|
+
id: number;
|
|
34
27
|
|
|
35
28
|
@ManyToOne(() => Category, (category) => category.products, {
|
|
36
|
-
onDelete:
|
|
37
|
-
onUpdate:
|
|
29
|
+
onDelete: "CASCADE",
|
|
30
|
+
onUpdate: "NO ACTION",
|
|
38
31
|
})
|
|
39
|
-
@JoinColumn({ name:
|
|
40
|
-
category: Category
|
|
32
|
+
@JoinColumn({ name: "category" })
|
|
33
|
+
category: Category;
|
|
41
34
|
|
|
42
|
-
@Column({ length: 50, comment:
|
|
43
|
-
name: string
|
|
35
|
+
@Column({ length: 50, comment: "Nombre del producto." })
|
|
36
|
+
name: string;
|
|
44
37
|
|
|
45
38
|
@Column({
|
|
46
39
|
length: 400,
|
|
47
|
-
comment:
|
|
40
|
+
comment: "Detalles del producto. \n\n ¿Qué contiene?",
|
|
48
41
|
})
|
|
49
|
-
details: string
|
|
42
|
+
details: string;
|
|
50
43
|
|
|
51
|
-
@Column({ length: 20, comment:
|
|
52
|
-
price: string
|
|
44
|
+
@Column({ length: 20, comment: "Precio del producto." })
|
|
45
|
+
price: string;
|
|
53
46
|
|
|
54
47
|
@Column({
|
|
55
48
|
default: 0,
|
|
56
49
|
comment:
|
|
57
|
-
|
|
50
|
+
"¿El producto cuenta con restricción de edad?\r\n1. Cuenta con restricción.\r\n0. No cuenta con restricción.",
|
|
58
51
|
})
|
|
59
|
-
age_restriction: number
|
|
52
|
+
age_restriction: number;
|
|
60
53
|
|
|
61
54
|
@Column({
|
|
62
55
|
default: 0,
|
|
63
|
-
comment:
|
|
56
|
+
comment: "¿El producto es un combo?\r\n1. Combo.\r\n0. No es un combo.",
|
|
64
57
|
})
|
|
65
|
-
combo: number
|
|
58
|
+
combo: number;
|
|
59
|
+
|
|
60
|
+
@Column({ comment: "En qué posición se va a mostrar el producto." })
|
|
61
|
+
position: number;
|
|
66
62
|
|
|
67
|
-
@Column({
|
|
68
|
-
|
|
63
|
+
@Column({
|
|
64
|
+
type: "text",
|
|
65
|
+
nullable: true,
|
|
66
|
+
comment: "Campo de tipo json para guardar el id y la url de la foto",
|
|
67
|
+
})
|
|
68
|
+
photo: string;
|
|
69
69
|
|
|
70
70
|
@Column({
|
|
71
|
-
type:
|
|
71
|
+
type: "mediumtext",
|
|
72
72
|
nullable: true,
|
|
73
|
-
comment:
|
|
73
|
+
comment:
|
|
74
|
+
"Campo de tipo JSON donde se guarda información necesaria para el registro.",
|
|
74
75
|
})
|
|
75
|
-
|
|
76
|
+
additional_information: string;
|
|
76
77
|
|
|
77
78
|
@Column({
|
|
78
|
-
type: 'mediumtext',
|
|
79
79
|
nullable: true,
|
|
80
80
|
comment:
|
|
81
|
-
|
|
81
|
+
"Campo para saber el tipo de horario que se va a mostrar en la aplicación:\n 1. Días. \n2. Fecha específica.",
|
|
82
|
+
default: null,
|
|
83
|
+
})
|
|
84
|
+
type_sales_hours: number;
|
|
85
|
+
|
|
86
|
+
@ManyToOne(() => Partner, (partner) => partner.partners_created_by, {
|
|
87
|
+
onDelete: "RESTRICT",
|
|
88
|
+
onUpdate: "NO ACTION",
|
|
82
89
|
})
|
|
83
|
-
|
|
90
|
+
@JoinColumn({ name: "created_by" })
|
|
91
|
+
created_by: Partner;
|
|
84
92
|
|
|
85
|
-
@Column({ type:
|
|
86
|
-
created: Date
|
|
93
|
+
@Column({ type: "datetime", comment: "Fecha de creación del registro." })
|
|
94
|
+
created: Date;
|
|
87
95
|
|
|
88
|
-
@Column({ type:
|
|
89
|
-
updated: Date
|
|
96
|
+
@Column({ type: "datetime", comment: "Fecha de actualización del registro." })
|
|
97
|
+
updated: Date;
|
|
98
|
+
|
|
99
|
+
@ManyToOne(() => Partner, (partner) => partner.partners_update_by, {
|
|
100
|
+
onDelete: "RESTRICT",
|
|
101
|
+
onUpdate: "NO ACTION",
|
|
102
|
+
})
|
|
103
|
+
@JoinColumn({ name: "updated_by" })
|
|
104
|
+
updated_by: Partner;
|
|
105
|
+
|
|
106
|
+
@Column({
|
|
107
|
+
default: 3,
|
|
108
|
+
comment:
|
|
109
|
+
"Estado en el que está el elemento: \n0. Inactivo. \n1. Activo. \n2. Rechazado. \n3. En revisión.",
|
|
110
|
+
})
|
|
111
|
+
status: number;
|
|
112
|
+
|
|
113
|
+
@Column({
|
|
114
|
+
nullable: true,
|
|
115
|
+
length: 600,
|
|
116
|
+
comment: "Comentario del revisor al rechazar un producto (master).",
|
|
117
|
+
})
|
|
118
|
+
review_comment: string;
|
|
90
119
|
|
|
91
120
|
@OneToMany(() => ProductGroup, (productGroup) => productGroup.product)
|
|
92
|
-
product_groups: ProductGroup[]
|
|
121
|
+
product_groups: ProductGroup[];
|
|
93
122
|
|
|
94
123
|
@OneToMany(
|
|
95
124
|
() => ProductIngredient,
|
|
96
125
|
(productIngredient) => productIngredient.product
|
|
97
126
|
)
|
|
98
|
-
product_ingredients: ProductIngredient[]
|
|
127
|
+
product_ingredients: ProductIngredient[];
|
|
99
128
|
|
|
100
129
|
@OneToMany(() => RequestProduct, (requestProduct) => requestProduct.product)
|
|
101
|
-
request_products: RequestProduct[]
|
|
130
|
+
request_products: RequestProduct[];
|
|
102
131
|
|
|
103
132
|
@ManyToMany(() => User)
|
|
104
133
|
@JoinTable({
|
|
105
|
-
name:
|
|
134
|
+
name: "user_favorite_product",
|
|
106
135
|
})
|
|
107
|
-
users_favorite_product: User[]
|
|
136
|
+
users_favorite_product: User[];
|
|
137
|
+
|
|
138
|
+
@OneToMany(
|
|
139
|
+
() => ProductSchedule,
|
|
140
|
+
(productSchedule) => productSchedule.product
|
|
141
|
+
)
|
|
142
|
+
product_schedules: ProductSchedule[];
|
|
143
|
+
|
|
144
|
+
@OneToMany(() => ProductDate, (productDate) => productDate.product)
|
|
145
|
+
product_dates: ProductDate[];
|
|
108
146
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Entity,
|
|
4
|
+
JoinColumn,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
PrimaryGeneratedColumn,
|
|
7
|
+
} from "typeorm";
|
|
8
|
+
import { Category } from "./Category";
|
|
9
|
+
import { Product } from "..";
|
|
10
|
+
|
|
11
|
+
@Entity("product_date", {
|
|
12
|
+
comment: "Fechas específicas donde se pueden agregar horarios",
|
|
13
|
+
})
|
|
14
|
+
export class ProductDate {
|
|
15
|
+
@PrimaryGeneratedColumn({
|
|
16
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
17
|
+
})
|
|
18
|
+
id: number;
|
|
19
|
+
|
|
20
|
+
@ManyToOne(() => Product, (product) => product.product_dates, {
|
|
21
|
+
onDelete: "CASCADE",
|
|
22
|
+
onUpdate: "NO ACTION",
|
|
23
|
+
})
|
|
24
|
+
@JoinColumn({ name: "product" })
|
|
25
|
+
product: Product;
|
|
26
|
+
|
|
27
|
+
@Column({
|
|
28
|
+
type: "date",
|
|
29
|
+
comment: "Fecha en la que va a estar disponible el producto.",
|
|
30
|
+
})
|
|
31
|
+
date: Date;
|
|
32
|
+
|
|
33
|
+
@Column({ comment: "Hora de inicio." })
|
|
34
|
+
start_time: string;
|
|
35
|
+
|
|
36
|
+
@Column({ comment: "Hora de finalización." })
|
|
37
|
+
end_time: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
Entity,
|
|
4
|
+
JoinColumn,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
PrimaryGeneratedColumn,
|
|
7
|
+
} from "typeorm";
|
|
8
|
+
import { Product } from "..";
|
|
9
|
+
import { Day } from "./Day";
|
|
10
|
+
|
|
11
|
+
@Entity("product_schedule", {
|
|
12
|
+
comment: "Horarios en que se puede ver una producto.",
|
|
13
|
+
})
|
|
14
|
+
export class ProductSchedule {
|
|
15
|
+
@PrimaryGeneratedColumn({
|
|
16
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
17
|
+
})
|
|
18
|
+
id: number;
|
|
19
|
+
|
|
20
|
+
@ManyToOne(() => Product, (product) => product.product_schedules, {
|
|
21
|
+
onDelete: "CASCADE",
|
|
22
|
+
onUpdate: "NO ACTION",
|
|
23
|
+
})
|
|
24
|
+
@JoinColumn({ name: "product" })
|
|
25
|
+
product: Product;
|
|
26
|
+
|
|
27
|
+
@ManyToOne(() => Day, (day) => day.product_schedules_day, {
|
|
28
|
+
onDelete: "RESTRICT",
|
|
29
|
+
onUpdate: "NO ACTION",
|
|
30
|
+
})
|
|
31
|
+
@JoinColumn({ name: "day" })
|
|
32
|
+
day: Day;
|
|
33
|
+
|
|
34
|
+
@Column({ comment: "Hora de inicio." })
|
|
35
|
+
start_time: string;
|
|
36
|
+
|
|
37
|
+
@Column({ comment: "Hora de finalización." })
|
|
38
|
+
end_time: string;
|
|
39
|
+
}
|