proflores-db-model 0.1.26 → 0.1.27

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.
@@ -0,0 +1,6 @@
1
+ import { Branch } from "./Branches";
2
+ export declare class BranchImage {
3
+ idBranchImage: number;
4
+ imageUrl: string;
5
+ branch: Branch;
6
+ }
@@ -0,0 +1,35 @@
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.BranchImage = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Branches_1 = require("./Branches");
15
+ let BranchImage = class BranchImage {
16
+ };
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
+ __metadata("design:type", Number)
20
+ ], BranchImage.prototype, "idBranchImage", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 500 }),
23
+ __metadata("design:type", String)
24
+ ], BranchImage.prototype, "imageUrl", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Branches_1.Branch, (branches) => branches.images, {
27
+ onDelete: "CASCADE",
28
+ }),
29
+ (0, typeorm_1.JoinColumn)({ name: "branchId" }),
30
+ __metadata("design:type", Branches_1.Branch)
31
+ ], BranchImage.prototype, "branch", void 0);
32
+ BranchImage = __decorate([
33
+ (0, typeorm_1.Entity)("branch_images")
34
+ ], BranchImage);
35
+ exports.BranchImage = BranchImage;
@@ -1,5 +1,6 @@
1
1
  import { ObjectLiteral } from "typeorm";
2
2
  import { Inventory } from "./Inventory";
3
+ import { BranchImage } from "./BranchImage";
3
4
  export declare class Branch implements ObjectLiteral {
4
5
  idBranch: number;
5
6
  name: string;
@@ -8,4 +9,5 @@ export declare class Branch implements ObjectLiteral {
8
9
  email: string;
9
10
  city: string;
10
11
  inventory: Inventory[];
12
+ images: BranchImage[];
11
13
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Branch = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const Inventory_1 = require("./Inventory");
15
+ const BranchImage_1 = require("./BranchImage");
15
16
  let Branch = class Branch {
16
17
  };
17
18
  __decorate([
@@ -42,6 +43,12 @@ __decorate([
42
43
  (0, typeorm_1.OneToMany)(() => Inventory_1.Inventory, (inventory) => inventory.branch),
43
44
  __metadata("design:type", Array)
44
45
  ], Branch.prototype, "inventory", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.OneToMany)(() => BranchImage_1.BranchImage, (branchImage) => branchImage.branch, {
48
+ cascade: true,
49
+ }),
50
+ __metadata("design:type", Array)
51
+ ], Branch.prototype, "images", void 0);
45
52
  Branch = __decorate([
46
53
  (0, typeorm_1.Entity)("branches")
47
54
  ], Branch);
@@ -1,6 +1,6 @@
1
1
  import { Product } from "./Products";
2
2
  export declare class ProductImage {
3
- id: number;
3
+ idProductImage: number;
4
4
  imageUrl: string;
5
5
  product: Product;
6
6
  }
@@ -17,7 +17,7 @@ let ProductImage = class ProductImage {
17
17
  __decorate([
18
18
  (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
19
  __metadata("design:type", Number)
20
- ], ProductImage.prototype, "id", void 0);
20
+ ], ProductImage.prototype, "idProductImage", void 0);
21
21
  __decorate([
22
22
  (0, typeorm_1.Column)("varchar", { nullable: false, length: 500 }),
23
23
  __metadata("design:type", String)
@@ -0,0 +1,6 @@
1
+ import { Supplier } from "./Suppliers";
2
+ export declare class SupplierImage {
3
+ idSupplierImage: number;
4
+ imageUrl: string;
5
+ supplier: Supplier;
6
+ }
@@ -0,0 +1,35 @@
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.SupplierImage = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Suppliers_1 = require("./Suppliers");
15
+ let SupplierImage = class SupplierImage {
16
+ };
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
+ __metadata("design:type", Number)
20
+ ], SupplierImage.prototype, "idSupplierImage", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)("varchar", { nullable: false, length: 500 }),
23
+ __metadata("design:type", String)
24
+ ], SupplierImage.prototype, "imageUrl", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier, (suppliers) => suppliers.images, {
27
+ onDelete: "CASCADE",
28
+ }),
29
+ (0, typeorm_1.JoinColumn)({ name: "supplierId" }),
30
+ __metadata("design:type", Suppliers_1.Supplier)
31
+ ], SupplierImage.prototype, "supplier", void 0);
32
+ SupplierImage = __decorate([
33
+ (0, typeorm_1.Entity)("supplier_images")
34
+ ], SupplierImage);
35
+ exports.SupplierImage = SupplierImage;
@@ -1,6 +1,7 @@
1
1
  import { ObjectLiteral } from "typeorm";
2
2
  import { InventoryItem } from "./InventoryItem";
3
3
  import { Inventory } from "./Inventory";
4
+ import { SupplierImage } from "./SupplierImage";
4
5
  export declare class Supplier implements ObjectLiteral {
5
6
  idSupplier: number;
6
7
  name: string;
@@ -10,4 +11,5 @@ export declare class Supplier implements ObjectLiteral {
10
11
  email: string;
11
12
  inventory: Inventory[];
12
13
  inventoryItems: InventoryItem[];
14
+ images: SupplierImage[];
13
15
  }
@@ -13,6 +13,7 @@ exports.Supplier = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const InventoryItem_1 = require("./InventoryItem");
15
15
  const Inventory_1 = require("./Inventory");
16
+ const SupplierImage_1 = require("./SupplierImage");
16
17
  let Supplier = class Supplier {
17
18
  };
18
19
  __decorate([
@@ -47,6 +48,12 @@ __decorate([
47
48
  (0, typeorm_1.OneToMany)(() => InventoryItem_1.InventoryItem, (inventoryItem) => inventoryItem.supplier),
48
49
  __metadata("design:type", Array)
49
50
  ], Supplier.prototype, "inventoryItems", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.OneToMany)(() => SupplierImage_1.SupplierImage, (supplierImage) => supplierImage.supplier, {
53
+ cascade: true,
54
+ }),
55
+ __metadata("design:type", Array)
56
+ ], Supplier.prototype, "images", void 0);
50
57
  Supplier = __decorate([
51
58
  (0, typeorm_1.Entity)("suppliers")
52
59
  ], Supplier);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
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,23 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ManyToOne,
6
+ JoinColumn,
7
+ } from "typeorm";
8
+ import { Branch } from "./Branches";
9
+
10
+ @Entity("branch_images")
11
+ export class BranchImage {
12
+ @PrimaryGeneratedColumn("increment")
13
+ idBranchImage!: number;
14
+
15
+ @Column("varchar", { nullable: false, length: 500 })
16
+ imageUrl!: string;
17
+
18
+ @ManyToOne(() => Branch, (branches) => branches.images, {
19
+ onDelete: "CASCADE",
20
+ })
21
+ @JoinColumn({ name: "branchId" })
22
+ branch!: Branch;
23
+ }
@@ -1,6 +1,6 @@
1
1
  import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
2
2
  import { Inventory } from "./Inventory";
3
-
3
+ import { BranchImage } from "./BranchImage";
4
4
  @Entity("branches")
5
5
  export class Branch implements ObjectLiteral {
6
6
  @PrimaryGeneratedColumn("increment")
@@ -24,4 +24,9 @@ export class Branch implements ObjectLiteral {
24
24
  @OneToMany(() => Inventory, (inventory) => inventory.branch)
25
25
  inventory!: Inventory[];
26
26
 
27
+ @OneToMany(() => BranchImage, (branchImage) => branchImage.branch, {
28
+ cascade: true,
29
+ })
30
+ images!: BranchImage[];
31
+
27
32
  }
@@ -6,7 +6,7 @@ import {
6
6
  @Entity("product_images")
7
7
  export class ProductImage {
8
8
  @PrimaryGeneratedColumn("increment")
9
- id!: number;
9
+ idProductImage!: number;
10
10
 
11
11
  @Column("varchar", { nullable: false, length: 500 })
12
12
  imageUrl!: string;
@@ -0,0 +1,17 @@
1
+ import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from "typeorm";
2
+ import { Supplier } from "./Suppliers";
3
+
4
+ @Entity("supplier_images")
5
+ export class SupplierImage {
6
+ @PrimaryGeneratedColumn("increment")
7
+ idSupplierImage!: number;
8
+
9
+ @Column("varchar", { nullable: false, length: 500 })
10
+ imageUrl!: string;
11
+
12
+ @ManyToOne(() => Supplier, (suppliers) => suppliers.images, {
13
+ onDelete: "CASCADE",
14
+ })
15
+ @JoinColumn({ name: "supplierId" })
16
+ supplier!: Supplier;
17
+ }
@@ -1,7 +1,7 @@
1
1
  import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
2
2
  import { InventoryItem } from "./InventoryItem";
3
3
  import { Inventory } from "./Inventory";
4
-
4
+ import { SupplierImage } from "./SupplierImage";
5
5
  @Entity("suppliers")
6
6
  export class Supplier implements ObjectLiteral {
7
7
  @PrimaryGeneratedColumn("increment")
@@ -27,4 +27,9 @@ export class Supplier implements ObjectLiteral {
27
27
 
28
28
  @OneToMany(() => InventoryItem, (inventoryItem) => inventoryItem.supplier)
29
29
  inventoryItems!: InventoryItem[];
30
+
31
+ @OneToMany(() => SupplierImage, (supplierImage) => supplierImage.supplier, {
32
+ cascade: true,
33
+ })
34
+ images!: SupplierImage[];
30
35
  }