proflores-db-model 0.1.31 → 0.1.32
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/dist/entities/BranchImage.d.ts +1 -1
- package/dist/entities/BranchImage.js +1 -1
- package/dist/entities/Inventory.d.ts +5 -2
- package/dist/entities/Inventory.js +13 -2
- package/dist/entities/InventoryImage.d.ts +6 -0
- package/dist/entities/InventoryImage.js +36 -0
- package/dist/entities/Products.d.ts +2 -2
- package/dist/entities/Products.js +2 -2
- package/package.json +1 -1
- package/src/entities/BranchImage.ts +1 -1
- package/src/entities/Inventory.ts +61 -44
- package/src/entities/InventoryImage.ts +21 -0
- package/src/entities/Products.ts +4 -4
|
@@ -27,7 +27,7 @@ __decorate([
|
|
|
27
27
|
onDelete: "CASCADE",
|
|
28
28
|
}),
|
|
29
29
|
(0, typeorm_1.JoinColumn)({ name: "branchId" }),
|
|
30
|
-
__metadata("design:type",
|
|
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",
|
|
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",
|
|
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,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",
|
|
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",
|
|
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/package.json
CHANGED
|
@@ -1,44 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
+
|
package/src/entities/Products.ts
CHANGED
|
@@ -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;
|
|
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;
|