proflores-db-model 0.1.19 → 0.1.21

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,9 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { TransactionBank } from "./TransactionBank";
3
+ export declare class BankAccount implements ObjectLiteral {
4
+ idBankAccount: number;
5
+ name: string;
6
+ accountNumber: string;
7
+ initialBalance: number;
8
+ transactions: TransactionBank[];
9
+ }
@@ -0,0 +1,40 @@
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.BankAccount = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const TransactionBank_1 = require("./TransactionBank");
15
+ let BankAccount = class BankAccount {
16
+ };
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
+ __metadata("design:type", Number)
20
+ ], BankAccount.prototype, "idBankAccount", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)("varchar", { nullable: false }),
23
+ __metadata("design:type", String)
24
+ ], BankAccount.prototype, "name", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)("varchar", { nullable: false, unique: true }),
27
+ __metadata("design:type", String)
28
+ ], BankAccount.prototype, "accountNumber", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
31
+ __metadata("design:type", Number)
32
+ ], BankAccount.prototype, "initialBalance", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.OneToMany)(() => TransactionBank_1.TransactionBank, (transaction) => transaction.bankAccount),
35
+ __metadata("design:type", Array)
36
+ ], BankAccount.prototype, "transactions", void 0);
37
+ BankAccount = __decorate([
38
+ (0, typeorm_1.Entity)("bank_accounts")
39
+ ], BankAccount);
40
+ exports.BankAccount = BankAccount;
@@ -0,0 +1,9 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { BankAccount } from "./BankAccount";
3
+ export declare class TransactionBank implements ObjectLiteral {
4
+ idTransactionBank: number;
5
+ amount: number;
6
+ type: "INCOME" | "EXPENSE";
7
+ transactionDate: Date;
8
+ bankAccount: BankAccount;
9
+ }
@@ -0,0 +1,42 @@
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.TransactionBank = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BankAccount_1 = require("./BankAccount");
15
+ let TransactionBank = class TransactionBank {
16
+ };
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
19
+ __metadata("design:type", Number)
20
+ ], TransactionBank.prototype, "idTransactionBank", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)("decimal", { nullable: false }),
23
+ __metadata("design:type", Number)
24
+ ], TransactionBank.prototype, "amount", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)("enum", { nullable: false, enum: ["INCOME", "EXPENSE"] }),
27
+ __metadata("design:type", String)
28
+ ], TransactionBank.prototype, "type", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)("date", { nullable: false }),
31
+ __metadata("design:type", Date)
32
+ ], TransactionBank.prototype, "transactionDate", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.ManyToOne)(() => BankAccount_1.BankAccount, (bankAccount) => bankAccount.transactions, {
35
+ onDelete: "CASCADE",
36
+ }),
37
+ __metadata("design:type", BankAccount_1.BankAccount)
38
+ ], TransactionBank.prototype, "bankAccount", void 0);
39
+ TransactionBank = __decorate([
40
+ (0, typeorm_1.Entity)("transactions_bank")
41
+ ], TransactionBank);
42
+ exports.TransactionBank = TransactionBank;
@@ -48,22 +48,22 @@ __decorate([
48
48
  __metadata("design:type", Number)
49
49
  ], InventoryItem.prototype, "quantity", void 0);
50
50
  __decorate([
51
- (0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure, { nullable: false }),
51
+ (0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure),
52
52
  (0, typeorm_1.JoinColumn)({ name: "unitOfMeasureId" }),
53
53
  __metadata("design:type", UnitOfMesure_1.UnitOfMeasure)
54
54
  ], InventoryItem.prototype, "unitOfMeasure", void 0);
55
55
  __decorate([
56
- (0, typeorm_1.ManyToOne)(() => CategoryForCosting_1.CategoryForCosting, { nullable: false }),
56
+ (0, typeorm_1.ManyToOne)(() => CategoryForCosting_1.CategoryForCosting),
57
57
  (0, typeorm_1.JoinColumn)({ name: "categoryForCostingId" }),
58
58
  __metadata("design:type", CategoryForCosting_1.CategoryForCosting)
59
59
  ], InventoryItem.prototype, "categoryForCosting", void 0);
60
60
  __decorate([
61
- (0, typeorm_1.ManyToOne)(() => CategoryForPlantType_1.CategoryForPlantType, { nullable: true }),
61
+ (0, typeorm_1.ManyToOne)(() => CategoryForPlantType_1.CategoryForPlantType),
62
62
  (0, typeorm_1.JoinColumn)({ name: "categoryForPlantTypeId" }),
63
63
  __metadata("design:type", CategoryForPlantType_1.CategoryForPlantType)
64
64
  ], InventoryItem.prototype, "categoryForPlantType", void 0);
65
65
  __decorate([
66
- (0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier, { nullable: true }),
66
+ (0, typeorm_1.ManyToOne)(() => Suppliers_1.Supplier),
67
67
  (0, typeorm_1.JoinColumn)({ name: "supplierId" }),
68
68
  __metadata("design:type", Suppliers_1.Supplier)
69
69
  ], InventoryItem.prototype, "supplier", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
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",
File without changes
@@ -0,0 +1,20 @@
1
+ import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ObjectLiteral } from "typeorm";
2
+ import { TransactionBank } from "./TransactionBank";
3
+
4
+ @Entity("bank_accounts")
5
+ export class BankAccount implements ObjectLiteral {
6
+ @PrimaryGeneratedColumn("increment")
7
+ idBankAccount!: number;
8
+
9
+ @Column("varchar", { nullable: false })
10
+ name!: string;
11
+
12
+ @Column("varchar", { nullable: false, unique: true })
13
+ accountNumber!: string;
14
+
15
+ @Column("decimal", { nullable: false })
16
+ initialBalance!: number;
17
+
18
+ @OneToMany(() => TransactionBank, (transaction) => transaction.bankAccount)
19
+ transactions!: TransactionBank[];
20
+ }
@@ -0,0 +1,29 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ManyToOne,
6
+ ObjectLiteral
7
+ } from "typeorm";
8
+ import { BankAccount } from "./BankAccount";
9
+
10
+ @Entity("transactions_bank")
11
+ export class TransactionBank implements ObjectLiteral {
12
+ @PrimaryGeneratedColumn("increment")
13
+ idTransactionBank!: number;
14
+
15
+ @Column("decimal", { nullable: false })
16
+ amount!: number;
17
+
18
+ @Column("enum", { nullable: false, enum: ["INCOME", "EXPENSE"] })
19
+ type!: "INCOME" | "EXPENSE";
20
+
21
+ @Column("date", { nullable: false })
22
+ transactionDate!: Date;
23
+
24
+ @ManyToOne(() => BankAccount, (bankAccount) => bankAccount.transactions, {
25
+ onDelete: "CASCADE",
26
+ })
27
+ bankAccount!: BankAccount;
28
+ }
29
+
@@ -30,19 +30,19 @@ export class InventoryItem implements ObjectLiteral {
30
30
  @Column("decimal", { nullable: false, default: 0 })
31
31
  quantity!: number;
32
32
 
33
- @ManyToOne(() => UnitOfMeasure, { nullable: false })
33
+ @ManyToOne(() => UnitOfMeasure)
34
34
  @JoinColumn({ name: "unitOfMeasureId" })
35
35
  unitOfMeasure!: UnitOfMeasure;
36
36
 
37
- @ManyToOne(() => CategoryForCosting, { nullable: false })
37
+ @ManyToOne(() => CategoryForCosting)
38
38
  @JoinColumn({ name: "categoryForCostingId" })
39
39
  categoryForCosting!: CategoryForCosting;
40
40
 
41
- @ManyToOne(() => CategoryForPlantType, { nullable: true })
41
+ @ManyToOne(() => CategoryForPlantType)
42
42
  @JoinColumn({ name: "categoryForPlantTypeId" })
43
43
  categoryForPlantType!: CategoryForPlantType;
44
44
 
45
- @ManyToOne(() => Supplier, { nullable: true })
45
+ @ManyToOne(() => Supplier)
46
46
  @JoinColumn({ name: "supplierId" })
47
47
  supplier!: Supplier;
48
48
  }
package/yarn ADDED
File without changes