proflores-db-model 0.1.30 → 0.1.31

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.
@@ -14,10 +14,6 @@ const typeorm_1 = require("typeorm");
14
14
  const Inventory_1 = require("./Inventory");
15
15
  const BranchImage_1 = require("./BranchImage");
16
16
  let Branch = class Branch {
17
- constructor() {
18
- this.inventory = [];
19
- this.images = [];
20
- }
21
17
  };
22
18
  __decorate([
23
19
  (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
@@ -15,10 +15,6 @@ const CategoryForPlantType_1 = require("./CategoryForPlantType");
15
15
  const ProductImage_1 = require("./ProductImage");
16
16
  const Inventory_1 = require("./Inventory");
17
17
  let Product = class Product {
18
- constructor() {
19
- this.images = [];
20
- this.inventories = [];
21
- }
22
18
  };
23
19
  __decorate([
24
20
  (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",
@@ -5,7 +5,7 @@ import { BranchImage } from "./BranchImage";
5
5
  @Entity("branches")
6
6
  export class Branch implements ObjectLiteral {
7
7
  @PrimaryGeneratedColumn("increment")
8
- idBranch?: number;
8
+ idBranch?: number; // Se genera automáticamente
9
9
 
10
10
  @Column("varchar", { nullable: false, length: 255 })
11
11
  name!: string;
@@ -23,10 +23,10 @@ export class Branch implements ObjectLiteral {
23
23
  city!: string;
24
24
 
25
25
  @OneToMany(() => Inventory, (inventory) => inventory.branch)
26
- inventory: Inventory[] = [];
26
+ inventory!: Inventory[]; // ❌ Se elimina `= []`
27
27
 
28
28
  @OneToMany(() => BranchImage, (branchImage) => branchImage.branch, {
29
29
  cascade: true,
30
30
  })
31
- images: BranchImage[] = [];
31
+ images!: BranchImage[]; // ❌ Se elimina `= []`
32
32
  }
@@ -1,43 +1,42 @@
1
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
- @Entity("products")
15
- export class Product implements ObjectLiteral {
16
- @PrimaryGeneratedColumn("increment")
17
- idProduct?: number;
18
-
19
- @Column("varchar", { nullable: false, length: 255 })
20
- name!: string;
21
-
22
- @Column("varchar", { nullable: false, length: 255 })
23
- secondaryName!: string;
24
-
25
- @Column("text", { nullable: false })
26
- description!: string;
27
-
28
- @ManyToOne(() => CategoryForPlantType, { nullable: true })
29
- @JoinColumn({ name: "categoryForPlantTypeId" })
30
- categoryForPlantType?: CategoryForPlantType | null;
31
-
32
- @OneToMany(() => ProductImage, (productImage) => productImage.product, {
33
- cascade: true,
34
- })
35
- images: ProductImage[] = [];
36
-
37
- @OneToMany(() => Inventory, (inventory) => inventory.product)
38
- inventories: Inventory[] = [];
39
-
40
- @Column("boolean", { default: true })
41
- isActive!: boolean;
42
- }
43
-
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
+ @Entity("products")
15
+ export class Product implements ObjectLiteral {
16
+ @PrimaryGeneratedColumn("increment")
17
+ idProduct?: number; // Se genera automáticamente
18
+
19
+ @Column("varchar", { nullable: false, length: 255 })
20
+ name!: string;
21
+
22
+ @Column("varchar", { nullable: false, length: 255 })
23
+ secondaryName!: string;
24
+
25
+ @Column("text", { nullable: false })
26
+ description!: string;
27
+
28
+ @ManyToOne(() => CategoryForPlantType, { nullable: true })
29
+ @JoinColumn({ name: "categoryForPlantTypeId" })
30
+ categoryForPlantType?: CategoryForPlantType | null;
31
+
32
+ @OneToMany(() => ProductImage, (productImage) => productImage.product, {
33
+ cascade: true,
34
+ })
35
+ images!: ProductImage[];
36
+
37
+ @OneToMany(() => Inventory, (inventory) => inventory.product)
38
+ inventories!: Inventory[];
39
+
40
+ @Column("boolean", { default: true })
41
+ isActive!: boolean;
42
+ }