proflores-db-model 0.1.28 → 0.1.31
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/Branches.d.ts +1 -1
- package/dist/entities/Inventory.d.ts +3 -3
- package/dist/entities/Inventory.js +10 -10
- package/dist/entities/ProductImage.d.ts +2 -2
- package/dist/entities/ProductImage.js +5 -2
- package/dist/entities/Products.d.ts +2 -2
- package/dist/entities/Products.js +2 -2
- package/dist/entities/SupplierImage.d.ts +2 -2
- package/dist/entities/SupplierImage.js +3 -2
- package/package.json +1 -1
- package/src/entities/Branches.ts +5 -5
- package/src/entities/Inventory.ts +44 -43
- package/src/entities/ProductImage.ts +6 -3
- package/src/entities/Products.ts +4 -5
- package/src/entities/SupplierImage.ts +11 -10
|
@@ -2,7 +2,7 @@ import { ObjectLiteral } from "typeorm";
|
|
|
2
2
|
import { Inventory } from "./Inventory";
|
|
3
3
|
import { BranchImage } from "./BranchImage";
|
|
4
4
|
export declare class Branch implements ObjectLiteral {
|
|
5
|
-
idBranch
|
|
5
|
+
idBranch?: number;
|
|
6
6
|
name: string;
|
|
7
7
|
address: string;
|
|
8
8
|
phone: string;
|
|
@@ -11,7 +11,7 @@ export declare class Inventory implements ObjectLiteral {
|
|
|
11
11
|
quantity: number;
|
|
12
12
|
wholesalePrice: number;
|
|
13
13
|
retailPrice: number;
|
|
14
|
-
unitOfMeasure
|
|
15
|
-
branch
|
|
16
|
-
supplier
|
|
14
|
+
unitOfMeasure?: UnitOfMeasure | null;
|
|
15
|
+
branch?: Branch | null;
|
|
16
|
+
supplier?: Supplier | null;
|
|
17
17
|
}
|
|
@@ -23,7 +23,7 @@ __decorate([
|
|
|
23
23
|
__metadata("design:type", Number)
|
|
24
24
|
], Inventory.prototype, "idInventory", void 0);
|
|
25
25
|
__decorate([
|
|
26
|
-
(0, typeorm_1.ManyToOne)(() => Products_1.Product),
|
|
26
|
+
(0, typeorm_1.ManyToOne)(() => Products_1.Product, { nullable: false }),
|
|
27
27
|
(0, typeorm_1.JoinColumn)({ name: "idProduct" }),
|
|
28
28
|
__metadata("design:type", Products_1.Product)
|
|
29
29
|
], Inventory.prototype, "product", void 0);
|
|
@@ -33,31 +33,31 @@ __decorate([
|
|
|
33
33
|
__metadata("design:type", ContainerType_1.ContainerType)
|
|
34
34
|
], Inventory.prototype, "container", void 0);
|
|
35
35
|
__decorate([
|
|
36
|
-
(0, typeorm_1.Column)("decimal", { nullable: false }),
|
|
36
|
+
(0, typeorm_1.Column)("decimal", { nullable: false, default: 0 }),
|
|
37
37
|
__metadata("design:type", Number)
|
|
38
38
|
], Inventory.prototype, "quantity", void 0);
|
|
39
39
|
__decorate([
|
|
40
|
-
(0, typeorm_1.Column)("decimal", { nullable: false }),
|
|
40
|
+
(0, typeorm_1.Column)("decimal", { nullable: false, default: 0 }),
|
|
41
41
|
__metadata("design:type", Number)
|
|
42
42
|
], Inventory.prototype, "wholesalePrice", void 0);
|
|
43
43
|
__decorate([
|
|
44
|
-
(0, typeorm_1.Column)("decimal", { nullable: false }),
|
|
44
|
+
(0, typeorm_1.Column)("decimal", { nullable: false, default: 0 }),
|
|
45
45
|
__metadata("design:type", Number)
|
|
46
46
|
], Inventory.prototype, "retailPrice", void 0);
|
|
47
47
|
__decorate([
|
|
48
|
-
(0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure),
|
|
48
|
+
(0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure, { nullable: true }),
|
|
49
49
|
(0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
|
|
50
|
-
__metadata("design:type",
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
51
|
], Inventory.prototype, "unitOfMeasure", void 0);
|
|
52
52
|
__decorate([
|
|
53
|
-
(0, typeorm_1.ManyToOne)(() => Branches_1.Branch),
|
|
53
|
+
(0, typeorm_1.ManyToOne)(() => Branches_1.Branch, { nullable: true }),
|
|
54
54
|
(0, typeorm_1.JoinColumn)({ name: "idBranch" }),
|
|
55
|
-
__metadata("design:type",
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
56
|
], Inventory.prototype, "branch", void 0);
|
|
57
57
|
__decorate([
|
|
58
|
-
(0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier),
|
|
58
|
+
(0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier, { nullable: true }),
|
|
59
59
|
(0, typeorm_1.JoinColumn)({ name: "idSupplier" }),
|
|
60
|
-
__metadata("design:type",
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
61
|
], Inventory.prototype, "supplier", void 0);
|
|
62
62
|
Inventory = __decorate([
|
|
63
63
|
(0, typeorm_1.Entity)("inventory")
|
|
@@ -23,9 +23,12 @@ __decorate([
|
|
|
23
23
|
__metadata("design:type", String)
|
|
24
24
|
], ProductImage.prototype, "imageUrl", void 0);
|
|
25
25
|
__decorate([
|
|
26
|
-
(0, typeorm_1.ManyToOne)(() => Products_1.Product, (
|
|
26
|
+
(0, typeorm_1.ManyToOne)(() => Products_1.Product, (product) => product.images, {
|
|
27
|
+
onDelete: "CASCADE",
|
|
28
|
+
nullable: true
|
|
29
|
+
}),
|
|
27
30
|
(0, typeorm_1.JoinColumn)({ name: "productId" }),
|
|
28
|
-
__metadata("design:type",
|
|
31
|
+
__metadata("design:type", Object)
|
|
29
32
|
], ProductImage.prototype, "product", void 0);
|
|
30
33
|
ProductImage = __decorate([
|
|
31
34
|
(0, typeorm_1.Entity)("product_images")
|
|
@@ -3,11 +3,11 @@ import { CategoryForPlantType } from "./CategoryForPlantType";
|
|
|
3
3
|
import { ProductImage } from "./ProductImage";
|
|
4
4
|
import { Inventory } from "./Inventory";
|
|
5
5
|
export declare class Product implements ObjectLiteral {
|
|
6
|
-
idProduct
|
|
6
|
+
idProduct?: number;
|
|
7
7
|
name: string;
|
|
8
8
|
secondaryName: string;
|
|
9
9
|
description: string;
|
|
10
|
-
categoryForPlantType
|
|
10
|
+
categoryForPlantType?: CategoryForPlantType | null;
|
|
11
11
|
images: ProductImage[];
|
|
12
12
|
inventories: Inventory[];
|
|
13
13
|
isActive: boolean;
|
|
@@ -33,9 +33,9 @@ __decorate([
|
|
|
33
33
|
__metadata("design:type", String)
|
|
34
34
|
], Product.prototype, "description", void 0);
|
|
35
35
|
__decorate([
|
|
36
|
-
(0, typeorm_1.ManyToOne)(() => CategoryForPlantType_1.CategoryForPlantType),
|
|
36
|
+
(0, typeorm_1.ManyToOne)(() => CategoryForPlantType_1.CategoryForPlantType, { nullable: true }),
|
|
37
37
|
(0, typeorm_1.JoinColumn)({ name: "categoryForPlantTypeId" }),
|
|
38
|
-
__metadata("design:type",
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
39
|
], Product.prototype, "categoryForPlantType", void 0);
|
|
40
40
|
__decorate([
|
|
41
41
|
(0, typeorm_1.OneToMany)(() => ProductImage_1.ProductImage, (productImage) => productImage.product, {
|
|
@@ -23,11 +23,12 @@ __decorate([
|
|
|
23
23
|
__metadata("design:type", String)
|
|
24
24
|
], SupplierImage.prototype, "imageUrl", void 0);
|
|
25
25
|
__decorate([
|
|
26
|
-
(0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier, (
|
|
26
|
+
(0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier, (supplier) => supplier.images, {
|
|
27
27
|
onDelete: "CASCADE",
|
|
28
|
+
nullable: true,
|
|
28
29
|
}),
|
|
29
30
|
(0, typeorm_1.JoinColumn)({ name: "supplierId" }),
|
|
30
|
-
__metadata("design:type",
|
|
31
|
+
__metadata("design:type", Object)
|
|
31
32
|
], SupplierImage.prototype, "supplier", void 0);
|
|
32
33
|
SupplierImage = __decorate([
|
|
33
34
|
(0, typeorm_1.Entity)("supplier_images")
|
package/package.json
CHANGED
package/src/entities/Branches.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
|
|
2
2
|
import { Inventory } from "./Inventory";
|
|
3
3
|
import { BranchImage } from "./BranchImage";
|
|
4
|
+
|
|
4
5
|
@Entity("branches")
|
|
5
6
|
export class Branch implements ObjectLiteral {
|
|
6
7
|
@PrimaryGeneratedColumn("increment")
|
|
7
|
-
idBranch
|
|
8
|
+
idBranch?: number; // Se genera automáticamente
|
|
8
9
|
|
|
9
10
|
@Column("varchar", { nullable: false, length: 255 })
|
|
10
11
|
name!: string;
|
|
@@ -22,11 +23,10 @@ export class Branch implements ObjectLiteral {
|
|
|
22
23
|
city!: string;
|
|
23
24
|
|
|
24
25
|
@OneToMany(() => Inventory, (inventory) => inventory.branch)
|
|
25
|
-
inventory!: Inventory[];
|
|
26
|
+
inventory!: Inventory[]; // ❌ Se elimina `= []`
|
|
26
27
|
|
|
27
28
|
@OneToMany(() => BranchImage, (branchImage) => branchImage.branch, {
|
|
28
29
|
cascade: true,
|
|
29
30
|
})
|
|
30
|
-
images!: BranchImage[];
|
|
31
|
-
|
|
32
|
-
}
|
|
31
|
+
images!: BranchImage[]; // ❌ Se elimina `= []`
|
|
32
|
+
}
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn
|
|
3
|
+
} from "typeorm";
|
|
4
|
+
import { Product } from "./Products";
|
|
5
|
+
import { UnitOfMeasure } from "./UnitOfMesure";
|
|
6
|
+
import { Branch } from "./Branches";
|
|
7
|
+
import { ContainerType } from "./ContainerType";
|
|
8
|
+
import { Supplier } from "./Suppliers";
|
|
9
|
+
|
|
10
|
+
@Entity("inventory")
|
|
11
|
+
export class Inventory implements ObjectLiteral {
|
|
12
|
+
@PrimaryGeneratedColumn("increment")
|
|
13
|
+
idInventory!: number;
|
|
14
|
+
|
|
15
|
+
@ManyToOne(() => Product, { nullable: false })
|
|
16
|
+
@JoinColumn({ name: "idProduct" })
|
|
17
|
+
product!: Product;
|
|
18
|
+
|
|
19
|
+
@ManyToOne(() => ContainerType, { nullable: false })
|
|
20
|
+
@JoinColumn({ name: "containerId" })
|
|
21
|
+
container!: ContainerType;
|
|
22
|
+
|
|
23
|
+
@Column("decimal", { nullable: false, default: 0 })
|
|
24
|
+
quantity!: number;
|
|
25
|
+
|
|
26
|
+
@Column("decimal", { nullable: false, default: 0 })
|
|
27
|
+
wholesalePrice!: number;
|
|
28
|
+
|
|
29
|
+
@Column("decimal", { nullable: false, default: 0 })
|
|
30
|
+
retailPrice!: number;
|
|
31
|
+
|
|
32
|
+
@ManyToOne(() => UnitOfMeasure, { nullable: true })
|
|
33
|
+
@JoinColumn({ name: "idUnitOfMeasure" })
|
|
34
|
+
unitOfMeasure?: UnitOfMeasure | null;
|
|
35
|
+
|
|
36
|
+
@ManyToOne(() => Branch, { nullable: true })
|
|
37
|
+
@JoinColumn({ name: "idBranch" })
|
|
38
|
+
branch?: Branch | null;
|
|
39
|
+
|
|
40
|
+
@ManyToOne(() => Supplier, { nullable: true })
|
|
41
|
+
@JoinColumn({ name: "idSupplier" })
|
|
42
|
+
supplier?: Supplier | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
@@ -6,13 +6,16 @@ import {
|
|
|
6
6
|
@Entity("product_images")
|
|
7
7
|
export class ProductImage {
|
|
8
8
|
@PrimaryGeneratedColumn("increment")
|
|
9
|
-
idProductImage
|
|
9
|
+
idProductImage?: number;
|
|
10
10
|
|
|
11
11
|
@Column("varchar", { nullable: false, length: 500 })
|
|
12
12
|
imageUrl!: string;
|
|
13
13
|
|
|
14
|
-
@ManyToOne(() => Product, (
|
|
14
|
+
@ManyToOne(() => Product, (product) => product.images, {
|
|
15
|
+
onDelete: "CASCADE",
|
|
16
|
+
nullable: true
|
|
17
|
+
})
|
|
15
18
|
@JoinColumn({ name: "productId" })
|
|
16
|
-
product
|
|
19
|
+
product?: Product | null;
|
|
17
20
|
}
|
|
18
21
|
|
package/src/entities/Products.ts
CHANGED
|
@@ -11,11 +11,10 @@ import { CategoryForPlantType } from "./CategoryForPlantType";
|
|
|
11
11
|
import { ProductImage } from "./ProductImage";
|
|
12
12
|
import { Inventory } from "./Inventory";
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
@Entity("products")
|
|
16
15
|
export class Product implements ObjectLiteral {
|
|
17
16
|
@PrimaryGeneratedColumn("increment")
|
|
18
|
-
idProduct
|
|
17
|
+
idProduct?: number; // Se genera automáticamente
|
|
19
18
|
|
|
20
19
|
@Column("varchar", { nullable: false, length: 255 })
|
|
21
20
|
name!: string;
|
|
@@ -26,15 +25,15 @@ export class Product implements ObjectLiteral {
|
|
|
26
25
|
@Column("text", { nullable: false })
|
|
27
26
|
description!: string;
|
|
28
27
|
|
|
29
|
-
@ManyToOne(() => CategoryForPlantType)
|
|
28
|
+
@ManyToOne(() => CategoryForPlantType, { nullable: true })
|
|
30
29
|
@JoinColumn({ name: "categoryForPlantTypeId" })
|
|
31
|
-
categoryForPlantType
|
|
30
|
+
categoryForPlantType?: CategoryForPlantType | null;
|
|
32
31
|
|
|
33
32
|
@OneToMany(() => ProductImage, (productImage) => productImage.product, {
|
|
34
33
|
cascade: true,
|
|
35
34
|
})
|
|
36
35
|
images!: ProductImage[];
|
|
37
|
-
|
|
36
|
+
|
|
38
37
|
@OneToMany(() => Inventory, (inventory) => inventory.product)
|
|
39
38
|
inventories!: Inventory[];
|
|
40
39
|
|
|
@@ -3,15 +3,16 @@ import { Supplier } from "./Suppliers";
|
|
|
3
3
|
|
|
4
4
|
@Entity("supplier_images")
|
|
5
5
|
export class SupplierImage {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
@PrimaryGeneratedColumn("increment")
|
|
7
|
+
idSupplierImage?: number;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
@Column("varchar", { nullable: false, length: 500 })
|
|
10
|
+
imageUrl!: string;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
@ManyToOne(() => Supplier, (supplier) => supplier.images, {
|
|
13
|
+
onDelete: "CASCADE",
|
|
14
|
+
nullable: true,
|
|
15
|
+
})
|
|
16
|
+
@JoinColumn({ name: "supplierId" })
|
|
17
|
+
supplier?: Supplier | null;
|
|
18
|
+
}
|