test-entity-library-asm 1.1.8 → 1.2.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 +5 -3
- package/dist/entities/Category.js +38 -13
- package/dist/entities/CategorySchedule.d.ts +10 -0
- package/dist/entities/CategorySchedule.js +67 -0
- package/dist/entities/City.d.ts +3 -2
- package/dist/entities/City.js +35 -10
- package/dist/entities/CodeRedemptionHistoryCompany.d.ts +4 -3
- package/dist/entities/CodeRedemptionHistoryCompany.js +31 -10
- package/dist/entities/CodeRedemptionHistoryUser.js +13 -6
- package/dist/entities/Company.d.ts +2 -1
- package/dist/entities/Company.js +64 -26
- package/dist/entities/Configuration.d.ts +2 -1
- package/dist/entities/Configuration.js +26 -4
- package/dist/entities/Country.d.ts +2 -1
- package/dist/entities/Country.js +33 -11
- package/dist/entities/Day.d.ts +2 -1
- package/dist/entities/Day.js +31 -6
- package/dist/entities/DiscountCodeCompany.d.ts +2 -1
- package/dist/entities/DiscountCodeCompany.js +42 -12
- package/dist/entities/DiscountCodeUser.js +24 -13
- package/dist/entities/Local.d.ts +14 -2
- package/dist/entities/Local.js +73 -13
- package/dist/entities/LocalQualification.d.ts +10 -0
- package/dist/entities/LocalQualification.js +76 -0
- package/dist/entities/Master.d.ts +2 -1
- package/dist/entities/Master.js +26 -4
- package/dist/entities/PaymentMethod.d.ts +13 -0
- package/dist/entities/PaymentMethod.js +102 -0
- package/dist/entities/Permission.d.ts +2 -1
- package/dist/entities/Permission.js +32 -8
- package/dist/entities/Plan.d.ts +2 -1
- package/dist/entities/Plan.js +38 -10
- package/dist/entities/Product.d.ts +8 -1
- package/dist/entities/Product.js +62 -12
- package/dist/entities/ProductGroup.js +16 -8
- package/dist/entities/ProductIngredient.d.ts +12 -0
- package/dist/entities/ProductIngredient.js +84 -0
- package/dist/entities/ProductTopping.d.ts +2 -1
- package/dist/entities/ProductTopping.js +33 -7
- package/dist/entities/Region.d.ts +3 -2
- package/dist/entities/Region.js +40 -10
- package/dist/entities/Request.d.ts +21 -0
- package/dist/entities/Request.js +137 -0
- package/dist/entities/RequestProduct.d.ts +12 -0
- package/dist/entities/RequestProduct.js +85 -0
- package/dist/entities/RequestProductGroupComplement.d.ts +11 -0
- package/dist/entities/RequestProductGroupComplement.js +80 -0
- package/dist/entities/RequestStatus.d.ts +11 -0
- package/dist/entities/RequestStatus.js +85 -0
- package/dist/entities/Role.js +11 -4
- package/dist/entities/RoleVisibleTo.d.ts +2 -1
- package/dist/entities/RoleVisibleTo.js +30 -5
- package/dist/entities/Square.d.ts +13 -0
- package/dist/entities/Square.js +97 -0
- package/dist/entities/Terminal.d.ts +2 -0
- package/dist/entities/Terminal.js +21 -4
- package/dist/entities/TerminalSession.d.ts +3 -2
- package/dist/entities/TerminalSession.js +41 -8
- package/dist/entities/TypeFood.d.ts +2 -1
- package/dist/entities/TypeFood.js +41 -6
- package/dist/entities/TypeMeasureIngredient.d.ts +9 -0
- package/dist/entities/TypeMeasureIngredient.js +73 -0
- package/dist/entities/User.d.ts +17 -7
- package/dist/entities/User.js +104 -25
- package/dist/entities/productGroupComplement.d.ts +4 -1
- package/dist/entities/productGroupComplement.js +35 -8
- package/package.json +1 -1
- package/src/entities/Category.ts +33 -15
- package/src/entities/CategorySchedule.ts +35 -0
- package/src/entities/City.ts +18 -8
- package/src/entities/CodeRedemptionHistoryCompany.ts +17 -9
- package/src/entities/CodeRedemptionHistoryUser.ts +15 -6
- package/src/entities/Company.ts +51 -25
- package/src/entities/Configuration.ts +10 -4
- package/src/entities/Country.ts +23 -11
- package/src/entities/Day.ts +16 -6
- package/src/entities/DiscountCodeCompany.ts +26 -11
- package/src/entities/DiscountCodeUser.ts +25 -12
- package/src/entities/Local.ts +54 -12
- package/src/entities/LocalQualification.ts +45 -0
- package/src/entities/Master.ts +17 -4
- package/src/entities/PaymentMethod.ts +72 -0
- package/src/entities/Permission.ts +16 -7
- package/src/entities/Plan.ts +22 -9
- package/src/entities/Product.ts +47 -11
- package/src/entities/ProductGroup.ts +18 -8
- package/src/entities/ProductIngredient.ts +55 -0
- package/src/entities/ProductTopping.ts +17 -6
- package/src/entities/Region.ts +24 -8
- package/src/entities/Request.ts +107 -0
- package/src/entities/RequestProduct.ts +51 -0
- package/src/entities/RequestProductGroupComplement.ts +55 -0
- package/src/entities/RequestStatus.ts +55 -0
- package/src/entities/Role.ts +12 -4
- package/src/entities/RoleVisibleTo.ts +13 -4
- package/src/entities/Square.ts +56 -0
- package/src/entities/Terminal.ts +24 -4
- package/src/entities/TerminalSession.ts +28 -10
- package/src/entities/TypeFood.ts +26 -5
- package/src/entities/TypeMeasureIngredient.ts +46 -0
- package/src/entities/User.ts +93 -28
- package/src/entities/productGroupComplement.ts +23 -7
- package/src/entities/ScheduleCategory.ts +0 -32
|
@@ -4,32 +4,41 @@ import {
|
|
|
4
4
|
PrimaryGeneratedColumn,
|
|
5
5
|
ManyToMany,
|
|
6
6
|
JoinTable,
|
|
7
|
+
BaseEntity,
|
|
7
8
|
} from 'typeorm'
|
|
8
9
|
import { Role } from './Role'
|
|
9
10
|
|
|
10
|
-
@Entity(
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
@Entity('permission', {
|
|
12
|
+
comment: 'Permisos que va a tener cada rol.',
|
|
13
|
+
})
|
|
14
|
+
export class Permission extends BaseEntity {
|
|
15
|
+
@PrimaryGeneratedColumn({
|
|
16
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
17
|
+
})
|
|
13
18
|
id: number
|
|
14
19
|
|
|
15
|
-
@Column({ length: 10, unique: true })
|
|
20
|
+
@Column({ length: 10, unique: true, comment: 'Código del permiso.' })
|
|
16
21
|
code: string
|
|
17
22
|
|
|
18
23
|
@Column({
|
|
19
24
|
length: 40,
|
|
20
25
|
comment:
|
|
21
|
-
'Id de la variable que se encuentra en los archivos
|
|
26
|
+
'Id de la variable que se encuentra en los archivos `locale` para el multilenguaje.',
|
|
22
27
|
})
|
|
23
28
|
name: string
|
|
24
29
|
|
|
25
30
|
@Column({
|
|
26
31
|
length: 40,
|
|
27
32
|
comment:
|
|
28
|
-
'Id de la variable que se encuentra en los archivos
|
|
33
|
+
'Id de la variable que se encuentra en los archivos `locale` para el multilenguaje.',
|
|
29
34
|
})
|
|
30
35
|
description: string
|
|
31
36
|
|
|
32
|
-
@Column({
|
|
37
|
+
@Column({
|
|
38
|
+
default: 1,
|
|
39
|
+
comment:
|
|
40
|
+
'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
|
|
41
|
+
})
|
|
33
42
|
status: number
|
|
34
43
|
|
|
35
44
|
@ManyToMany(() => Role)
|
package/src/entities/Plan.ts
CHANGED
|
@@ -5,22 +5,27 @@ import {
|
|
|
5
5
|
ManyToOne,
|
|
6
6
|
JoinColumn,
|
|
7
7
|
OneToMany,
|
|
8
|
+
BaseEntity,
|
|
8
9
|
} from 'typeorm'
|
|
9
10
|
import { User } from './User'
|
|
10
11
|
import { Company } from './Company'
|
|
11
12
|
|
|
12
|
-
@Entity(
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
@Entity({
|
|
14
|
+
comment: 'Planes que tendrá la plataforma para las empresas (company)',
|
|
15
|
+
})
|
|
16
|
+
export class Plan extends BaseEntity {
|
|
17
|
+
@PrimaryGeneratedColumn({
|
|
18
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
19
|
+
})
|
|
15
20
|
id: number
|
|
16
21
|
|
|
17
|
-
@Column({ length: 20, unique: true })
|
|
22
|
+
@Column({ length: 20, unique: true, comment: 'Código del plan.' })
|
|
18
23
|
code: string
|
|
19
24
|
|
|
20
25
|
@Column({
|
|
21
26
|
length: 50,
|
|
22
27
|
comment:
|
|
23
|
-
'Id de la variable que se encuentra en los archivos
|
|
28
|
+
'Id de la variable que se encuentra en los archivos `locale` para el multilenguaje.',
|
|
24
29
|
})
|
|
25
30
|
name: string
|
|
26
31
|
|
|
@@ -39,17 +44,25 @@ export class Plan {
|
|
|
39
44
|
})
|
|
40
45
|
customized: number
|
|
41
46
|
|
|
42
|
-
@Column({ type: 'datetime' })
|
|
47
|
+
@Column({ type: 'datetime', comment: 'Fecha de creación del registro.' })
|
|
43
48
|
created: Date
|
|
44
49
|
|
|
45
|
-
@Column({ type: 'date' })
|
|
50
|
+
@Column({ type: 'date', comment: 'Fecha de expiración del registro.' })
|
|
46
51
|
expiration: Date
|
|
47
52
|
|
|
48
|
-
@ManyToOne(() => User, (user) => user.plans, {
|
|
53
|
+
@ManyToOne(() => User, (user) => user.plans, {
|
|
54
|
+
nullable: true,
|
|
55
|
+
onDelete: 'RESTRICT',
|
|
56
|
+
onUpdate: 'NO ACTION',
|
|
57
|
+
})
|
|
49
58
|
@JoinColumn({ name: 'created_by' })
|
|
50
59
|
created_by: User
|
|
51
60
|
|
|
52
|
-
@Column({
|
|
61
|
+
@Column({
|
|
62
|
+
default: 1,
|
|
63
|
+
comment:
|
|
64
|
+
'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
|
|
65
|
+
})
|
|
53
66
|
status: number
|
|
54
67
|
|
|
55
68
|
@OneToMany(() => Company, (company) => company.plan)
|
package/src/entities/Product.ts
CHANGED
|
@@ -5,26 +5,48 @@ import {
|
|
|
5
5
|
ManyToOne,
|
|
6
6
|
JoinColumn,
|
|
7
7
|
OneToMany,
|
|
8
|
+
BaseEntity,
|
|
8
9
|
} from 'typeorm'
|
|
9
10
|
import { Local } from './Local'
|
|
10
11
|
import { ProductGroup } from './ProductGroup'
|
|
12
|
+
import { Category } from './Category'
|
|
13
|
+
import { ProductIngredient } from './ProductIngredient'
|
|
14
|
+
import { RequestProduct } from './RequestProduct'
|
|
11
15
|
|
|
12
|
-
@Entity(
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
@Entity({
|
|
17
|
+
comment:
|
|
18
|
+
'Productos qué serán visibles a los usuarios, estos están asociados a un local.',
|
|
19
|
+
})
|
|
20
|
+
export class Product extends BaseEntity {
|
|
21
|
+
@PrimaryGeneratedColumn({
|
|
22
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
23
|
+
})
|
|
15
24
|
id: number
|
|
16
25
|
|
|
17
|
-
@ManyToOne(() => Local, (local) => local.products
|
|
26
|
+
@ManyToOne(() => Local, (local) => local.products, {
|
|
27
|
+
onDelete: 'CASCADE',
|
|
28
|
+
onUpdate: 'NO ACTION',
|
|
29
|
+
})
|
|
18
30
|
@JoinColumn({ name: 'local' })
|
|
19
31
|
local: Local
|
|
20
32
|
|
|
21
|
-
@
|
|
33
|
+
@ManyToOne(() => Category, (category) => category.products, {
|
|
34
|
+
onDelete: 'CASCADE',
|
|
35
|
+
onUpdate: 'NO ACTION',
|
|
36
|
+
})
|
|
37
|
+
@JoinColumn({ name: 'category' })
|
|
38
|
+
category: Category
|
|
39
|
+
|
|
40
|
+
@Column({ length: 50, comment: 'Nombre del producto.' })
|
|
22
41
|
name: string
|
|
23
42
|
|
|
24
|
-
@Column({
|
|
43
|
+
@Column({
|
|
44
|
+
length: 400,
|
|
45
|
+
comment: 'Detalles del producto. \n\n ¿Qué contiene?',
|
|
46
|
+
})
|
|
25
47
|
details: string
|
|
26
48
|
|
|
27
|
-
@Column({ length: 20 })
|
|
49
|
+
@Column({ length: 20, comment: 'Precio del producto.' })
|
|
28
50
|
price: string
|
|
29
51
|
|
|
30
52
|
@Column({
|
|
@@ -40,7 +62,7 @@ export class Product {
|
|
|
40
62
|
})
|
|
41
63
|
combo: number
|
|
42
64
|
|
|
43
|
-
@Column()
|
|
65
|
+
@Column({ comment: 'En qué posición se va a mostrar el producto.' })
|
|
44
66
|
position: number
|
|
45
67
|
|
|
46
68
|
@Column({
|
|
@@ -50,15 +72,29 @@ export class Product {
|
|
|
50
72
|
})
|
|
51
73
|
photo: string
|
|
52
74
|
|
|
53
|
-
@Column({
|
|
75
|
+
@Column({
|
|
76
|
+
type: 'mediumtext',
|
|
77
|
+
nullable: true,
|
|
78
|
+
comment:
|
|
79
|
+
'Campo de tipo JSON donde se guarda información necesaria para el registro.',
|
|
80
|
+
})
|
|
54
81
|
additional_information: string
|
|
55
82
|
|
|
56
|
-
@Column({ type: 'datetime' })
|
|
83
|
+
@Column({ type: 'datetime', comment: 'Fecha de creación del registro.' })
|
|
57
84
|
created: Date
|
|
58
85
|
|
|
59
|
-
@Column({ type: 'datetime' })
|
|
86
|
+
@Column({ type: 'datetime', comment: 'Fecha de actualización del registro.' })
|
|
60
87
|
updated: Date
|
|
61
88
|
|
|
62
89
|
@OneToMany(() => ProductGroup, (productGroup) => productGroup.product)
|
|
63
90
|
product_groups: ProductGroup[]
|
|
91
|
+
|
|
92
|
+
@OneToMany(
|
|
93
|
+
() => ProductIngredient,
|
|
94
|
+
(productIngredient) => productIngredient.product
|
|
95
|
+
)
|
|
96
|
+
product_ingredients: ProductIngredient[]
|
|
97
|
+
|
|
98
|
+
@OneToMany(() => RequestProduct, (requestProduct) => requestProduct.product)
|
|
99
|
+
request_products: RequestProduct[]
|
|
64
100
|
}
|
|
@@ -11,37 +11,47 @@ import { ProductTopping } from './ProductTopping'
|
|
|
11
11
|
import { ProductGroupComplement } from './productGroupComplement'
|
|
12
12
|
|
|
13
13
|
@Entity('product_group', {
|
|
14
|
-
comment:
|
|
14
|
+
comment:
|
|
15
|
+
'Grupos para agregar al topping por producto.\r\n\r\nEstos elementos que se agreguen acá estarán visibles para los usuarios en la APP.',
|
|
15
16
|
})
|
|
16
17
|
export class ProductGroup {
|
|
17
|
-
@PrimaryGeneratedColumn(
|
|
18
|
+
@PrimaryGeneratedColumn({
|
|
19
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
20
|
+
})
|
|
18
21
|
id: number
|
|
19
22
|
|
|
20
|
-
@ManyToOne(() => Product, (product) => product.product_groups
|
|
23
|
+
@ManyToOne(() => Product, (product) => product.product_groups, {
|
|
24
|
+
onDelete: 'CASCADE',
|
|
25
|
+
onUpdate: 'NO ACTION',
|
|
26
|
+
})
|
|
21
27
|
@JoinColumn({ name: 'product' })
|
|
22
28
|
product: Product
|
|
23
29
|
|
|
24
30
|
@ManyToOne(
|
|
25
31
|
() => ProductTopping,
|
|
26
|
-
(productTopping) => productTopping.product_groups
|
|
32
|
+
(productTopping) => productTopping.product_groups,
|
|
33
|
+
{
|
|
34
|
+
onDelete: 'CASCADE',
|
|
35
|
+
onUpdate: 'NO ACTION',
|
|
36
|
+
}
|
|
27
37
|
)
|
|
28
38
|
@JoinColumn({ name: 'topping' })
|
|
29
39
|
topping: ProductTopping
|
|
30
40
|
|
|
31
|
-
@Column({ length: 30 })
|
|
41
|
+
@Column({ length: 30, comment: 'Nombre del grupo.' })
|
|
32
42
|
name: string
|
|
33
43
|
|
|
34
44
|
@Column({
|
|
35
45
|
default: 1,
|
|
36
46
|
comment:
|
|
37
|
-
'El
|
|
47
|
+
'El `type` se refiere a si el grupo es opcional o si es requerido:\r\n1. Opcional.\r\n2. Requerido.',
|
|
38
48
|
})
|
|
39
49
|
type: number
|
|
40
50
|
|
|
41
51
|
@Column({
|
|
42
52
|
default: 0,
|
|
43
53
|
comment:
|
|
44
|
-
'Cantidad mínima que el usuario puede agregar para el grupo.\r\n\r\n- Cuando
|
|
54
|
+
'Cantidad mínima que el usuario puede agregar para el grupo.\r\n\r\n- Cuando `type` es `Requerido (2)` entonces la cantidad mínima debería ser 1.\r\n\r\n- Cuando `type` es `Opcional (1)` entonces la cantidad puede ser 0.',
|
|
45
55
|
})
|
|
46
56
|
minimum_quantity: number
|
|
47
57
|
|
|
@@ -51,7 +61,7 @@ export class ProductGroup {
|
|
|
51
61
|
})
|
|
52
62
|
maximum_quantity: number
|
|
53
63
|
|
|
54
|
-
@Column()
|
|
64
|
+
@Column({ comment: 'El orden en que aparece los grupos en el producto.' })
|
|
55
65
|
position: number
|
|
56
66
|
|
|
57
67
|
@OneToMany(
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity,
|
|
3
|
+
Column,
|
|
4
|
+
Entity,
|
|
5
|
+
JoinColumn,
|
|
6
|
+
ManyToOne,
|
|
7
|
+
PrimaryGeneratedColumn,
|
|
8
|
+
} from 'typeorm'
|
|
9
|
+
import { Product } from './Product'
|
|
10
|
+
import { TypeMeasureIngredient } from './TypeMeasureIngredient'
|
|
11
|
+
|
|
12
|
+
@Entity('product_ingredient', {
|
|
13
|
+
comment:
|
|
14
|
+
'Ingredientes que tendrá un producto específico. Esto se hace para guardar la información del inventario que se tiene y el que se gasta diario, esto genera un reporte donde el cliente puede ver qué cosas fueron usadas.',
|
|
15
|
+
})
|
|
16
|
+
export class ProductIngredient extends BaseEntity {
|
|
17
|
+
@PrimaryGeneratedColumn({
|
|
18
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
19
|
+
})
|
|
20
|
+
id: number
|
|
21
|
+
|
|
22
|
+
@ManyToOne(() => Product, (product) => product.product_ingredients, {
|
|
23
|
+
onDelete: 'CASCADE',
|
|
24
|
+
onUpdate: 'NO ACTION',
|
|
25
|
+
})
|
|
26
|
+
@JoinColumn({ name: 'product' })
|
|
27
|
+
product: Product
|
|
28
|
+
|
|
29
|
+
@Column({ length: 30, comment: 'Nombre del ingrediente.' })
|
|
30
|
+
name: string
|
|
31
|
+
|
|
32
|
+
@ManyToOne(
|
|
33
|
+
() => TypeMeasureIngredient,
|
|
34
|
+
(typeMeasureIngredient) => typeMeasureIngredient.type_measure_ingredients,
|
|
35
|
+
{
|
|
36
|
+
onDelete: 'CASCADE',
|
|
37
|
+
onUpdate: 'NO ACTION',
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
@JoinColumn({ name: 'type_measure_ingredient' })
|
|
41
|
+
type_measure_ingredient: TypeMeasureIngredient
|
|
42
|
+
|
|
43
|
+
@Column({ comment: 'Cantidad del ingrediente.' })
|
|
44
|
+
quantity: number
|
|
45
|
+
|
|
46
|
+
@Column({ type: 'datetime', comment: 'Fecha de creación del registro.' })
|
|
47
|
+
created: Date
|
|
48
|
+
|
|
49
|
+
@Column({
|
|
50
|
+
default: 1,
|
|
51
|
+
comment:
|
|
52
|
+
'Estado del registro, es decir:\r\n1. Activo: Es visible en los reportes de inventario.\r\n0. Inactivo: No será visible en los reportes de inventario.',
|
|
53
|
+
})
|
|
54
|
+
status: number
|
|
55
|
+
}
|
|
@@ -5,30 +5,41 @@ import {
|
|
|
5
5
|
ManyToOne,
|
|
6
6
|
JoinColumn,
|
|
7
7
|
OneToMany,
|
|
8
|
+
BaseEntity,
|
|
8
9
|
} from 'typeorm'
|
|
9
10
|
import { Company } from './Company'
|
|
10
11
|
import { ProductGroup } from './ProductGroup'
|
|
11
12
|
|
|
12
13
|
@Entity('product_topping', {
|
|
13
14
|
comment:
|
|
14
|
-
'Tabla
|
|
15
|
+
'Tabla donde habrán varios toppings por defecto para que el usuario los pueda agregar a sus productos y editarlos a su gusto.\r\n\r\nUn administrador/usuario con permisos podrá crear los toppings para cada empresa si es necesario.',
|
|
15
16
|
})
|
|
16
|
-
export class ProductTopping {
|
|
17
|
-
@PrimaryGeneratedColumn(
|
|
17
|
+
export class ProductTopping extends BaseEntity {
|
|
18
|
+
@PrimaryGeneratedColumn({
|
|
19
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
20
|
+
})
|
|
18
21
|
id: number
|
|
19
22
|
|
|
20
|
-
@ManyToOne(() => Company, (company) => company.product_toppings
|
|
23
|
+
@ManyToOne(() => Company, (company) => company.product_toppings, {
|
|
24
|
+
nullable: true,
|
|
25
|
+
onDelete: 'CASCADE',
|
|
26
|
+
onUpdate: 'NO ACTION',
|
|
27
|
+
})
|
|
21
28
|
@JoinColumn({ name: 'company' })
|
|
22
29
|
company: Company
|
|
23
30
|
|
|
24
31
|
@Column({
|
|
25
32
|
length: 50,
|
|
26
33
|
comment:
|
|
27
|
-
'El
|
|
34
|
+
'El `name` se refiere al id de los archivos de lenguaje que está en `locales` del proyecto. \n\nEsto se hace para qué sirva el multilenguaje en el proyecto. \n\nCabe recalcar qué las empresas pueden crear sus propios toppings, entonces no pasa nada el lenguaje en el que ellos lo escriban.',
|
|
28
35
|
})
|
|
29
36
|
name: string
|
|
30
37
|
|
|
31
|
-
@Column({
|
|
38
|
+
@Column({
|
|
39
|
+
default: 1,
|
|
40
|
+
comment:
|
|
41
|
+
'Estado del registro, es decir:\r\n1. Activo: Es visible en los reportes de inventario.\r\n0. Inactivo: No será visible en los reportes de inventario.',
|
|
42
|
+
})
|
|
32
43
|
status: number
|
|
33
44
|
|
|
34
45
|
@OneToMany(() => ProductGroup, (productGroup) => productGroup.topping)
|
package/src/entities/Region.ts
CHANGED
|
@@ -5,23 +5,39 @@ import {
|
|
|
5
5
|
ManyToOne,
|
|
6
6
|
JoinColumn,
|
|
7
7
|
OneToMany,
|
|
8
|
+
BaseEntity,
|
|
8
9
|
} from 'typeorm'
|
|
9
10
|
import { Country } from './Country'
|
|
10
11
|
import { City } from './City'
|
|
11
12
|
|
|
12
|
-
@Entity(
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
@Entity({
|
|
14
|
+
comment: 'Regiones/departamentos donde estará visible la plataforma.',
|
|
15
|
+
})
|
|
16
|
+
export class Region extends BaseEntity {
|
|
17
|
+
@PrimaryGeneratedColumn({
|
|
18
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
19
|
+
})
|
|
15
20
|
id: number
|
|
16
21
|
|
|
17
|
-
@
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
@ManyToOne(() => Country, (country) => country.regions, {
|
|
23
|
+
onDelete: 'RESTRICT',
|
|
24
|
+
onUpdate: 'NO ACTION',
|
|
25
|
+
})
|
|
21
26
|
@JoinColumn({ name: 'country' })
|
|
22
27
|
country: Country
|
|
23
28
|
|
|
24
|
-
@Column({
|
|
29
|
+
@Column({
|
|
30
|
+
length: 50,
|
|
31
|
+
comment:
|
|
32
|
+
'Nombre de la región/departamento/estado.\r\n\r\nID/KEY de la variable que se encuentra en los archivos `locales` para el multilenguaje.',
|
|
33
|
+
})
|
|
34
|
+
name: string
|
|
35
|
+
|
|
36
|
+
@Column({
|
|
37
|
+
default: 1,
|
|
38
|
+
comment:
|
|
39
|
+
'Estado del registro, es decir:\r\n1. Activo: Es visible en la plataforma.\r\n0. Inactivo: No será visible en la plataforma.',
|
|
40
|
+
})
|
|
25
41
|
status: number
|
|
26
42
|
|
|
27
43
|
@OneToMany(() => City, (city) => city.region)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity,
|
|
3
|
+
Column,
|
|
4
|
+
Entity,
|
|
5
|
+
JoinColumn,
|
|
6
|
+
JoinTable,
|
|
7
|
+
ManyToMany,
|
|
8
|
+
ManyToOne,
|
|
9
|
+
OneToMany,
|
|
10
|
+
PrimaryGeneratedColumn,
|
|
11
|
+
} from 'typeorm'
|
|
12
|
+
import { Local } from './Local'
|
|
13
|
+
import { PaymentMethod } from './PaymentMethod'
|
|
14
|
+
import { RequestStatus } from './RequestStatus'
|
|
15
|
+
import { User } from './User'
|
|
16
|
+
import { RequestProduct } from './RequestProduct'
|
|
17
|
+
import { RequestProductGroupComplement } from './RequestProductGroupComplement'
|
|
18
|
+
|
|
19
|
+
@Entity({
|
|
20
|
+
comment:
|
|
21
|
+
'Tabla para agregar los pedidos realizados a través de la plataforma.',
|
|
22
|
+
})
|
|
23
|
+
export class Request extends BaseEntity {
|
|
24
|
+
@PrimaryGeneratedColumn({
|
|
25
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
26
|
+
})
|
|
27
|
+
id: number
|
|
28
|
+
|
|
29
|
+
@ManyToOne(() => User, (user) => user.requests, {
|
|
30
|
+
nullable: true,
|
|
31
|
+
onDelete: 'SET NULL',
|
|
32
|
+
onUpdate: 'NO ACTION',
|
|
33
|
+
})
|
|
34
|
+
@JoinColumn({ name: 'user' })
|
|
35
|
+
user: User
|
|
36
|
+
|
|
37
|
+
@ManyToOne(() => Local, (local) => local.requests, {
|
|
38
|
+
onDelete: 'CASCADE',
|
|
39
|
+
onUpdate: 'NO ACTION',
|
|
40
|
+
})
|
|
41
|
+
@JoinColumn({ name: 'local' })
|
|
42
|
+
local: Local
|
|
43
|
+
|
|
44
|
+
@Column({
|
|
45
|
+
default: 1,
|
|
46
|
+
comment:
|
|
47
|
+
'Este campo hace referencia a si el tipo es:\r\n\r\n1. Individual: Un solo usuario ordena y paga.\r\n\r\n2. Grupal: El usuario principal puede agregar a otros colaboradores para realizar un pedido grupal (a tener en cuenta que el usuario principal es el único que puede realizar el pago del pedido).',
|
|
48
|
+
})
|
|
49
|
+
order_type: number
|
|
50
|
+
|
|
51
|
+
@ManyToOne(() => PaymentMethod, (paymentMethod) => paymentMethod.requests, {
|
|
52
|
+
onDelete: 'RESTRICT',
|
|
53
|
+
onUpdate: 'NO ACTION',
|
|
54
|
+
})
|
|
55
|
+
@JoinColumn({ name: 'payment_method' })
|
|
56
|
+
payment_method: PaymentMethod
|
|
57
|
+
|
|
58
|
+
@Column({
|
|
59
|
+
length: 30,
|
|
60
|
+
comment:
|
|
61
|
+
'Costo total del pedido, aquí toca tener en cuenta los productos (request_product) que se agreguen al pedido (request) y los complementos (request_product_group_complement).',
|
|
62
|
+
})
|
|
63
|
+
order_cost: string
|
|
64
|
+
|
|
65
|
+
@ManyToOne(() => RequestStatus, (requestStatus) => requestStatus.requests, {
|
|
66
|
+
onDelete: 'RESTRICT',
|
|
67
|
+
onUpdate: 'NO ACTION',
|
|
68
|
+
})
|
|
69
|
+
@JoinColumn({ name: 'status' })
|
|
70
|
+
status: RequestStatus
|
|
71
|
+
|
|
72
|
+
@Column({
|
|
73
|
+
length: 400,
|
|
74
|
+
comment:
|
|
75
|
+
'Los detalles que el usuario agrega al pedido, puede ser alguna sugerencia u otra cosa.',
|
|
76
|
+
})
|
|
77
|
+
details: string
|
|
78
|
+
|
|
79
|
+
@Column({
|
|
80
|
+
length: 400,
|
|
81
|
+
comment: 'Comentarios del pedido, este los realiza el cliente (local).',
|
|
82
|
+
})
|
|
83
|
+
comments: string
|
|
84
|
+
|
|
85
|
+
@ManyToMany(() => User)
|
|
86
|
+
@JoinTable({
|
|
87
|
+
name: 'request_group',
|
|
88
|
+
joinColumn: {
|
|
89
|
+
name: 'user',
|
|
90
|
+
referencedColumnName: 'id',
|
|
91
|
+
},
|
|
92
|
+
inverseJoinColumn: {
|
|
93
|
+
name: 'request',
|
|
94
|
+
referencedColumnName: 'id',
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
requests_group: User[]
|
|
98
|
+
|
|
99
|
+
@OneToMany(() => RequestProduct, (requestProduct) => requestProduct.request)
|
|
100
|
+
request_products: RequestProduct[]
|
|
101
|
+
|
|
102
|
+
@OneToMany(
|
|
103
|
+
() => RequestProductGroupComplement,
|
|
104
|
+
(requestProduct) => requestProduct.request
|
|
105
|
+
)
|
|
106
|
+
request_product_group_complements: RequestProductGroupComplement[]
|
|
107
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity,
|
|
3
|
+
Column,
|
|
4
|
+
Entity,
|
|
5
|
+
JoinColumn,
|
|
6
|
+
ManyToOne,
|
|
7
|
+
PrimaryGeneratedColumn,
|
|
8
|
+
} from 'typeorm'
|
|
9
|
+
import { Product } from './Product'
|
|
10
|
+
import { Request } from './Request'
|
|
11
|
+
import { User } from './User'
|
|
12
|
+
|
|
13
|
+
@Entity('request_product', {
|
|
14
|
+
comment: 'Productos que están en el pedido.',
|
|
15
|
+
})
|
|
16
|
+
export class RequestProduct extends BaseEntity {
|
|
17
|
+
@PrimaryGeneratedColumn({
|
|
18
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
19
|
+
})
|
|
20
|
+
id: number
|
|
21
|
+
|
|
22
|
+
@ManyToOne(() => Request, (request) => request.request_products, {
|
|
23
|
+
onDelete: 'CASCADE',
|
|
24
|
+
onUpdate: 'NO ACTION',
|
|
25
|
+
})
|
|
26
|
+
@JoinColumn({ name: 'request' })
|
|
27
|
+
request: Request
|
|
28
|
+
|
|
29
|
+
@ManyToOne(() => Product, (product) => product.request_products, {
|
|
30
|
+
onDelete: 'CASCADE',
|
|
31
|
+
onUpdate: 'NO ACTION',
|
|
32
|
+
})
|
|
33
|
+
@JoinColumn({ name: 'product' })
|
|
34
|
+
product: Product
|
|
35
|
+
|
|
36
|
+
@ManyToOne(() => User, (user) => user.request_products, {
|
|
37
|
+
onDelete: 'CASCADE',
|
|
38
|
+
onUpdate: 'NO ACTION',
|
|
39
|
+
})
|
|
40
|
+
@JoinColumn({ name: 'user' })
|
|
41
|
+
user: User
|
|
42
|
+
|
|
43
|
+
@Column({ comment: 'Cantidad del producto (product).' })
|
|
44
|
+
quantity: number
|
|
45
|
+
|
|
46
|
+
@Column({
|
|
47
|
+
length: 30,
|
|
48
|
+
comment: 'Comentarios del producto, si hay alguna sugerencia o solicitud.',
|
|
49
|
+
})
|
|
50
|
+
comments: string
|
|
51
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity,
|
|
3
|
+
Column,
|
|
4
|
+
Entity,
|
|
5
|
+
JoinColumn,
|
|
6
|
+
ManyToOne,
|
|
7
|
+
PrimaryGeneratedColumn,
|
|
8
|
+
} from 'typeorm'
|
|
9
|
+
import { Request } from './Request'
|
|
10
|
+
import { User } from './User'
|
|
11
|
+
import { ProductGroupComplement } from './productGroupComplement'
|
|
12
|
+
|
|
13
|
+
@Entity('request_product_group_complement', {
|
|
14
|
+
comment:
|
|
15
|
+
'Complementos (toppings) que el usuario va a poder agregar por cada producto.',
|
|
16
|
+
})
|
|
17
|
+
export class RequestProductGroupComplement extends BaseEntity {
|
|
18
|
+
@PrimaryGeneratedColumn({
|
|
19
|
+
comment: 'Número de identificación (ID) único de cada registro.',
|
|
20
|
+
})
|
|
21
|
+
id: number
|
|
22
|
+
|
|
23
|
+
@ManyToOne(
|
|
24
|
+
() => Request,
|
|
25
|
+
(request) => request.request_product_group_complements,
|
|
26
|
+
{
|
|
27
|
+
onDelete: 'CASCADE',
|
|
28
|
+
onUpdate: 'NO ACTION',
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
@JoinColumn({ name: 'request' })
|
|
32
|
+
request: Request
|
|
33
|
+
|
|
34
|
+
@ManyToOne(
|
|
35
|
+
() => ProductGroupComplement,
|
|
36
|
+
(productGroupComplement) =>
|
|
37
|
+
productGroupComplement.request_product_group_complements,
|
|
38
|
+
{
|
|
39
|
+
onDelete: 'CASCADE',
|
|
40
|
+
onUpdate: 'NO ACTION',
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
@JoinColumn({ name: 'product_group_complement' })
|
|
44
|
+
product_group_complement: ProductGroupComplement
|
|
45
|
+
|
|
46
|
+
@ManyToOne(() => User, (user) => user.request_product_group_complements, {
|
|
47
|
+
onDelete: 'CASCADE',
|
|
48
|
+
onUpdate: 'NO ACTION',
|
|
49
|
+
})
|
|
50
|
+
@JoinColumn({ name: 'user' })
|
|
51
|
+
user: User
|
|
52
|
+
|
|
53
|
+
@Column({ comment: 'Cantidad de cada complemento.' })
|
|
54
|
+
quantity: number
|
|
55
|
+
}
|