proflores-db-model 0.1.23 → 0.1.25

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/ReadMe.txt ADDED
@@ -0,0 +1,2 @@
1
+ Hola
2
+ Comida
@@ -0,0 +1,11 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { Inventory } from "./Inventory";
3
+ export declare class Branch implements ObjectLiteral {
4
+ idBranch: number;
5
+ name: string;
6
+ address: string;
7
+ phone: string;
8
+ email: string;
9
+ city: string;
10
+ inventory: Inventory[];
11
+ }
@@ -0,0 +1,48 @@
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.Branch = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Inventory_1 = require("./Inventory");
15
+ let Branch = class Branch {
16
+ };
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
+ __metadata("design:type", Number)
20
+ ], Branch.prototype, "idBranch", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
23
+ __metadata("design:type", String)
24
+ ], Branch.prototype, "name", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
27
+ __metadata("design:type", String)
28
+ ], Branch.prototype, "address", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
31
+ __metadata("design:type", String)
32
+ ], Branch.prototype, "phone", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
35
+ __metadata("design:type", String)
36
+ ], Branch.prototype, "email", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
39
+ __metadata("design:type", String)
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);
45
+ Branch = __decorate([
46
+ (0, typeorm_1.Entity)("branches")
47
+ ], Branch);
48
+ exports.Branch = 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);
@@ -0,0 +1,15 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { Product } from "./Products";
3
+ import { UnitOfMeasure } from "./UnitOfMesure";
4
+ import { Branch } from "./Branches";
5
+ import { ContainerType } from "./ContainerType";
6
+ export declare class Inventory implements ObjectLiteral {
7
+ idInventory: number;
8
+ product: Product;
9
+ container: ContainerType;
10
+ quantity: number;
11
+ wholesalePrice: number;
12
+ retailPrice: number;
13
+ unitOfMeasure: UnitOfMeasure;
14
+ branch: Branch;
15
+ }
@@ -0,0 +1,59 @@
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.Inventory = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Products_1 = require("./Products");
15
+ const UnitOfMesure_1 = require("./UnitOfMesure");
16
+ const Branches_1 = require("./Branches");
17
+ const ContainerType_1 = require("./ContainerType");
18
+ let Inventory = class Inventory {
19
+ };
20
+ __decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
22
+ __metadata("design:type", Number)
23
+ ], Inventory.prototype, "idInventory", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.ManyToOne)(() => Products_1.Product),
26
+ (0, typeorm_1.JoinColumn)({ name: "idProduct" }),
27
+ __metadata("design:type", Products_1.Product)
28
+ ], Inventory.prototype, "product", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.ManyToOne)(() => ContainerType_1.ContainerType, { nullable: false }),
31
+ (0, typeorm_1.JoinColumn)({ name: "containerId" }),
32
+ __metadata("design:type", ContainerType_1.ContainerType)
33
+ ], Inventory.prototype, "container", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
36
+ __metadata("design:type", Number)
37
+ ], Inventory.prototype, "quantity", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
40
+ __metadata("design:type", Number)
41
+ ], Inventory.prototype, "wholesalePrice", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
44
+ __metadata("design:type", Number)
45
+ ], Inventory.prototype, "retailPrice", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure),
48
+ (0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
49
+ __metadata("design:type", UnitOfMesure_1.UnitOfMeasure)
50
+ ], Inventory.prototype, "unitOfMeasure", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.ManyToOne)(() => Branches_1.Branch),
53
+ (0, typeorm_1.JoinColumn)({ name: "idBranch" }),
54
+ __metadata("design:type", Branches_1.Branch)
55
+ ], Inventory.prototype, "branch", void 0);
56
+ Inventory = __decorate([
57
+ (0, typeorm_1.Entity)("inventory")
58
+ ], Inventory);
59
+ exports.Inventory = Inventory;
@@ -0,0 +1,6 @@
1
+ import { Product } from "./Products";
2
+ export declare class ProductImage {
3
+ id: number;
4
+ imageUrl: string;
5
+ product: Product;
6
+ }
@@ -0,0 +1,33 @@
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.ProductImage = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Products_1 = require("./Products");
15
+ let ProductImage = class ProductImage {
16
+ };
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
+ __metadata("design:type", Number)
20
+ ], ProductImage.prototype, "id", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 500 }),
23
+ __metadata("design:type", String)
24
+ ], ProductImage.prototype, "imageUrl", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Products_1.Product, (products) => products.images, { onDelete: "CASCADE" }),
27
+ (0, typeorm_1.JoinColumn)({ name: "productId" }),
28
+ __metadata("design:type", Products_1.Product)
29
+ ], ProductImage.prototype, "product", void 0);
30
+ ProductImage = __decorate([
31
+ (0, typeorm_1.Entity)("product_images")
32
+ ], ProductImage);
33
+ exports.ProductImage = ProductImage;
@@ -0,0 +1,14 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { CategoryForPlantType } from "./CategoryForPlantType";
3
+ import { ProductImage } from "./ProductImage";
4
+ import { Inventory } from "./Inventory";
5
+ export declare class Product implements ObjectLiteral {
6
+ idProduct: number;
7
+ name: string;
8
+ secondaryName: string;
9
+ description: string;
10
+ categoryForPlantType: CategoryForPlantType;
11
+ images: ProductImage[];
12
+ inventories: Inventory[];
13
+ isActive: boolean;
14
+ }
@@ -0,0 +1,57 @@
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.Product = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const CategoryForPlantType_1 = require("./CategoryForPlantType");
15
+ const ProductImage_1 = require("./ProductImage");
16
+ const Inventory_1 = require("./Inventory");
17
+ let Product = class Product {
18
+ };
19
+ __decorate([
20
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
21
+ __metadata("design:type", Number)
22
+ ], Product.prototype, "idProduct", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
25
+ __metadata("design:type", String)
26
+ ], Product.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
29
+ __metadata("design:type", String)
30
+ ], Product.prototype, "secondaryName", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)("text", { nullable: false }),
33
+ __metadata("design:type", String)
34
+ ], Product.prototype, "description", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.ManyToOne)(() => CategoryForPlantType_1.CategoryForPlantType),
37
+ (0, typeorm_1.JoinColumn)({ name: "categoryForPlantTypeId" }),
38
+ __metadata("design:type", CategoryForPlantType_1.CategoryForPlantType)
39
+ ], Product.prototype, "categoryForPlantType", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.OneToMany)(() => ProductImage_1.ProductImage, (productImage) => productImage.product, {
42
+ cascade: true,
43
+ }),
44
+ __metadata("design:type", Array)
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);
50
+ __decorate([
51
+ (0, typeorm_1.Column)("boolean", { default: true }),
52
+ __metadata("design:type", Boolean)
53
+ ], Product.prototype, "isActive", void 0);
54
+ Product = __decorate([
55
+ (0, typeorm_1.Entity)("products")
56
+ ], Product);
57
+ exports.Product = Product;
@@ -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/dist/index.d.ts CHANGED
@@ -11,4 +11,8 @@ export { CategoryForPlantType } from "./entities/CategoryForPlantType";
11
11
  export { UnitOfMeasure } from "./entities/UnitOfMesure";
12
12
  export { BankAccount } from "./entities/Bank/BankAccount";
13
13
  export { TransactionBank } from "./entities/Bank/TransactionBank";
14
+ export { ProductImage } from "./entities/ProductImage";
15
+ export { Product } from "./entities/Products";
16
+ export { Inventory } from "./entities/Inventory";
17
+ export { Branch } from "./entities/Branches";
14
18
  export * from "./types";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ 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.TransactionBank = exports.BankAccount = exports.UnitOfMeasure = exports.CategoryForPlantType = exports.CategoryForCosting = exports.Supplier = exports.ContainerType = exports.InventoryItem = exports.ExpenseTransaction = exports.User = exports.ProjectOrder = exports.ExpenseType = exports.ExpenseDetail = void 0;
17
+ exports.Branch = exports.Inventory = exports.Product = exports.ProductImage = exports.TransactionBank = exports.BankAccount = exports.UnitOfMeasure = exports.CategoryForPlantType = exports.CategoryForCosting = exports.Supplier = exports.ContainerType = exports.InventoryItem = exports.ExpenseTransaction = exports.User = exports.ProjectOrder = exports.ExpenseType = exports.ExpenseDetail = void 0;
18
18
  var ExpenseDetail_1 = require("./entities/ExpenseDetail");
19
19
  Object.defineProperty(exports, "ExpenseDetail", { enumerable: true, get: function () { return ExpenseDetail_1.ExpenseDetail; } });
20
20
  var ExpenseType_1 = require("./entities/ExpenseType");
@@ -41,4 +41,12 @@ var BankAccount_1 = require("./entities/Bank/BankAccount");
41
41
  Object.defineProperty(exports, "BankAccount", { enumerable: true, get: function () { return BankAccount_1.BankAccount; } });
42
42
  var TransactionBank_1 = require("./entities/Bank/TransactionBank");
43
43
  Object.defineProperty(exports, "TransactionBank", { enumerable: true, get: function () { return TransactionBank_1.TransactionBank; } });
44
+ var ProductImage_1 = require("./entities/ProductImage");
45
+ Object.defineProperty(exports, "ProductImage", { enumerable: true, get: function () { return ProductImage_1.ProductImage; } });
46
+ var Products_1 = require("./entities/Products");
47
+ Object.defineProperty(exports, "Product", { enumerable: true, get: function () { return Products_1.Product; } });
48
+ var Inventory_1 = require("./entities/Inventory");
49
+ Object.defineProperty(exports, "Inventory", { enumerable: true, get: function () { return Inventory_1.Inventory; } });
50
+ var Branches_1 = require("./entities/Branches");
51
+ Object.defineProperty(exports, "Branch", { enumerable: true, get: function () { return Branches_1.Branch; } });
44
52
  __exportStar(require("./types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "Data model for managing expenses and transactions for Proflores nursery business",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,27 @@
1
+ import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
2
+ import { Inventory } from "./Inventory";
3
+
4
+ @Entity("branches")
5
+ export class Branch implements ObjectLiteral {
6
+ @PrimaryGeneratedColumn("increment")
7
+ idBranch!: number;
8
+
9
+ @Column("varchar", { nullable: false, length: 255 })
10
+ name!: string;
11
+
12
+ @Column("varchar", { nullable: false, length: 255 })
13
+ address!: string;
14
+
15
+ @Column("varchar", { nullable: false, length: 255 })
16
+ phone!: string;
17
+
18
+ @Column("varchar", { nullable: false, length: 255 })
19
+ email!: string;
20
+
21
+ @Column("varchar", { nullable: false, length: 255 })
22
+ city!: string;
23
+
24
+ @OneToMany(() => Inventory, (inventory) => inventory.branch)
25
+ inventory!: Inventory[];
26
+
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
  }
@@ -0,0 +1,38 @@
1
+ import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn } from "typeorm";
2
+ import { Product } from "./Products";
3
+ import { UnitOfMeasure } from "./UnitOfMesure";
4
+ import { Branch } from "./Branches";
5
+ import { ContainerType } from "./ContainerType";
6
+
7
+ @Entity("inventory")
8
+ export class Inventory implements ObjectLiteral {
9
+ @PrimaryGeneratedColumn("increment")
10
+ idInventory!: number;
11
+
12
+ @ManyToOne(() => Product)
13
+ @JoinColumn({ name: "idProduct" })
14
+ product!: Product;
15
+
16
+ @ManyToOne(() => ContainerType, { nullable: false })
17
+ @JoinColumn({ name: "containerId" })
18
+ container!: ContainerType;
19
+
20
+ @Column("decimal", { nullable: false })
21
+ quantity!: number;
22
+
23
+ @Column("decimal", { nullable: false })
24
+ wholesalePrice!: number;
25
+
26
+ @Column("decimal", { nullable: false })
27
+ retailPrice!: number;
28
+
29
+ @ManyToOne(() => UnitOfMeasure)
30
+ @JoinColumn({ name: "idUnitOfMeasure" })
31
+ unitOfMeasure!: UnitOfMeasure;
32
+
33
+ @ManyToOne(() => Branch)
34
+ @JoinColumn({ name: "idBranch" })
35
+ branch!: Branch;
36
+
37
+
38
+ }
@@ -0,0 +1,18 @@
1
+ import {
2
+ Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn
3
+ } from "typeorm";
4
+ import { Product } from "./Products";
5
+
6
+ @Entity("product_images")
7
+ export class ProductImage {
8
+ @PrimaryGeneratedColumn("increment")
9
+ id!: number;
10
+
11
+ @Column("varchar", { nullable: false, length: 500 })
12
+ imageUrl!: string;
13
+
14
+ @ManyToOne(() => Product, (products) => products.images, { onDelete: "CASCADE" })
15
+ @JoinColumn({ name: "productId" })
16
+ product!: Product;
17
+ }
18
+
@@ -0,0 +1,43 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ObjectLiteral,
6
+ ManyToOne,
7
+ JoinColumn,
8
+ OneToMany,
9
+ } from "typeorm";
10
+ import { CategoryForPlantType } from "./CategoryForPlantType";
11
+ import { ProductImage } from "./ProductImage";
12
+ import { Inventory } from "./Inventory";
13
+
14
+
15
+ @Entity("products")
16
+ export class Product implements ObjectLiteral {
17
+ @PrimaryGeneratedColumn("increment")
18
+ idProduct!: number;
19
+
20
+ @Column("varchar", { nullable: false, length: 255 })
21
+ name!: string;
22
+
23
+ @Column("varchar", { nullable: false, length: 255 })
24
+ secondaryName!: string;
25
+
26
+ @Column("text", { nullable: false })
27
+ description!: string;
28
+
29
+ @ManyToOne(() => CategoryForPlantType)
30
+ @JoinColumn({ name: "categoryForPlantTypeId" })
31
+ categoryForPlantType!: CategoryForPlantType;
32
+
33
+ @OneToMany(() => ProductImage, (productImage) => productImage.product, {
34
+ cascade: true,
35
+ })
36
+ images!: ProductImage[];
37
+
38
+ @OneToMany(() => Inventory, (inventory) => inventory.product)
39
+ inventories!: Inventory[];
40
+
41
+ @Column("boolean", { default: true })
42
+ isActive!: boolean;
43
+ }
@@ -1,6 +1,12 @@
1
- import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
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(() => InventoryItem, (inventoryItem) => inventoryItem.unitOfMeasure)
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
  }
package/src/index.ts CHANGED
@@ -11,6 +11,9 @@ export { CategoryForPlantType } from "./entities/CategoryForPlantType";
11
11
  export { UnitOfMeasure } from "./entities/UnitOfMesure";
12
12
  export { BankAccount } from "./entities/Bank/BankAccount";
13
13
  export { TransactionBank } from "./entities/Bank/TransactionBank";
14
-
14
+ export { ProductImage } from "./entities/ProductImage";
15
+ export { Product } from "./entities/Products";
16
+ export { Inventory } from "./entities/Inventory";
17
+ export { Branch } from "./entities/Branches";
15
18
 
16
19
  export * from "./types";
File without changes
@@ -1 +0,0 @@
1
- "use strict";