proflores-db-model 0.1.24 → 0.1.26
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 +2 -0
- package/dist/entities/Branches.js +5 -0
- package/dist/entities/CategoryForPlantType.d.ts +2 -0
- package/dist/entities/CategoryForPlantType.js +5 -0
- package/dist/entities/ContainerType.d.ts +2 -0
- package/dist/entities/ContainerType.js +5 -0
- package/dist/entities/Inventory.d.ts +4 -0
- package/dist/entities/Inventory.js +12 -0
- package/dist/entities/Products.d.ts +2 -2
- package/dist/entities/Products.js +9 -8
- package/dist/entities/Suppliers.d.ts +5 -0
- package/dist/entities/Suppliers.js +17 -0
- package/dist/entities/UnitOfMesure.d.ts +2 -0
- package/dist/entities/UnitOfMesure.js +5 -0
- package/package.json +1 -1
- package/src/entities/Branches.ts +5 -1
- package/src/entities/CategoryForPlantType.ts +4 -1
- package/src/entities/ContainerType.ts +6 -0
- package/src/entities/Inventory.ts +10 -0
- package/src/entities/Products.ts +18 -10
- package/src/entities/Suppliers.ts +13 -0
- package/src/entities/UnitOfMesure.ts +16 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { Inventory } from "./Inventory";
|
|
2
3
|
export declare class Branch implements ObjectLiteral {
|
|
3
4
|
idBranch: number;
|
|
4
5
|
name: string;
|
|
@@ -6,4 +7,5 @@ export declare class Branch implements ObjectLiteral {
|
|
|
6
7
|
phone: string;
|
|
7
8
|
email: string;
|
|
8
9
|
city: string;
|
|
10
|
+
inventory: Inventory[];
|
|
9
11
|
}
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Branch = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Inventory_1 = require("./Inventory");
|
|
14
15
|
let Branch = class Branch {
|
|
15
16
|
};
|
|
16
17
|
__decorate([
|
|
@@ -37,6 +38,10 @@ __decorate([
|
|
|
37
38
|
(0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
|
|
38
39
|
__metadata("design:type", String)
|
|
39
40
|
], Branch.prototype, "city", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.OneToMany)(() => Inventory_1.Inventory, (inventory) => inventory.branch),
|
|
43
|
+
__metadata("design:type", Array)
|
|
44
|
+
], Branch.prototype, "inventory", void 0);
|
|
40
45
|
Branch = __decorate([
|
|
41
46
|
(0, typeorm_1.Entity)("branches")
|
|
42
47
|
], Branch);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
2
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
+
import { Product } from "./Products";
|
|
3
4
|
export declare class CategoryForPlantType implements ObjectLiteral {
|
|
4
5
|
idCategoryForPlantType: number;
|
|
5
6
|
name: string;
|
|
6
7
|
inventoryItems: InventoryItem[];
|
|
8
|
+
products: Product[];
|
|
7
9
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CategoryForPlantType = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const InventoryItem_1 = require("./InventoryItem");
|
|
15
|
+
const Products_1 = require("./Products");
|
|
15
16
|
let CategoryForPlantType = class CategoryForPlantType {
|
|
16
17
|
};
|
|
17
18
|
__decorate([
|
|
@@ -26,6 +27,10 @@ __decorate([
|
|
|
26
27
|
(0, typeorm_1.OneToMany)(() => InventoryItem_1.InventoryItem, (inventoryItem) => inventoryItem.categoryForPlantType),
|
|
27
28
|
__metadata("design:type", Array)
|
|
28
29
|
], CategoryForPlantType.prototype, "inventoryItems", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.OneToMany)(() => Products_1.Product, (product) => product.categoryForPlantType),
|
|
32
|
+
__metadata("design:type", Array)
|
|
33
|
+
], CategoryForPlantType.prototype, "products", void 0);
|
|
29
34
|
CategoryForPlantType = __decorate([
|
|
30
35
|
(0, typeorm_1.Entity)("categories_for_plant_type")
|
|
31
36
|
], CategoryForPlantType);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
2
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
+
import { Inventory } from "./Inventory";
|
|
3
4
|
export declare class ContainerType implements ObjectLiteral {
|
|
4
5
|
idContainerType: number;
|
|
5
6
|
name: string;
|
|
6
7
|
isActive: boolean;
|
|
7
8
|
inventoryItems: InventoryItem[];
|
|
9
|
+
inventory: Inventory[];
|
|
8
10
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ContainerType = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const InventoryItem_1 = require("./InventoryItem");
|
|
15
|
+
const Inventory_1 = require("./Inventory");
|
|
15
16
|
let ContainerType = class ContainerType {
|
|
16
17
|
};
|
|
17
18
|
__decorate([
|
|
@@ -30,6 +31,10 @@ __decorate([
|
|
|
30
31
|
(0, typeorm_1.OneToMany)(() => InventoryItem_1.InventoryItem, (inventoryItem) => inventoryItem.container),
|
|
31
32
|
__metadata("design:type", Array)
|
|
32
33
|
], ContainerType.prototype, "inventoryItems", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.OneToMany)(() => Inventory_1.Inventory, (inventory) => inventory.container),
|
|
36
|
+
__metadata("design:type", Array)
|
|
37
|
+
], ContainerType.prototype, "inventory", void 0);
|
|
33
38
|
ContainerType = __decorate([
|
|
34
39
|
(0, typeorm_1.Entity)("container_types")
|
|
35
40
|
], ContainerType);
|
|
@@ -2,12 +2,16 @@ import { ObjectLiteral } from "typeorm";
|
|
|
2
2
|
import { Product } from "./Products";
|
|
3
3
|
import { UnitOfMeasure } from "./UnitOfMesure";
|
|
4
4
|
import { Branch } from "./Branches";
|
|
5
|
+
import { ContainerType } from "./ContainerType";
|
|
6
|
+
import { Supplier } from "./Suppliers";
|
|
5
7
|
export declare class Inventory implements ObjectLiteral {
|
|
6
8
|
idInventory: number;
|
|
7
9
|
product: Product;
|
|
10
|
+
container: ContainerType;
|
|
8
11
|
quantity: number;
|
|
9
12
|
wholesalePrice: number;
|
|
10
13
|
retailPrice: number;
|
|
11
14
|
unitOfMeasure: UnitOfMeasure;
|
|
12
15
|
branch: Branch;
|
|
16
|
+
supplier: Supplier;
|
|
13
17
|
}
|
|
@@ -14,6 +14,8 @@ const typeorm_1 = require("typeorm");
|
|
|
14
14
|
const Products_1 = require("./Products");
|
|
15
15
|
const UnitOfMesure_1 = require("./UnitOfMesure");
|
|
16
16
|
const Branches_1 = require("./Branches");
|
|
17
|
+
const ContainerType_1 = require("./ContainerType");
|
|
18
|
+
const Suppliers_1 = require("./Suppliers");
|
|
17
19
|
let Inventory = class Inventory {
|
|
18
20
|
};
|
|
19
21
|
__decorate([
|
|
@@ -25,6 +27,11 @@ __decorate([
|
|
|
25
27
|
(0, typeorm_1.JoinColumn)({ name: "idProduct" }),
|
|
26
28
|
__metadata("design:type", Products_1.Product)
|
|
27
29
|
], Inventory.prototype, "product", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.ManyToOne)(() => ContainerType_1.ContainerType, { nullable: false }),
|
|
32
|
+
(0, typeorm_1.JoinColumn)({ name: "containerId" }),
|
|
33
|
+
__metadata("design:type", ContainerType_1.ContainerType)
|
|
34
|
+
], Inventory.prototype, "container", void 0);
|
|
28
35
|
__decorate([
|
|
29
36
|
(0, typeorm_1.Column)("decimal", { nullable: false }),
|
|
30
37
|
__metadata("design:type", Number)
|
|
@@ -47,6 +54,11 @@ __decorate([
|
|
|
47
54
|
(0, typeorm_1.JoinColumn)({ name: "idBranch" }),
|
|
48
55
|
__metadata("design:type", Branches_1.Branch)
|
|
49
56
|
], Inventory.prototype, "branch", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier),
|
|
59
|
+
(0, typeorm_1.JoinColumn)({ name: "idSupplier" }),
|
|
60
|
+
__metadata("design:type", Suppliers_1.Supplier)
|
|
61
|
+
], Inventory.prototype, "supplier", void 0);
|
|
50
62
|
Inventory = __decorate([
|
|
51
63
|
(0, typeorm_1.Entity)("inventory")
|
|
52
64
|
], Inventory);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
|
-
import { ContainerType } from "./ContainerType";
|
|
3
2
|
import { CategoryForPlantType } from "./CategoryForPlantType";
|
|
4
3
|
import { ProductImage } from "./ProductImage";
|
|
4
|
+
import { Inventory } from "./Inventory";
|
|
5
5
|
export declare class Product implements ObjectLiteral {
|
|
6
6
|
idProduct: number;
|
|
7
7
|
name: string;
|
|
8
8
|
secondaryName: string;
|
|
9
9
|
description: string;
|
|
10
|
-
container: ContainerType;
|
|
11
10
|
categoryForPlantType: CategoryForPlantType;
|
|
12
11
|
images: ProductImage[];
|
|
12
|
+
inventories: Inventory[];
|
|
13
13
|
isActive: boolean;
|
|
14
14
|
}
|
|
@@ -11,9 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Product = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
|
-
const ContainerType_1 = require("./ContainerType");
|
|
15
14
|
const CategoryForPlantType_1 = require("./CategoryForPlantType");
|
|
16
15
|
const ProductImage_1 = require("./ProductImage");
|
|
16
|
+
const Inventory_1 = require("./Inventory");
|
|
17
17
|
let Product = class Product {
|
|
18
18
|
};
|
|
19
19
|
__decorate([
|
|
@@ -29,23 +29,24 @@ __decorate([
|
|
|
29
29
|
__metadata("design:type", String)
|
|
30
30
|
], Product.prototype, "secondaryName", void 0);
|
|
31
31
|
__decorate([
|
|
32
|
-
(0, typeorm_1.Column)("
|
|
32
|
+
(0, typeorm_1.Column)("text", { nullable: false }),
|
|
33
33
|
__metadata("design:type", String)
|
|
34
34
|
], Product.prototype, "description", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, typeorm_1.ManyToOne)(() => ContainerType_1.ContainerType, { nullable: false }),
|
|
37
|
-
(0, typeorm_1.JoinColumn)({ name: "containerId" }),
|
|
38
|
-
__metadata("design:type", ContainerType_1.ContainerType)
|
|
39
|
-
], Product.prototype, "container", void 0);
|
|
40
35
|
__decorate([
|
|
41
36
|
(0, typeorm_1.ManyToOne)(() => CategoryForPlantType_1.CategoryForPlantType),
|
|
42
37
|
(0, typeorm_1.JoinColumn)({ name: "categoryForPlantTypeId" }),
|
|
43
38
|
__metadata("design:type", CategoryForPlantType_1.CategoryForPlantType)
|
|
44
39
|
], Product.prototype, "categoryForPlantType", void 0);
|
|
45
40
|
__decorate([
|
|
46
|
-
(0, typeorm_1.OneToMany)(() => ProductImage_1.ProductImage, (productImage) => productImage.product, {
|
|
41
|
+
(0, typeorm_1.OneToMany)(() => ProductImage_1.ProductImage, (productImage) => productImage.product, {
|
|
42
|
+
cascade: true,
|
|
43
|
+
}),
|
|
47
44
|
__metadata("design:type", Array)
|
|
48
45
|
], Product.prototype, "images", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.OneToMany)(() => Inventory_1.Inventory, (inventory) => inventory.product),
|
|
48
|
+
__metadata("design:type", Array)
|
|
49
|
+
], Product.prototype, "inventories", void 0);
|
|
49
50
|
__decorate([
|
|
50
51
|
(0, typeorm_1.Column)("boolean", { default: true }),
|
|
51
52
|
__metadata("design:type", Boolean)
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
2
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
+
import { Inventory } from "./Inventory";
|
|
3
4
|
export declare class Supplier implements ObjectLiteral {
|
|
4
5
|
idSupplier: number;
|
|
5
6
|
name: string;
|
|
6
7
|
contactInfo: string;
|
|
8
|
+
address: string;
|
|
9
|
+
phone: string;
|
|
10
|
+
email: string;
|
|
11
|
+
inventory: Inventory[];
|
|
7
12
|
inventoryItems: InventoryItem[];
|
|
8
13
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.Supplier = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const InventoryItem_1 = require("./InventoryItem");
|
|
15
|
+
const Inventory_1 = require("./Inventory");
|
|
15
16
|
let Supplier = class Supplier {
|
|
16
17
|
};
|
|
17
18
|
__decorate([
|
|
@@ -26,6 +27,22 @@ __decorate([
|
|
|
26
27
|
(0, typeorm_1.Column)("varchar", { nullable: true, length: 255 }),
|
|
27
28
|
__metadata("design:type", String)
|
|
28
29
|
], Supplier.prototype, "contactInfo", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], Supplier.prototype, "address", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)("varchar", { nullable: true, length: 255 }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], Supplier.prototype, "phone", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)("varchar", { nullable: true, length: 255 }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], Supplier.prototype, "email", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.OneToMany)(() => Inventory_1.Inventory, (inventory) => inventory.supplier),
|
|
44
|
+
__metadata("design:type", Array)
|
|
45
|
+
], Supplier.prototype, "inventory", void 0);
|
|
29
46
|
__decorate([
|
|
30
47
|
(0, typeorm_1.OneToMany)(() => InventoryItem_1.InventoryItem, (inventoryItem) => inventoryItem.supplier),
|
|
31
48
|
__metadata("design:type", Array)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
2
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
+
import { Inventory } from "./Inventory";
|
|
3
4
|
export declare class UnitOfMeasure implements ObjectLiteral {
|
|
4
5
|
idUnitOfMeasure: number;
|
|
5
6
|
name: string;
|
|
6
7
|
inventoryItems: InventoryItem[];
|
|
8
|
+
inventories: Inventory[];
|
|
7
9
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.UnitOfMeasure = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const InventoryItem_1 = require("./InventoryItem");
|
|
15
|
+
const Inventory_1 = require("./Inventory");
|
|
15
16
|
let UnitOfMeasure = class UnitOfMeasure {
|
|
16
17
|
};
|
|
17
18
|
__decorate([
|
|
@@ -26,6 +27,10 @@ __decorate([
|
|
|
26
27
|
(0, typeorm_1.OneToMany)(() => InventoryItem_1.InventoryItem, (inventoryItem) => inventoryItem.unitOfMeasure),
|
|
27
28
|
__metadata("design:type", Array)
|
|
28
29
|
], UnitOfMeasure.prototype, "inventoryItems", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.OneToMany)(() => Inventory_1.Inventory, (inventory) => inventory.unitOfMeasure),
|
|
32
|
+
__metadata("design:type", Array)
|
|
33
|
+
], UnitOfMeasure.prototype, "inventories", void 0);
|
|
29
34
|
UnitOfMeasure = __decorate([
|
|
30
35
|
(0, typeorm_1.Entity)("units_of_measure")
|
|
31
36
|
], UnitOfMeasure);
|
package/package.json
CHANGED
package/src/entities/Branches.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral } from "typeorm";
|
|
1
|
+
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
|
|
2
|
+
import { Inventory } from "./Inventory";
|
|
2
3
|
|
|
3
4
|
@Entity("branches")
|
|
4
5
|
export class Branch implements ObjectLiteral {
|
|
@@ -20,4 +21,7 @@ export class Branch implements ObjectLiteral {
|
|
|
20
21
|
@Column("varchar", { nullable: false, length: 255 })
|
|
21
22
|
city!: string;
|
|
22
23
|
|
|
24
|
+
@OneToMany(() => Inventory, (inventory) => inventory.branch)
|
|
25
|
+
inventory!: Inventory[];
|
|
26
|
+
|
|
23
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
|
|
2
2
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
-
|
|
3
|
+
import { Product } from "./Products";
|
|
4
4
|
@Entity("categories_for_plant_type")
|
|
5
5
|
export class CategoryForPlantType implements ObjectLiteral {
|
|
6
6
|
@PrimaryGeneratedColumn("increment")
|
|
@@ -11,4 +11,7 @@ export class CategoryForPlantType implements ObjectLiteral {
|
|
|
11
11
|
|
|
12
12
|
@OneToMany(() => InventoryItem, (inventoryItem) => inventoryItem.categoryForPlantType)
|
|
13
13
|
inventoryItems!: InventoryItem[];
|
|
14
|
+
|
|
15
|
+
@OneToMany(() => Product, (product) => product.categoryForPlantType)
|
|
16
|
+
products!: Product[];
|
|
14
17
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ObjectLiteral } from "typeorm";
|
|
2
2
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
+
import { Inventory } from "./Inventory";
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
@Entity("container_types")
|
|
5
7
|
export class ContainerType implements ObjectLiteral {
|
|
@@ -14,4 +16,8 @@ export class ContainerType implements ObjectLiteral {
|
|
|
14
16
|
|
|
15
17
|
@OneToMany(() => InventoryItem, (inventoryItem) => inventoryItem.container)
|
|
16
18
|
inventoryItems!: InventoryItem[];
|
|
19
|
+
|
|
20
|
+
@OneToMany(() => Inventory, (inventory) => inventory.container)
|
|
21
|
+
inventory!: Inventory[];
|
|
22
|
+
|
|
17
23
|
}
|
|
@@ -2,6 +2,8 @@ import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinC
|
|
|
2
2
|
import { Product } from "./Products";
|
|
3
3
|
import { UnitOfMeasure } from "./UnitOfMesure";
|
|
4
4
|
import { Branch } from "./Branches";
|
|
5
|
+
import { ContainerType } from "./ContainerType";
|
|
6
|
+
import { Supplier } from "./Suppliers";
|
|
5
7
|
|
|
6
8
|
@Entity("inventory")
|
|
7
9
|
export class Inventory implements ObjectLiteral {
|
|
@@ -12,6 +14,10 @@ export class Inventory implements ObjectLiteral {
|
|
|
12
14
|
@JoinColumn({ name: "idProduct" })
|
|
13
15
|
product!: Product;
|
|
14
16
|
|
|
17
|
+
@ManyToOne(() => ContainerType, { nullable: false })
|
|
18
|
+
@JoinColumn({ name: "containerId" })
|
|
19
|
+
container!: ContainerType;
|
|
20
|
+
|
|
15
21
|
@Column("decimal", { nullable: false })
|
|
16
22
|
quantity!: number;
|
|
17
23
|
|
|
@@ -28,6 +34,10 @@ export class Inventory implements ObjectLiteral {
|
|
|
28
34
|
@ManyToOne(() => Branch)
|
|
29
35
|
@JoinColumn({ name: "idBranch" })
|
|
30
36
|
branch!: Branch;
|
|
37
|
+
|
|
38
|
+
@ManyToOne(() => Supplier)
|
|
39
|
+
@JoinColumn({ name: "idSupplier" })
|
|
40
|
+
supplier!: Supplier;
|
|
31
41
|
|
|
32
42
|
|
|
33
43
|
}
|
package/src/entities/Products.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
ObjectLiteral,
|
|
6
|
+
ManyToOne,
|
|
7
|
+
JoinColumn,
|
|
8
|
+
OneToMany,
|
|
9
|
+
} from "typeorm";
|
|
3
10
|
import { CategoryForPlantType } from "./CategoryForPlantType";
|
|
4
11
|
import { ProductImage } from "./ProductImage";
|
|
12
|
+
import { Inventory } from "./Inventory";
|
|
13
|
+
|
|
5
14
|
|
|
6
15
|
@Entity("products")
|
|
7
16
|
export class Product implements ObjectLiteral {
|
|
@@ -14,22 +23,21 @@ export class Product implements ObjectLiteral {
|
|
|
14
23
|
@Column("varchar", { nullable: false, length: 255 })
|
|
15
24
|
secondaryName!: string;
|
|
16
25
|
|
|
17
|
-
@Column("
|
|
26
|
+
@Column("text", { nullable: false })
|
|
18
27
|
description!: string;
|
|
19
28
|
|
|
20
|
-
@ManyToOne(() => ContainerType, { nullable: false })
|
|
21
|
-
@JoinColumn({ name: "containerId" })
|
|
22
|
-
container!: ContainerType;
|
|
23
|
-
|
|
24
29
|
@ManyToOne(() => CategoryForPlantType)
|
|
25
30
|
@JoinColumn({ name: "categoryForPlantTypeId" })
|
|
26
31
|
categoryForPlantType!: CategoryForPlantType;
|
|
27
32
|
|
|
28
|
-
@OneToMany(() => ProductImage, (productImage) => productImage.product, {
|
|
33
|
+
@OneToMany(() => ProductImage, (productImage) => productImage.product, {
|
|
34
|
+
cascade: true,
|
|
35
|
+
})
|
|
29
36
|
images!: ProductImage[];
|
|
30
37
|
|
|
38
|
+
@OneToMany(() => Inventory, (inventory) => inventory.product)
|
|
39
|
+
inventories!: Inventory[];
|
|
40
|
+
|
|
31
41
|
@Column("boolean", { default: true })
|
|
32
42
|
isActive!: boolean;
|
|
33
|
-
|
|
34
|
-
|
|
35
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
|
|
2
2
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
+
import { Inventory } from "./Inventory";
|
|
3
4
|
|
|
4
5
|
@Entity("suppliers")
|
|
5
6
|
export class Supplier implements ObjectLiteral {
|
|
@@ -12,6 +13,18 @@ export class Supplier implements ObjectLiteral {
|
|
|
12
13
|
@Column("varchar", { nullable: true, length: 255 })
|
|
13
14
|
contactInfo!: string;
|
|
14
15
|
|
|
16
|
+
@Column("text", { nullable: true })
|
|
17
|
+
address!: string;
|
|
18
|
+
|
|
19
|
+
@Column("varchar", { nullable: true, length: 255 })
|
|
20
|
+
phone!: string;
|
|
21
|
+
|
|
22
|
+
@Column("varchar", { nullable: true, length: 255 })
|
|
23
|
+
email!: string;
|
|
24
|
+
|
|
25
|
+
@OneToMany(() => Inventory, (inventory) => inventory.supplier)
|
|
26
|
+
inventory!: Inventory[];
|
|
27
|
+
|
|
15
28
|
@OneToMany(() => InventoryItem, (inventoryItem) => inventoryItem.supplier)
|
|
16
29
|
inventoryItems!: InventoryItem[];
|
|
17
30
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
ObjectLiteral,
|
|
6
|
+
OneToMany,
|
|
7
|
+
} from "typeorm";
|
|
2
8
|
import { InventoryItem } from "./InventoryItem";
|
|
3
|
-
|
|
9
|
+
import { Inventory } from "./Inventory";
|
|
4
10
|
|
|
5
11
|
@Entity("units_of_measure")
|
|
6
12
|
export class UnitOfMeasure implements ObjectLiteral {
|
|
@@ -8,8 +14,14 @@ export class UnitOfMeasure implements ObjectLiteral {
|
|
|
8
14
|
idUnitOfMeasure!: number;
|
|
9
15
|
|
|
10
16
|
@Column("varchar", { nullable: false, length: 50 })
|
|
11
|
-
name!: string;
|
|
17
|
+
name!: string;
|
|
12
18
|
|
|
13
|
-
@OneToMany(
|
|
19
|
+
@OneToMany(
|
|
20
|
+
() => InventoryItem,
|
|
21
|
+
(inventoryItem) => inventoryItem.unitOfMeasure
|
|
22
|
+
)
|
|
14
23
|
inventoryItems!: InventoryItem[];
|
|
24
|
+
|
|
25
|
+
@OneToMany(() => Inventory, (inventory) => inventory.unitOfMeasure)
|
|
26
|
+
inventories!: Inventory[];
|
|
15
27
|
}
|