proflores-db-model 0.1.22 → 0.1.24

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
@@ -1,9 +1,11 @@
1
1
  import { ObjectLiteral } from "typeorm";
2
2
  import { BankAccount } from "./BankAccount";
3
+ import { ExpenseTransaction } from "../ExpenseTransaction";
3
4
  export declare class TransactionBank implements ObjectLiteral {
4
5
  idTransactionBank: number;
5
6
  amount: number;
6
7
  type: "INCOME" | "EXPENSE";
7
8
  transactionDate: Date;
8
9
  bankAccount: BankAccount;
10
+ expenseTransaction?: ExpenseTransaction;
9
11
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TransactionBank = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const BankAccount_1 = require("./BankAccount");
15
+ const ExpenseTransaction_1 = require("../ExpenseTransaction");
15
16
  let TransactionBank = class TransactionBank {
16
17
  };
17
18
  __decorate([
@@ -36,6 +37,14 @@ __decorate([
36
37
  }),
37
38
  __metadata("design:type", BankAccount_1.BankAccount)
38
39
  ], TransactionBank.prototype, "bankAccount", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.OneToOne)(() => ExpenseTransaction_1.ExpenseTransaction, (expenseTransaction) => expenseTransaction.transactionBank, {
42
+ nullable: true,
43
+ cascade: true,
44
+ }),
45
+ (0, typeorm_1.JoinColumn)({ name: "expenseTransactionId" }),
46
+ __metadata("design:type", ExpenseTransaction_1.ExpenseTransaction)
47
+ ], TransactionBank.prototype, "expenseTransaction", void 0);
39
48
  TransactionBank = __decorate([
40
49
  (0, typeorm_1.Entity)("transactions_bank")
41
50
  ], TransactionBank);
@@ -0,0 +1,9 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ export declare class Branch implements ObjectLiteral {
3
+ idBranch: number;
4
+ name: string;
5
+ address: string;
6
+ phone: string;
7
+ email: string;
8
+ city: string;
9
+ }
@@ -0,0 +1,43 @@
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
+ let Branch = class Branch {
15
+ };
16
+ __decorate([
17
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
18
+ __metadata("design:type", Number)
19
+ ], Branch.prototype, "idBranch", void 0);
20
+ __decorate([
21
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
22
+ __metadata("design:type", String)
23
+ ], Branch.prototype, "name", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
26
+ __metadata("design:type", String)
27
+ ], Branch.prototype, "address", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
30
+ __metadata("design:type", String)
31
+ ], Branch.prototype, "phone", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
34
+ __metadata("design:type", String)
35
+ ], Branch.prototype, "email", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 255 }),
38
+ __metadata("design:type", String)
39
+ ], Branch.prototype, "city", void 0);
40
+ Branch = __decorate([
41
+ (0, typeorm_1.Entity)("branches")
42
+ ], Branch);
43
+ exports.Branch = Branch;
@@ -2,6 +2,7 @@ import { ObjectLiteral } from "typeorm";
2
2
  import { ProjectOrder } from "./ProjectOrder";
3
3
  import { ExpenseType } from "./ExpenseType";
4
4
  import { ExpenseDetail } from "./ExpenseDetail";
5
+ import { TransactionBank } from "./Bank/TransactionBank";
5
6
  export declare class ExpenseTransaction implements ObjectLiteral {
6
7
  expenseTransactionId: number;
7
8
  bankId: string;
@@ -13,4 +14,5 @@ export declare class ExpenseTransaction implements ObjectLiteral {
13
14
  projectOrder: ProjectOrder;
14
15
  expenseType: ExpenseType;
15
16
  expenseDetails: ExpenseDetail[];
17
+ transactionBank?: TransactionBank;
16
18
  }
@@ -15,6 +15,7 @@ const typeorm_1 = require("typeorm");
15
15
  const ProjectOrder_1 = require("./ProjectOrder");
16
16
  const ExpenseType_1 = require("./ExpenseType");
17
17
  const ExpenseDetail_1 = require("./ExpenseDetail");
18
+ const TransactionBank_1 = require("./Bank/TransactionBank");
18
19
  let ExpenseTransaction = class ExpenseTransaction {
19
20
  };
20
21
  __decorate([
@@ -61,6 +62,12 @@ __decorate([
61
62
  }),
62
63
  __metadata("design:type", Array)
63
64
  ], ExpenseTransaction.prototype, "expenseDetails", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.OneToOne)(() => TransactionBank_1.TransactionBank, (transactionBank) => transactionBank.expenseTransaction, {
67
+ nullable: true,
68
+ }),
69
+ __metadata("design:type", TransactionBank_1.TransactionBank)
70
+ ], ExpenseTransaction.prototype, "transactionBank", void 0);
64
71
  ExpenseTransaction = __decorate([
65
72
  (0, typeorm_1.Entity)()
66
73
  ], ExpenseTransaction);
@@ -0,0 +1,13 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { Product } from "./Products";
3
+ import { UnitOfMeasure } from "./UnitOfMesure";
4
+ import { Branch } from "./Branches";
5
+ export declare class Inventory implements ObjectLiteral {
6
+ idInventory: number;
7
+ product: Product;
8
+ quantity: number;
9
+ wholesalePrice: number;
10
+ retailPrice: number;
11
+ unitOfMeasure: UnitOfMeasure;
12
+ branch: Branch;
13
+ }
@@ -0,0 +1,53 @@
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
+ let Inventory = class Inventory {
18
+ };
19
+ __decorate([
20
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
21
+ __metadata("design:type", Number)
22
+ ], Inventory.prototype, "idInventory", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.ManyToOne)(() => Products_1.Product),
25
+ (0, typeorm_1.JoinColumn)({ name: "idProduct" }),
26
+ __metadata("design:type", Products_1.Product)
27
+ ], Inventory.prototype, "product", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
30
+ __metadata("design:type", Number)
31
+ ], Inventory.prototype, "quantity", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
34
+ __metadata("design:type", Number)
35
+ ], Inventory.prototype, "wholesalePrice", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
38
+ __metadata("design:type", Number)
39
+ ], Inventory.prototype, "retailPrice", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure),
42
+ (0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
43
+ __metadata("design:type", UnitOfMesure_1.UnitOfMeasure)
44
+ ], Inventory.prototype, "unitOfMeasure", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.ManyToOne)(() => Branches_1.Branch),
47
+ (0, typeorm_1.JoinColumn)({ name: "idBranch" }),
48
+ __metadata("design:type", Branches_1.Branch)
49
+ ], Inventory.prototype, "branch", void 0);
50
+ Inventory = __decorate([
51
+ (0, typeorm_1.Entity)("inventory")
52
+ ], Inventory);
53
+ 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 { ContainerType } from "./ContainerType";
3
+ import { CategoryForPlantType } from "./CategoryForPlantType";
4
+ import { ProductImage } from "./ProductImage";
5
+ export declare class Product implements ObjectLiteral {
6
+ idProduct: number;
7
+ name: string;
8
+ secondaryName: string;
9
+ description: string;
10
+ container: ContainerType;
11
+ categoryForPlantType: CategoryForPlantType;
12
+ images: ProductImage[];
13
+ isActive: boolean;
14
+ }
@@ -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.Product = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const ContainerType_1 = require("./ContainerType");
15
+ const CategoryForPlantType_1 = require("./CategoryForPlantType");
16
+ const ProductImage_1 = require("./ProductImage");
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)("varchar", { nullable: false, length: 255 }),
33
+ __metadata("design:type", String)
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
+ __decorate([
41
+ (0, typeorm_1.ManyToOne)(() => CategoryForPlantType_1.CategoryForPlantType),
42
+ (0, typeorm_1.JoinColumn)({ name: "categoryForPlantTypeId" }),
43
+ __metadata("design:type", CategoryForPlantType_1.CategoryForPlantType)
44
+ ], Product.prototype, "categoryForPlantType", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.OneToMany)(() => ProductImage_1.ProductImage, (productImage) => productImage.product, { cascade: true }),
47
+ __metadata("design:type", Array)
48
+ ], Product.prototype, "images", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)("boolean", { default: true }),
51
+ __metadata("design:type", Boolean)
52
+ ], Product.prototype, "isActive", void 0);
53
+ Product = __decorate([
54
+ (0, typeorm_1.Entity)("products")
55
+ ], Product);
56
+ exports.Product = Product;
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.22",
3
+ "version": "0.1.24",
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",
@@ -3,10 +3,13 @@ import {
3
3
  PrimaryGeneratedColumn,
4
4
  Column,
5
5
  ManyToOne,
6
- ObjectLiteral
6
+ ObjectLiteral,
7
+ OneToOne,
8
+ JoinColumn
7
9
  } from "typeorm";
8
10
  import { BankAccount } from "./BankAccount";
9
-
11
+ import { ExpenseTransaction } from "../ExpenseTransaction";
12
+
10
13
  @Entity("transactions_bank")
11
14
  export class TransactionBank implements ObjectLiteral {
12
15
  @PrimaryGeneratedColumn("increment")
@@ -25,5 +28,11 @@ import {
25
28
  onDelete: "CASCADE",
26
29
  })
27
30
  bankAccount!: BankAccount;
31
+ @OneToOne(() => ExpenseTransaction, (expenseTransaction) => expenseTransaction.transactionBank, {
32
+ nullable: true,
33
+ cascade: true,
34
+ })
35
+ @JoinColumn({ name: "expenseTransactionId" })
36
+ expenseTransaction?: ExpenseTransaction;
28
37
  }
29
38
 
@@ -0,0 +1,23 @@
1
+ import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral } from "typeorm";
2
+
3
+ @Entity("branches")
4
+ export class Branch implements ObjectLiteral {
5
+ @PrimaryGeneratedColumn("increment")
6
+ idBranch!: number;
7
+
8
+ @Column("varchar", { nullable: false, length: 255 })
9
+ name!: string;
10
+
11
+ @Column("varchar", { nullable: false, length: 255 })
12
+ address!: string;
13
+
14
+ @Column("varchar", { nullable: false, length: 255 })
15
+ phone!: string;
16
+
17
+ @Column("varchar", { nullable: false, length: 255 })
18
+ email!: string;
19
+
20
+ @Column("varchar", { nullable: false, length: 255 })
21
+ city!: string;
22
+
23
+ }
@@ -7,10 +7,12 @@ import {
7
7
  JoinColumn,
8
8
  OneToMany,
9
9
  ObjectLiteral,
10
+ OneToOne
10
11
  } from "typeorm";
11
12
  import { ProjectOrder } from "./ProjectOrder";
12
13
  import { ExpenseType } from "./ExpenseType";
13
14
  import { ExpenseDetail } from "./ExpenseDetail";
15
+ import { TransactionBank } from "./Bank/TransactionBank";
14
16
 
15
17
  @Entity()
16
18
  export class ExpenseTransaction implements ObjectLiteral {
@@ -47,4 +49,9 @@ export class ExpenseTransaction implements ObjectLiteral {
47
49
  cascade: true,
48
50
  })
49
51
  expenseDetails!: ExpenseDetail[];
52
+
53
+ @OneToOne(() => TransactionBank, (transactionBank) => transactionBank.expenseTransaction, {
54
+ nullable: true,
55
+ })
56
+ transactionBank?: TransactionBank;
50
57
  }
@@ -0,0 +1,33 @@
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
+
6
+ @Entity("inventory")
7
+ export class Inventory implements ObjectLiteral {
8
+ @PrimaryGeneratedColumn("increment")
9
+ idInventory!: number;
10
+
11
+ @ManyToOne(() => Product)
12
+ @JoinColumn({ name: "idProduct" })
13
+ product!: Product;
14
+
15
+ @Column("decimal", { nullable: false })
16
+ quantity!: number;
17
+
18
+ @Column("decimal", { nullable: false })
19
+ wholesalePrice!: number;
20
+
21
+ @Column("decimal", { nullable: false })
22
+ retailPrice!: number;
23
+
24
+ @ManyToOne(() => UnitOfMeasure)
25
+ @JoinColumn({ name: "idUnitOfMeasure" })
26
+ unitOfMeasure!: UnitOfMeasure;
27
+
28
+ @ManyToOne(() => Branch)
29
+ @JoinColumn({ name: "idBranch" })
30
+ branch!: Branch;
31
+
32
+
33
+ }
@@ -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,35 @@
1
+ import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn, OneToMany } from "typeorm";
2
+ import { ContainerType } from "./ContainerType";
3
+ import { CategoryForPlantType } from "./CategoryForPlantType";
4
+ import { ProductImage } from "./ProductImage";
5
+
6
+ @Entity("products")
7
+ export class Product implements ObjectLiteral {
8
+ @PrimaryGeneratedColumn("increment")
9
+ idProduct!: number;
10
+
11
+ @Column("varchar", { nullable: false, length: 255 })
12
+ name!: string;
13
+
14
+ @Column("varchar", { nullable: false, length: 255 })
15
+ secondaryName!: string;
16
+
17
+ @Column("varchar", { nullable: false, length: 255 })
18
+ description!: string;
19
+
20
+ @ManyToOne(() => ContainerType, { nullable: false })
21
+ @JoinColumn({ name: "containerId" })
22
+ container!: ContainerType;
23
+
24
+ @ManyToOne(() => CategoryForPlantType)
25
+ @JoinColumn({ name: "categoryForPlantTypeId" })
26
+ categoryForPlantType!: CategoryForPlantType;
27
+
28
+ @OneToMany(() => ProductImage, (productImage) => productImage.product, { cascade: true })
29
+ images!: ProductImage[];
30
+
31
+ @Column("boolean", { default: true })
32
+ isActive!: boolean;
33
+
34
+
35
+ }
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";