proflores-db-model 0.1.31 → 0.1.33

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.
@@ -2,5 +2,5 @@ import { Branch } from "./Branches";
2
2
  export declare class BranchImage {
3
3
  idBranchImage: number;
4
4
  imageUrl: string;
5
- branch: Branch;
5
+ branch: Branch | null;
6
6
  }
@@ -27,7 +27,7 @@ __decorate([
27
27
  onDelete: "CASCADE",
28
28
  }),
29
29
  (0, typeorm_1.JoinColumn)({ name: "branchId" }),
30
- __metadata("design:type", Branches_1.Branch)
30
+ __metadata("design:type", Object)
31
31
  ], BranchImage.prototype, "branch", void 0);
32
32
  BranchImage = __decorate([
33
33
  (0, typeorm_1.Entity)("branch_images")
@@ -4,14 +4,17 @@ import { UnitOfMeasure } from "./UnitOfMesure";
4
4
  import { Branch } from "./Branches";
5
5
  import { ContainerType } from "./ContainerType";
6
6
  import { Supplier } from "./Suppliers";
7
+ import { InventoryImage } from "./InventoryImage";
7
8
  export declare class Inventory implements ObjectLiteral {
8
9
  idInventory: number;
9
- product: Product;
10
- container: ContainerType;
10
+ product: Product | null;
11
+ container: ContainerType | null;
11
12
  quantity: number;
12
13
  wholesalePrice: number;
13
14
  retailPrice: number;
15
+ cost: number;
14
16
  unitOfMeasure?: UnitOfMeasure | null;
15
17
  branch?: Branch | null;
16
18
  supplier?: Supplier | null;
19
+ images: InventoryImage[] | null;
17
20
  }
@@ -16,6 +16,7 @@ const UnitOfMesure_1 = require("./UnitOfMesure");
16
16
  const Branches_1 = require("./Branches");
17
17
  const ContainerType_1 = require("./ContainerType");
18
18
  const Suppliers_1 = require("./Suppliers");
19
+ const InventoryImage_1 = require("./InventoryImage");
19
20
  let Inventory = class Inventory {
20
21
  };
21
22
  __decorate([
@@ -25,12 +26,12 @@ __decorate([
25
26
  __decorate([
26
27
  (0, typeorm_1.ManyToOne)(() => Products_1.Product, { nullable: false }),
27
28
  (0, typeorm_1.JoinColumn)({ name: "idProduct" }),
28
- __metadata("design:type", Products_1.Product)
29
+ __metadata("design:type", Object)
29
30
  ], Inventory.prototype, "product", void 0);
30
31
  __decorate([
31
32
  (0, typeorm_1.ManyToOne)(() => ContainerType_1.ContainerType, { nullable: false }),
32
33
  (0, typeorm_1.JoinColumn)({ name: "containerId" }),
33
- __metadata("design:type", ContainerType_1.ContainerType)
34
+ __metadata("design:type", Object)
34
35
  ], Inventory.prototype, "container", void 0);
35
36
  __decorate([
36
37
  (0, typeorm_1.Column)("decimal", { nullable: false, default: 0 }),
@@ -44,6 +45,10 @@ __decorate([
44
45
  (0, typeorm_1.Column)("decimal", { nullable: false, default: 0 }),
45
46
  __metadata("design:type", Number)
46
47
  ], Inventory.prototype, "retailPrice", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)("decimal", { nullable: false, default: 0 }),
50
+ __metadata("design:type", Number)
51
+ ], Inventory.prototype, "cost", void 0);
47
52
  __decorate([
48
53
  (0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure, { nullable: true }),
49
54
  (0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
@@ -59,6 +64,12 @@ __decorate([
59
64
  (0, typeorm_1.JoinColumn)({ name: "idSupplier" }),
60
65
  __metadata("design:type", Object)
61
66
  ], Inventory.prototype, "supplier", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.OneToMany)(() => InventoryImage_1.InventoryImage, (inventoryImage) => inventoryImage.inventory, {
69
+ cascade: true,
70
+ }),
71
+ __metadata("design:type", Object)
72
+ ], Inventory.prototype, "images", void 0);
62
73
  Inventory = __decorate([
63
74
  (0, typeorm_1.Entity)("inventory")
64
75
  ], Inventory);
@@ -0,0 +1,6 @@
1
+ import { Inventory } from "./Inventory";
2
+ export declare class InventoryImage {
3
+ idInventoryImage?: number;
4
+ imageUrl: string;
5
+ inventory?: Inventory | null;
6
+ }
@@ -0,0 +1,36 @@
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.InventoryImage = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Inventory_1 = require("./Inventory");
15
+ let InventoryImage = class InventoryImage {
16
+ };
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
+ __metadata("design:type", Number)
20
+ ], InventoryImage.prototype, "idInventoryImage", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 500 }),
23
+ __metadata("design:type", String)
24
+ ], InventoryImage.prototype, "imageUrl", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Inventory_1.Inventory, (inventory) => inventory.images, {
27
+ onDelete: "CASCADE",
28
+ nullable: true
29
+ }),
30
+ (0, typeorm_1.JoinColumn)({ name: "inventoryId" }),
31
+ __metadata("design:type", Object)
32
+ ], InventoryImage.prototype, "inventory", void 0);
33
+ InventoryImage = __decorate([
34
+ (0, typeorm_1.Entity)("inventory_images")
35
+ ], InventoryImage);
36
+ exports.InventoryImage = InventoryImage;
@@ -8,7 +8,7 @@ export declare class Product implements ObjectLiteral {
8
8
  secondaryName: string;
9
9
  description: string;
10
10
  categoryForPlantType?: CategoryForPlantType | null;
11
- images: ProductImage[];
12
- inventories: Inventory[];
11
+ images: ProductImage[] | null;
12
+ inventories: Inventory[] | null;
13
13
  isActive: boolean;
14
14
  }
@@ -41,11 +41,11 @@ __decorate([
41
41
  (0, typeorm_1.OneToMany)(() => ProductImage_1.ProductImage, (productImage) => productImage.product, {
42
42
  cascade: true,
43
43
  }),
44
- __metadata("design:type", Array)
44
+ __metadata("design:type", Object)
45
45
  ], Product.prototype, "images", void 0);
46
46
  __decorate([
47
47
  (0, typeorm_1.OneToMany)(() => Inventory_1.Inventory, (inventory) => inventory.product),
48
- __metadata("design:type", Array)
48
+ __metadata("design:type", Object)
49
49
  ], Product.prototype, "inventories", void 0);
50
50
  __decorate([
51
51
  (0, typeorm_1.Column)("boolean", { default: true }),
package/dist/index.d.ts CHANGED
@@ -17,4 +17,5 @@ export { Inventory } from "./entities/Inventory";
17
17
  export { Branch } from "./entities/Branches";
18
18
  export { BranchImage } from "./entities/BranchImage";
19
19
  export { SupplierImage } from "./entities/SupplierImage";
20
+ export { InventoryImage } from "./entities/InventoryImage";
20
21
  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.SupplierImage = exports.BranchImage = 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;
17
+ exports.InventoryImage = exports.SupplierImage = exports.BranchImage = 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");
@@ -53,4 +53,6 @@ var BranchImage_1 = require("./entities/BranchImage");
53
53
  Object.defineProperty(exports, "BranchImage", { enumerable: true, get: function () { return BranchImage_1.BranchImage; } });
54
54
  var SupplierImage_1 = require("./entities/SupplierImage");
55
55
  Object.defineProperty(exports, "SupplierImage", { enumerable: true, get: function () { return SupplierImage_1.SupplierImage; } });
56
+ var InventoryImage_1 = require("./entities/InventoryImage");
57
+ Object.defineProperty(exports, "InventoryImage", { enumerable: true, get: function () { return InventoryImage_1.InventoryImage; } });
56
58
  __exportStar(require("./types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
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",
@@ -19,5 +19,5 @@ export class BranchImage {
19
19
  onDelete: "CASCADE",
20
20
  })
21
21
  @JoinColumn({ name: "branchId" })
22
- branch!: Branch;
22
+ branch!: Branch | null;
23
23
  }
@@ -1,44 +1,61 @@
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
-
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ObjectLiteral,
6
+ ManyToOne,
7
+ JoinColumn,
8
+ OneToMany,
9
+ } from "typeorm";
10
+ import { Product } from "./Products";
11
+ import { UnitOfMeasure } from "./UnitOfMesure";
12
+ import { Branch } from "./Branches";
13
+ import { ContainerType } from "./ContainerType";
14
+ import { Supplier } from "./Suppliers";
15
+ import { InventoryImage } from "./InventoryImage";
16
+ @Entity("inventory")
17
+ export class Inventory implements ObjectLiteral {
18
+ @PrimaryGeneratedColumn("increment")
19
+ idInventory!: number;
20
+
21
+ @ManyToOne(() => Product, { nullable: false })
22
+ @JoinColumn({ name: "idProduct" })
23
+ product!: Product | null;
24
+
25
+ @ManyToOne(() => ContainerType, { nullable: false })
26
+ @JoinColumn({ name: "containerId" })
27
+ container!: ContainerType | null;
28
+
29
+ @Column("decimal", { nullable: false, default: 0 })
30
+ quantity!: number;
31
+
32
+ @Column("decimal", { nullable: false, default: 0 })
33
+ wholesalePrice!: number;
34
+
35
+ @Column("decimal", { nullable: false, default: 0 })
36
+ retailPrice!: number;
37
+
38
+ @Column("decimal", { nullable: false, default: 0 })
39
+ cost!: number;
40
+
41
+ @ManyToOne(() => UnitOfMeasure, { nullable: true })
42
+ @JoinColumn({ name: "idUnitOfMeasure" })
43
+ unitOfMeasure?: UnitOfMeasure | null;
44
+
45
+ @ManyToOne(() => Branch, { nullable: true })
46
+ @JoinColumn({ name: "idBranch" })
47
+ branch?: Branch | null;
48
+
49
+ @ManyToOne(() => Supplier, { nullable: true })
50
+ @JoinColumn({ name: "idSupplier" })
51
+ supplier?: Supplier | null;
52
+
53
+ @OneToMany(
54
+ () => InventoryImage,
55
+ (inventoryImage) => inventoryImage.inventory,
56
+ {
57
+ cascade: true,
58
+ }
59
+ )
60
+ images!: InventoryImage[] | null;
61
+ }
@@ -0,0 +1,21 @@
1
+ import {
2
+ Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn
3
+ } from "typeorm";
4
+ import { Inventory } from "./Inventory";
5
+
6
+ @Entity("inventory_images")
7
+ export class InventoryImage {
8
+ @PrimaryGeneratedColumn("increment")
9
+ idInventoryImage?: number;
10
+
11
+ @Column("varchar", { nullable: false, length: 500 })
12
+ imageUrl!: string;
13
+
14
+ @ManyToOne(() => Inventory, (inventory) => inventory.images, {
15
+ onDelete: "CASCADE",
16
+ nullable: true
17
+ })
18
+ @JoinColumn({ name: "inventoryId" })
19
+ inventory?: Inventory | null;
20
+ }
21
+
@@ -14,7 +14,7 @@ import { Inventory } from "./Inventory";
14
14
  @Entity("products")
15
15
  export class Product implements ObjectLiteral {
16
16
  @PrimaryGeneratedColumn("increment")
17
- idProduct?: number; // Se genera automáticamente
17
+ idProduct?: number;
18
18
 
19
19
  @Column("varchar", { nullable: false, length: 255 })
20
20
  name!: string;
@@ -32,10 +32,10 @@ export class Product implements ObjectLiteral {
32
32
  @OneToMany(() => ProductImage, (productImage) => productImage.product, {
33
33
  cascade: true,
34
34
  })
35
- images!: ProductImage[];
36
-
35
+ images!: ProductImage[] | null;
36
+
37
37
  @OneToMany(() => Inventory, (inventory) => inventory.product)
38
- inventories!: Inventory[];
38
+ inventories!: Inventory[] | null;
39
39
 
40
40
  @Column("boolean", { default: true })
41
41
  isActive!: boolean;
package/src/index.ts CHANGED
@@ -17,5 +17,6 @@ export { Inventory } from "./entities/Inventory";
17
17
  export { Branch } from "./entities/Branches";
18
18
  export { BranchImage } from "./entities/BranchImage";
19
19
  export { SupplierImage } from "./entities/SupplierImage";
20
+ export { InventoryImage } from "./entities/InventoryImage";
20
21
 
21
22
  export * from "./types";