proflores-db-model 0.3.1 → 0.3.3

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.
@@ -4,6 +4,7 @@ import { ExpenseTransaction } from "../ExpenseTransaction";
4
4
  import { Payment } from "../Payment";
5
5
  import { Income } from "../Income";
6
6
  import { Expenditure } from "../Expenditure";
7
+ import { Dividend } from "../Dividend";
7
8
  export declare class TransactionBank implements ObjectLiteral {
8
9
  idTransactionBank: number;
9
10
  amount: number;
@@ -14,4 +15,5 @@ export declare class TransactionBank implements ObjectLiteral {
14
15
  payment?: Payment;
15
16
  income?: Income;
16
17
  expenditure?: Expenditure;
18
+ dividend?: Dividend;
17
19
  }
@@ -16,6 +16,7 @@ const ExpenseTransaction_1 = require("../ExpenseTransaction");
16
16
  const Payment_1 = require("../Payment");
17
17
  const Income_1 = require("../Income");
18
18
  const Expenditure_1 = require("../Expenditure");
19
+ const Dividend_1 = require("../Dividend");
19
20
  let TransactionBank = class TransactionBank {
20
21
  };
21
22
  exports.TransactionBank = TransactionBank;
@@ -67,6 +68,12 @@ __decorate([
67
68
  }),
68
69
  __metadata("design:type", Expenditure_1.Expenditure)
69
70
  ], TransactionBank.prototype, "expenditure", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.OneToOne)(() => Dividend_1.Dividend, (dividend) => dividend.transactionBank, {
73
+ nullable: true
74
+ }),
75
+ __metadata("design:type", Dividend_1.Dividend)
76
+ ], TransactionBank.prototype, "dividend", void 0);
70
77
  exports.TransactionBank = TransactionBank = __decorate([
71
78
  (0, typeorm_1.Entity)("transactions_bank")
72
79
  ], TransactionBank);
@@ -0,0 +1,20 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { Budget } from "../models/apu/Budget";
3
+ import { TransactionBank } from "./Bank/TransactionBank";
4
+ import { DividendStatus } from "../types/DividendStatus";
5
+ export declare class Dividend implements ObjectLiteral {
6
+ idDividend: number;
7
+ beneficiaryName: string;
8
+ beneficiaryTaxId?: string | null;
9
+ amount: number;
10
+ paymentDate: Date;
11
+ status: DividendStatus;
12
+ fiscalYear?: string | null;
13
+ paymentMethod?: string | null;
14
+ invoiceUuid?: string | null;
15
+ budget?: Budget | null;
16
+ notes?: string | null;
17
+ transactionBank?: TransactionBank | null;
18
+ createdAt: Date;
19
+ updatedAt: Date;
20
+ }
@@ -0,0 +1,90 @@
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.Dividend = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Budget_1 = require("../models/apu/Budget");
15
+ const TransactionBank_1 = require("./Bank/TransactionBank");
16
+ const DividendStatus_1 = require("../types/DividendStatus");
17
+ let Dividend = class Dividend {
18
+ };
19
+ exports.Dividend = Dividend;
20
+ __decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
22
+ __metadata("design:type", Number)
23
+ ], Dividend.prototype, "idDividend", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
26
+ __metadata("design:type", String)
27
+ ], Dividend.prototype, "beneficiaryName", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
30
+ __metadata("design:type", Object)
31
+ ], Dividend.prototype, "beneficiaryTaxId", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
34
+ __metadata("design:type", Number)
35
+ ], Dividend.prototype, "amount", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)("date", { nullable: false }),
38
+ __metadata("design:type", Date)
39
+ ], Dividend.prototype, "paymentDate", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({
42
+ type: "enum",
43
+ enum: DividendStatus_1.DividendStatus,
44
+ default: DividendStatus_1.DividendStatus.PENDING,
45
+ }),
46
+ __metadata("design:type", String)
47
+ ], Dividend.prototype, "status", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
50
+ __metadata("design:type", Object)
51
+ ], Dividend.prototype, "fiscalYear", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)("varchar", { length: 32, nullable: true }),
54
+ __metadata("design:type", Object)
55
+ ], Dividend.prototype, "paymentMethod", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
58
+ __metadata("design:type", Object)
59
+ ], Dividend.prototype, "invoiceUuid", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.ManyToOne)(() => Budget_1.Budget, (budget) => budget.dividends, {
62
+ nullable: true,
63
+ onDelete: "SET NULL",
64
+ }),
65
+ (0, typeorm_1.JoinColumn)({ name: "idBudget" }),
66
+ __metadata("design:type", Object)
67
+ ], Dividend.prototype, "budget", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)("text", { nullable: true }),
70
+ __metadata("design:type", Object)
71
+ ], Dividend.prototype, "notes", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.OneToOne)(() => TransactionBank_1.TransactionBank, (tb) => tb.dividend, { nullable: true, cascade: true }),
74
+ (0, typeorm_1.JoinColumn)({ name: "idTransactionBank" }),
75
+ __metadata("design:type", Object)
76
+ ], Dividend.prototype, "transactionBank", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
79
+ __metadata("design:type", Date)
80
+ ], Dividend.prototype, "createdAt", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.UpdateDateColumn)({ type: "timestamp" }),
83
+ __metadata("design:type", Date)
84
+ ], Dividend.prototype, "updatedAt", void 0);
85
+ exports.Dividend = Dividend = __decorate([
86
+ (0, typeorm_1.Entity)("dividends"),
87
+ (0, typeorm_1.Index)(["paymentDate"]),
88
+ (0, typeorm_1.Index)(["status"]),
89
+ (0, typeorm_1.Index)(["budget"])
90
+ ], Dividend);
@@ -21,6 +21,7 @@ export { PaymentCfdi } from "./PaymentCfdi";
21
21
  export { Income } from "./Income";
22
22
  export { Expenditure } from "./Expenditure";
23
23
  export { ExpenditureDetail } from "./ExpenditureDetail";
24
+ export { Dividend } from "./Dividend";
24
25
  export { ProjectOrder } from "./ProjectOrder";
25
26
  export { UnitOfMeasure } from "./UnitOfMesure";
26
27
  export { User } from "./User";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.User = exports.UnitOfMeasure = exports.ProjectOrder = exports.ExpenditureDetail = exports.Expenditure = exports.Income = exports.PaymentCfdi = exports.Payment = exports.ExpenseType = exports.ExpenseTransaction = exports.ExpenseDetail = exports.SupplierImage = exports.Supplier = exports.ContainerType = exports.InventoryMovement = exports.InventoryImage = exports.InventoryItem = exports.Inventory = exports.ProductImage = exports.Product = exports.BranchImage = exports.Branch = exports.CategoryForPlantType = exports.CategoryForCosting = exports.TransactionBank = exports.BankAccount = void 0;
3
+ exports.User = exports.UnitOfMeasure = exports.ProjectOrder = exports.Dividend = exports.ExpenditureDetail = exports.Expenditure = exports.Income = exports.PaymentCfdi = exports.Payment = exports.ExpenseType = exports.ExpenseTransaction = exports.ExpenseDetail = exports.SupplierImage = exports.Supplier = exports.ContainerType = exports.InventoryMovement = exports.InventoryImage = exports.InventoryItem = exports.Inventory = exports.ProductImage = exports.Product = exports.BranchImage = exports.Branch = exports.CategoryForPlantType = exports.CategoryForCosting = exports.TransactionBank = exports.BankAccount = void 0;
4
4
  // Bank
5
5
  var BankAccount_1 = require("./Bank/BankAccount");
6
6
  Object.defineProperty(exports, "BankAccount", { enumerable: true, get: function () { return BankAccount_1.BankAccount; } });
@@ -56,6 +56,9 @@ var Expenditure_1 = require("./Expenditure");
56
56
  Object.defineProperty(exports, "Expenditure", { enumerable: true, get: function () { return Expenditure_1.Expenditure; } });
57
57
  var ExpenditureDetail_1 = require("./ExpenditureDetail");
58
58
  Object.defineProperty(exports, "ExpenditureDetail", { enumerable: true, get: function () { return ExpenditureDetail_1.ExpenditureDetail; } });
59
+ // Dividends
60
+ var Dividend_1 = require("./Dividend");
61
+ Object.defineProperty(exports, "Dividend", { enumerable: true, get: function () { return Dividend_1.Dividend; } });
59
62
  // Others
60
63
  var ProjectOrder_1 = require("./ProjectOrder");
61
64
  Object.defineProperty(exports, "ProjectOrder", { enumerable: true, get: function () { return ProjectOrder_1.ProjectOrder; } });
@@ -6,6 +6,7 @@ import { Payment } from "../../entities/Payment";
6
6
  import { ExpenseTransaction } from "../../entities/ExpenseTransaction";
7
7
  import { Income } from "../../entities/Income";
8
8
  import { Expenditure } from "../../entities/Expenditure";
9
+ import { Dividend } from "../../entities/Dividend";
9
10
  export declare class Budget implements ObjectLiteral {
10
11
  idBudget: number;
11
12
  project: Project;
@@ -25,4 +26,5 @@ export declare class Budget implements ObjectLiteral {
25
26
  expenses?: ExpenseTransaction[];
26
27
  incomes?: Income[];
27
28
  expenditures?: Expenditure[];
29
+ dividends?: Dividend[];
28
30
  }
@@ -19,6 +19,7 @@ const Payment_1 = require("../../entities/Payment");
19
19
  const ExpenseTransaction_1 = require("../../entities/ExpenseTransaction");
20
20
  const Income_1 = require("../../entities/Income");
21
21
  const Expenditure_1 = require("../../entities/Expenditure");
22
+ const Dividend_1 = require("../../entities/Dividend");
22
23
  let Budget = class Budget {
23
24
  };
24
25
  exports.Budget = Budget;
@@ -95,6 +96,10 @@ __decorate([
95
96
  (0, typeorm_1.OneToMany)(() => Expenditure_1.Expenditure, (expenditure) => expenditure.budget),
96
97
  __metadata("design:type", Array)
97
98
  ], Budget.prototype, "expenditures", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.OneToMany)(() => Dividend_1.Dividend, (dividend) => dividend.budget),
101
+ __metadata("design:type", Array)
102
+ ], Budget.prototype, "dividends", void 0);
98
103
  exports.Budget = Budget = __decorate([
99
104
  (0, typeorm_1.Entity)("budgets"),
100
105
  (0, typeorm_1.Index)(["project"])
@@ -0,0 +1,5 @@
1
+ export declare enum DividendStatus {
2
+ PENDING = "PENDING",
3
+ PAID = "PAID",
4
+ CANCELLED = "CANCELLED"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DividendStatus = void 0;
4
+ var DividendStatus;
5
+ (function (DividendStatus) {
6
+ DividendStatus["PENDING"] = "PENDING";
7
+ DividendStatus["PAID"] = "PAID";
8
+ DividendStatus["CANCELLED"] = "CANCELLED";
9
+ })(DividendStatus || (exports.DividendStatus = DividendStatus = {}));
@@ -12,3 +12,4 @@ export { IncomeStatus } from "./IncomeStatus";
12
12
  export { ExpenditureType } from "./ExpenditureType";
13
13
  export { ExpenditureStatus } from "./ExpenditureStatus";
14
14
  export { CostType } from "./CostType";
15
+ export { DividendStatus } from "./DividendStatus";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CostType = exports.ExpenditureStatus = exports.ExpenditureType = exports.IncomeStatus = exports.IncomeType = exports.QualityGrade = exports.CropActivityType = exports.GrowthStage = exports.CropLotStatus = exports.MovementType = void 0;
3
+ exports.DividendStatus = exports.CostType = exports.ExpenditureStatus = exports.ExpenditureType = exports.IncomeStatus = exports.IncomeType = exports.QualityGrade = exports.CropActivityType = exports.GrowthStage = exports.CropLotStatus = exports.MovementType = void 0;
4
4
  var MovementType_1 = require("./MovementType");
5
5
  Object.defineProperty(exports, "MovementType", { enumerable: true, get: function () { return MovementType_1.MovementType; } });
6
6
  // Production enums
@@ -25,3 +25,6 @@ Object.defineProperty(exports, "ExpenditureStatus", { enumerable: true, get: fun
25
25
  // Cost enums
26
26
  var CostType_1 = require("./CostType");
27
27
  Object.defineProperty(exports, "CostType", { enumerable: true, get: function () { return CostType_1.CostType; } });
28
+ // Dividend enums
29
+ var DividendStatus_1 = require("./DividendStatus");
30
+ Object.defineProperty(exports, "DividendStatus", { enumerable: true, get: function () { return DividendStatus_1.DividendStatus; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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",
@@ -12,6 +12,7 @@ import {
12
12
  import { Payment } from "../Payment";
13
13
  import { Income } from "../Income";
14
14
  import { Expenditure } from "../Expenditure";
15
+ import { Dividend } from "../Dividend";
15
16
 
16
17
  @Entity("transactions_bank")
17
18
  export class TransactionBank implements ObjectLiteral {
@@ -52,5 +53,10 @@ import {
52
53
  nullable: true
53
54
  })
54
55
  expenditure?: Expenditure;
56
+
57
+ @OneToOne(() => Dividend, (dividend) => dividend.transactionBank, {
58
+ nullable: true
59
+ })
60
+ dividend?: Dividend;
55
61
  }
56
62
 
@@ -0,0 +1,72 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ManyToOne,
6
+ OneToOne,
7
+ JoinColumn,
8
+ ObjectLiteral,
9
+ Index,
10
+ CreateDateColumn,
11
+ UpdateDateColumn,
12
+ } from "typeorm";
13
+ import { Budget } from "../models/apu/Budget";
14
+ import { TransactionBank } from "./Bank/TransactionBank";
15
+ import { DividendStatus } from "../types/DividendStatus";
16
+
17
+ @Entity("dividends")
18
+ @Index(["paymentDate"])
19
+ @Index(["status"])
20
+ @Index(["budget"])
21
+ export class Dividend implements ObjectLiteral {
22
+ @PrimaryGeneratedColumn("increment")
23
+ idDividend!: number;
24
+
25
+ @Column("varchar", { length: 255, nullable: false })
26
+ beneficiaryName!: string;
27
+
28
+ @Column("varchar", { length: 255, nullable: true })
29
+ beneficiaryTaxId?: string | null;
30
+
31
+ @Column("decimal", { precision: 14, scale: 2, nullable: false })
32
+ amount!: number;
33
+
34
+ @Column("date", { nullable: false })
35
+ paymentDate!: Date;
36
+
37
+ @Column({
38
+ type: "enum",
39
+ enum: DividendStatus,
40
+ default: DividendStatus.PENDING,
41
+ })
42
+ status!: DividendStatus;
43
+
44
+ @Column("varchar", { length: 255, nullable: true })
45
+ fiscalYear?: string | null;
46
+
47
+ @Column("varchar", { length: 32, nullable: true })
48
+ paymentMethod?: string | null;
49
+
50
+ @Column("varchar", { length: 255, nullable: true })
51
+ invoiceUuid?: string | null;
52
+
53
+ @ManyToOne(() => Budget, (budget) => budget.dividends, {
54
+ nullable: true,
55
+ onDelete: "SET NULL",
56
+ })
57
+ @JoinColumn({ name: "idBudget" })
58
+ budget?: Budget | null;
59
+
60
+ @Column("text", { nullable: true })
61
+ notes?: string | null;
62
+
63
+ @OneToOne(() => TransactionBank, (tb) => tb.dividend, { nullable: true, cascade: true })
64
+ @JoinColumn({ name: "idTransactionBank" })
65
+ transactionBank?: TransactionBank | null;
66
+
67
+ @CreateDateColumn({ type: "timestamp" })
68
+ createdAt!: Date;
69
+
70
+ @UpdateDateColumn({ type: "timestamp" })
71
+ updatedAt!: Date;
72
+ }
@@ -39,6 +39,9 @@ export { Income } from "./Income";
39
39
  export { Expenditure } from "./Expenditure";
40
40
  export { ExpenditureDetail } from "./ExpenditureDetail";
41
41
 
42
+ // Dividends
43
+ export { Dividend } from "./Dividend";
44
+
42
45
  // Others
43
46
  export { ProjectOrder } from "./ProjectOrder";
44
47
  export { UnitOfMeasure } from "./UnitOfMesure";
@@ -9,6 +9,7 @@ import { Payment } from "../../entities/Payment";
9
9
  import { ExpenseTransaction } from "../../entities/ExpenseTransaction";
10
10
  import { Income } from "../../entities/Income";
11
11
  import { Expenditure } from "../../entities/Expenditure";
12
+ import { Dividend } from "../../entities/Dividend";
12
13
 
13
14
  @Entity("budgets")
14
15
  @Index(["project"])
@@ -67,4 +68,7 @@ export class Budget implements ObjectLiteral {
67
68
 
68
69
  @OneToMany(() => Expenditure, (expenditure) => expenditure.budget)
69
70
  expenditures?: Expenditure[];
71
+
72
+ @OneToMany(() => Dividend, (dividend) => dividend.budget)
73
+ dividends?: Dividend[];
70
74
  }
@@ -0,0 +1,5 @@
1
+ export enum DividendStatus {
2
+ PENDING = "PENDING",
3
+ PAID = "PAID",
4
+ CANCELLED = "CANCELLED",
5
+ }
@@ -19,4 +19,7 @@ export { ExpenditureType } from "./ExpenditureType";
19
19
  export { ExpenditureStatus } from "./ExpenditureStatus";
20
20
 
21
21
  // Cost enums
22
- export { CostType } from "./CostType";
22
+ export { CostType } from "./CostType";
23
+
24
+ // Dividend enums
25
+ export { DividendStatus } from "./DividendStatus";