proflores-db-model 0.2.54 → 0.3.0

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.
Files changed (46) hide show
  1. package/.github/workflows/claude-code-review.yml +57 -0
  2. package/.github/workflows/claude.yml +50 -0
  3. package/dist/entities/Bank/TransactionBank.d.ts +4 -0
  4. package/dist/entities/Bank/TransactionBank.js +14 -0
  5. package/dist/entities/BudgetExpenditure.d.ts +22 -0
  6. package/dist/entities/BudgetExpenditure.js +97 -0
  7. package/dist/entities/BudgetExpenditureDetail.d.ts +17 -0
  8. package/dist/entities/BudgetExpenditureDetail.js +70 -0
  9. package/dist/entities/Expenditure.d.ts +30 -0
  10. package/dist/entities/Expenditure.js +136 -0
  11. package/dist/entities/ExpenditureDetail.d.ts +17 -0
  12. package/dist/entities/ExpenditureDetail.js +70 -0
  13. package/dist/entities/Income.js +1 -1
  14. package/dist/entities/index.d.ts +2 -0
  15. package/dist/entities/index.js +6 -1
  16. package/dist/models/apu/Budget.d.ts +2 -0
  17. package/dist/models/apu/Budget.js +5 -0
  18. package/dist/models/production/CropActivity.d.ts +2 -0
  19. package/dist/models/production/CropActivity.js +5 -0
  20. package/dist/models/production/CropLot.d.ts +2 -0
  21. package/dist/models/production/CropLot.js +5 -0
  22. package/dist/models/production/ProductionExpenditure.d.ts +24 -0
  23. package/dist/models/production/ProductionExpenditure.js +107 -0
  24. package/dist/models/production/ProductionExpenditureDetail.d.ts +17 -0
  25. package/dist/models/production/ProductionExpenditureDetail.js +70 -0
  26. package/dist/types/CostType.d.ts +5 -0
  27. package/dist/types/CostType.js +9 -0
  28. package/dist/types/ExpenditureStatus.d.ts +6 -0
  29. package/dist/types/ExpenditureStatus.js +10 -0
  30. package/dist/types/ExpenditureType.d.ts +5 -0
  31. package/dist/types/ExpenditureType.js +9 -0
  32. package/dist/types/index.d.ts +3 -0
  33. package/dist/types/index.js +9 -1
  34. package/package.json +1 -1
  35. package/src/entities/Bank/TransactionBank.ts +12 -0
  36. package/src/entities/Expenditure.ts +117 -0
  37. package/src/entities/ExpenditureDetail.ts +52 -0
  38. package/src/entities/Income.ts +1 -1
  39. package/src/entities/index.ts +4 -0
  40. package/src/models/apu/Budget.ts +4 -0
  41. package/src/models/production/CropActivity.ts +4 -0
  42. package/src/models/production/CropLot.ts +4 -0
  43. package/src/types/CostType.ts +5 -0
  44. package/src/types/ExpenditureStatus.ts +6 -0
  45. package/src/types/ExpenditureType.ts +5 -0
  46. package/src/types/index.ts +8 -1
@@ -0,0 +1,57 @@
1
+ name: Claude Code Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize]
6
+ # Optional: Only run on specific file changes
7
+ # paths:
8
+ # - "src/**/*.ts"
9
+ # - "src/**/*.tsx"
10
+ # - "src/**/*.js"
11
+ # - "src/**/*.jsx"
12
+
13
+ jobs:
14
+ claude-review:
15
+ # Optional: Filter by PR author
16
+ # if: |
17
+ # github.event.pull_request.user.login == 'external-contributor' ||
18
+ # github.event.pull_request.user.login == 'new-developer' ||
19
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
+
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ pull-requests: read
25
+ issues: read
26
+ id-token: write
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 1
33
+
34
+ - name: Run Claude Code Review
35
+ id: claude-review
36
+ uses: anthropics/claude-code-action@v1
37
+ with:
38
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
+ prompt: |
40
+ REPO: ${{ github.repository }}
41
+ PR NUMBER: ${{ github.event.pull_request.number }}
42
+
43
+ Please review this pull request and provide feedback on:
44
+ - Code quality and best practices
45
+ - Potential bugs or issues
46
+ - Performance considerations
47
+ - Security concerns
48
+ - Test coverage
49
+
50
+ Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
51
+
52
+ Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53
+
54
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55
+ # or https://code.claude.com/docs/en/cli-reference for available options
56
+ claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
57
+
@@ -0,0 +1,50 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@v1
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
+ # prompt: 'Update the pull request description to include a summary of changes.'
45
+
46
+ # Optional: Add claude_args to customize behavior and configuration
47
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
+ # or https://code.claude.com/docs/en/cli-reference for available options
49
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
50
+
@@ -2,6 +2,8 @@ import { ObjectLiteral } from "typeorm";
2
2
  import { BankAccount } from "./BankAccount";
3
3
  import { ExpenseTransaction } from "../ExpenseTransaction";
4
4
  import { Payment } from "../Payment";
5
+ import { Income } from "../Income";
6
+ import { Expenditure } from "../Expenditure";
5
7
  export declare class TransactionBank implements ObjectLiteral {
6
8
  idTransactionBank: number;
7
9
  amount: number;
@@ -10,4 +12,6 @@ export declare class TransactionBank implements ObjectLiteral {
10
12
  bankAccount: BankAccount;
11
13
  expenseTransaction?: ExpenseTransaction;
12
14
  payment?: Payment;
15
+ income?: Income;
16
+ expenditure?: Expenditure;
13
17
  }
@@ -14,6 +14,8 @@ const typeorm_1 = require("typeorm");
14
14
  const BankAccount_1 = require("./BankAccount");
15
15
  const ExpenseTransaction_1 = require("../ExpenseTransaction");
16
16
  const Payment_1 = require("../Payment");
17
+ const Income_1 = require("../Income");
18
+ const Expenditure_1 = require("../Expenditure");
17
19
  let TransactionBank = class TransactionBank {
18
20
  };
19
21
  exports.TransactionBank = TransactionBank;
@@ -53,6 +55,18 @@ __decorate([
53
55
  }),
54
56
  __metadata("design:type", Payment_1.Payment)
55
57
  ], TransactionBank.prototype, "payment", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.OneToOne)(() => Income_1.Income, (income) => income.transactionBank, {
60
+ nullable: true
61
+ }),
62
+ __metadata("design:type", Income_1.Income)
63
+ ], TransactionBank.prototype, "income", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.OneToOne)(() => Expenditure_1.Expenditure, (expenditure) => expenditure.transactionBank, {
66
+ nullable: true
67
+ }),
68
+ __metadata("design:type", Expenditure_1.Expenditure)
69
+ ], TransactionBank.prototype, "expenditure", void 0);
56
70
  exports.TransactionBank = TransactionBank = __decorate([
57
71
  (0, typeorm_1.Entity)("transactions_bank")
58
72
  ], TransactionBank);
@@ -0,0 +1,22 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { Budget } from "../models/apu/Budget";
3
+ import { TransactionBank } from "./Bank/TransactionBank";
4
+ import { ExpenditureStatus } from "../types/ExpenditureStatus";
5
+ import { BudgetExpenditureDetail } from "./BudgetExpenditureDetail";
6
+ export declare class BudgetExpenditure implements ObjectLiteral {
7
+ idBudgetExpenditure: number;
8
+ budget: Budget;
9
+ code?: string | null;
10
+ description: string;
11
+ totalAmount: number;
12
+ expenditureDate: Date;
13
+ status: ExpenditureStatus;
14
+ paymentMethod?: string | null;
15
+ invoiceUuid?: string | null;
16
+ supplierName?: string | null;
17
+ notes?: string | null;
18
+ transactionBank?: TransactionBank | null;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ details?: BudgetExpenditureDetail[];
22
+ }
@@ -0,0 +1,97 @@
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.BudgetExpenditure = 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 ExpenditureStatus_1 = require("../types/ExpenditureStatus");
17
+ const BudgetExpenditureDetail_1 = require("./BudgetExpenditureDetail");
18
+ let BudgetExpenditure = class BudgetExpenditure {
19
+ };
20
+ exports.BudgetExpenditure = BudgetExpenditure;
21
+ __decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
23
+ __metadata("design:type", Number)
24
+ ], BudgetExpenditure.prototype, "idBudgetExpenditure", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Budget_1.Budget, (budget) => budget.expenditures, {
27
+ nullable: false,
28
+ onDelete: "RESTRICT",
29
+ }),
30
+ (0, typeorm_1.JoinColumn)({ name: "idBudget" }),
31
+ __metadata("design:type", Budget_1.Budget)
32
+ ], BudgetExpenditure.prototype, "budget", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)("varchar", { length: 64, nullable: true, unique: true }),
35
+ __metadata("design:type", Object)
36
+ ], BudgetExpenditure.prototype, "code", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
39
+ __metadata("design:type", String)
40
+ ], BudgetExpenditure.prototype, "description", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
43
+ __metadata("design:type", Number)
44
+ ], BudgetExpenditure.prototype, "totalAmount", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)("date", { nullable: false }),
47
+ __metadata("design:type", Date)
48
+ ], BudgetExpenditure.prototype, "expenditureDate", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({
51
+ type: "enum",
52
+ enum: ExpenditureStatus_1.ExpenditureStatus,
53
+ default: ExpenditureStatus_1.ExpenditureStatus.PENDING,
54
+ }),
55
+ __metadata("design:type", String)
56
+ ], BudgetExpenditure.prototype, "status", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)("varchar", { length: 32, nullable: true }),
59
+ __metadata("design:type", Object)
60
+ ], BudgetExpenditure.prototype, "paymentMethod", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
63
+ __metadata("design:type", Object)
64
+ ], BudgetExpenditure.prototype, "invoiceUuid", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
67
+ __metadata("design:type", Object)
68
+ ], BudgetExpenditure.prototype, "supplierName", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)("text", { nullable: true }),
71
+ __metadata("design:type", Object)
72
+ ], BudgetExpenditure.prototype, "notes", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.OneToOne)(() => TransactionBank_1.TransactionBank, { nullable: true, cascade: true }),
75
+ (0, typeorm_1.JoinColumn)({ name: "idTransactionBank" }),
76
+ __metadata("design:type", Object)
77
+ ], BudgetExpenditure.prototype, "transactionBank", void 0);
78
+ __decorate([
79
+ (0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
80
+ __metadata("design:type", Date)
81
+ ], BudgetExpenditure.prototype, "createdAt", void 0);
82
+ __decorate([
83
+ (0, typeorm_1.UpdateDateColumn)({ type: "timestamp" }),
84
+ __metadata("design:type", Date)
85
+ ], BudgetExpenditure.prototype, "updatedAt", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.OneToMany)(() => BudgetExpenditureDetail_1.BudgetExpenditureDetail, (detail) => detail.budgetExpenditure, {
88
+ cascade: true,
89
+ }),
90
+ __metadata("design:type", Array)
91
+ ], BudgetExpenditure.prototype, "details", void 0);
92
+ exports.BudgetExpenditure = BudgetExpenditure = __decorate([
93
+ (0, typeorm_1.Entity)("budget_expenditures"),
94
+ (0, typeorm_1.Index)(["budget"]),
95
+ (0, typeorm_1.Index)(["expenditureDate"]),
96
+ (0, typeorm_1.Index)(["status"])
97
+ ], BudgetExpenditure);
@@ -0,0 +1,17 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { BudgetExpenditure } from "./BudgetExpenditure";
3
+ import { Resource } from "../models/apu/Resource";
4
+ import { Inventory } from "./Inventory";
5
+ import { UnitOfMeasure } from "./UnitOfMesure";
6
+ export declare class BudgetExpenditureDetail implements ObjectLiteral {
7
+ idBudgetExpenditureDetail: number;
8
+ budgetExpenditure: BudgetExpenditure;
9
+ concept: string;
10
+ quantity: number;
11
+ unitOfMeasure?: UnitOfMeasure | null;
12
+ unitPrice: number;
13
+ subtotal: number;
14
+ resource?: Resource | null;
15
+ inventory?: Inventory | null;
16
+ notes?: string | null;
17
+ }
@@ -0,0 +1,70 @@
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.BudgetExpenditureDetail = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BudgetExpenditure_1 = require("./BudgetExpenditure");
15
+ const Resource_1 = require("../models/apu/Resource");
16
+ const Inventory_1 = require("./Inventory");
17
+ const UnitOfMesure_1 = require("./UnitOfMesure");
18
+ let BudgetExpenditureDetail = class BudgetExpenditureDetail {
19
+ };
20
+ exports.BudgetExpenditureDetail = BudgetExpenditureDetail;
21
+ __decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
23
+ __metadata("design:type", Number)
24
+ ], BudgetExpenditureDetail.prototype, "idBudgetExpenditureDetail", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => BudgetExpenditure_1.BudgetExpenditure, (expenditure) => expenditure.details, {
27
+ nullable: false,
28
+ onDelete: "CASCADE",
29
+ }),
30
+ (0, typeorm_1.JoinColumn)({ name: "idBudgetExpenditure" }),
31
+ __metadata("design:type", BudgetExpenditure_1.BudgetExpenditure)
32
+ ], BudgetExpenditureDetail.prototype, "budgetExpenditure", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
35
+ __metadata("design:type", String)
36
+ ], BudgetExpenditureDetail.prototype, "concept", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)("decimal", { precision: 12, scale: 4, nullable: false, default: 1 }),
39
+ __metadata("design:type", Number)
40
+ ], BudgetExpenditureDetail.prototype, "quantity", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure, { nullable: true, onDelete: "SET NULL" }),
43
+ (0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
44
+ __metadata("design:type", Object)
45
+ ], BudgetExpenditureDetail.prototype, "unitOfMeasure", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)("decimal", { precision: 14, scale: 4, nullable: false }),
48
+ __metadata("design:type", Number)
49
+ ], BudgetExpenditureDetail.prototype, "unitPrice", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
52
+ __metadata("design:type", Number)
53
+ ], BudgetExpenditureDetail.prototype, "subtotal", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.ManyToOne)(() => Resource_1.Resource, { nullable: true, onDelete: "SET NULL" }),
56
+ (0, typeorm_1.JoinColumn)({ name: "idResource" }),
57
+ __metadata("design:type", Object)
58
+ ], BudgetExpenditureDetail.prototype, "resource", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.ManyToOne)(() => Inventory_1.Inventory, { nullable: true, onDelete: "SET NULL" }),
61
+ (0, typeorm_1.JoinColumn)({ name: "idInventory" }),
62
+ __metadata("design:type", Object)
63
+ ], BudgetExpenditureDetail.prototype, "inventory", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)("text", { nullable: true }),
66
+ __metadata("design:type", Object)
67
+ ], BudgetExpenditureDetail.prototype, "notes", void 0);
68
+ exports.BudgetExpenditureDetail = BudgetExpenditureDetail = __decorate([
69
+ (0, typeorm_1.Entity)("budget_expenditure_details")
70
+ ], BudgetExpenditureDetail);
@@ -0,0 +1,30 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { Budget } from "../models/apu/Budget";
3
+ import { CropLot } from "../models/production/CropLot";
4
+ import { CropActivity } from "../models/production/CropActivity";
5
+ import { TransactionBank } from "./Bank/TransactionBank";
6
+ import { ExpenditureType } from "../types/ExpenditureType";
7
+ import { ExpenditureStatus } from "../types/ExpenditureStatus";
8
+ import { CostType } from "../types/CostType";
9
+ import { ExpenditureDetail } from "./ExpenditureDetail";
10
+ export declare class Expenditure implements ObjectLiteral {
11
+ idExpenditure: number;
12
+ expenditureType: ExpenditureType;
13
+ code?: string | null;
14
+ description: string;
15
+ totalAmount: number;
16
+ expenditureDate: Date;
17
+ status: ExpenditureStatus;
18
+ costType: CostType;
19
+ budget?: Budget | null;
20
+ cropLot?: CropLot | null;
21
+ cropActivity?: CropActivity | null;
22
+ paymentMethod?: string | null;
23
+ invoiceUuid?: string | null;
24
+ supplierName?: string | null;
25
+ notes?: string | null;
26
+ transactionBank?: TransactionBank | null;
27
+ createdAt: Date;
28
+ updatedAt: Date;
29
+ details?: ExpenditureDetail[];
30
+ }
@@ -0,0 +1,136 @@
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.Expenditure = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Budget_1 = require("../models/apu/Budget");
15
+ const CropLot_1 = require("../models/production/CropLot");
16
+ const CropActivity_1 = require("../models/production/CropActivity");
17
+ const TransactionBank_1 = require("./Bank/TransactionBank");
18
+ const ExpenditureType_1 = require("../types/ExpenditureType");
19
+ const ExpenditureStatus_1 = require("../types/ExpenditureStatus");
20
+ const CostType_1 = require("../types/CostType");
21
+ const ExpenditureDetail_1 = require("./ExpenditureDetail");
22
+ let Expenditure = class Expenditure {
23
+ };
24
+ exports.Expenditure = Expenditure;
25
+ __decorate([
26
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
27
+ __metadata("design:type", Number)
28
+ ], Expenditure.prototype, "idExpenditure", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({
31
+ type: "enum",
32
+ enum: ExpenditureType_1.ExpenditureType,
33
+ default: ExpenditureType_1.ExpenditureType.OTHER,
34
+ }),
35
+ __metadata("design:type", String)
36
+ ], Expenditure.prototype, "expenditureType", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)("varchar", { length: 64, nullable: true, unique: true }),
39
+ __metadata("design:type", Object)
40
+ ], Expenditure.prototype, "code", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
43
+ __metadata("design:type", String)
44
+ ], Expenditure.prototype, "description", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
47
+ __metadata("design:type", Number)
48
+ ], Expenditure.prototype, "totalAmount", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)("date", { nullable: false }),
51
+ __metadata("design:type", Date)
52
+ ], Expenditure.prototype, "expenditureDate", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({
55
+ type: "enum",
56
+ enum: ExpenditureStatus_1.ExpenditureStatus,
57
+ default: ExpenditureStatus_1.ExpenditureStatus.PENDING,
58
+ }),
59
+ __metadata("design:type", String)
60
+ ], Expenditure.prototype, "status", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({
63
+ type: "enum",
64
+ enum: CostType_1.CostType,
65
+ default: CostType_1.CostType.DIRECT,
66
+ }),
67
+ __metadata("design:type", String)
68
+ ], Expenditure.prototype, "costType", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.ManyToOne)(() => Budget_1.Budget, (budget) => budget.expenditures, {
71
+ nullable: true,
72
+ onDelete: "SET NULL",
73
+ }),
74
+ (0, typeorm_1.JoinColumn)({ name: "idBudget" }),
75
+ __metadata("design:type", Object)
76
+ ], Expenditure.prototype, "budget", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.ManyToOne)(() => CropLot_1.CropLot, (cropLot) => cropLot.expenditures, {
79
+ nullable: true,
80
+ onDelete: "SET NULL",
81
+ }),
82
+ (0, typeorm_1.JoinColumn)({ name: "idCropLot" }),
83
+ __metadata("design:type", Object)
84
+ ], Expenditure.prototype, "cropLot", void 0);
85
+ __decorate([
86
+ (0, typeorm_1.ManyToOne)(() => CropActivity_1.CropActivity, (activity) => activity.expenditures, {
87
+ nullable: true,
88
+ onDelete: "SET NULL",
89
+ }),
90
+ (0, typeorm_1.JoinColumn)({ name: "idCropActivity" }),
91
+ __metadata("design:type", Object)
92
+ ], Expenditure.prototype, "cropActivity", void 0);
93
+ __decorate([
94
+ (0, typeorm_1.Column)("varchar", { length: 32, nullable: true }),
95
+ __metadata("design:type", Object)
96
+ ], Expenditure.prototype, "paymentMethod", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
99
+ __metadata("design:type", Object)
100
+ ], Expenditure.prototype, "invoiceUuid", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
103
+ __metadata("design:type", Object)
104
+ ], Expenditure.prototype, "supplierName", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)("text", { nullable: true }),
107
+ __metadata("design:type", Object)
108
+ ], Expenditure.prototype, "notes", void 0);
109
+ __decorate([
110
+ (0, typeorm_1.OneToOne)(() => TransactionBank_1.TransactionBank, (tb) => tb.expenditure, { nullable: true, cascade: true }),
111
+ (0, typeorm_1.JoinColumn)({ name: "idTransactionBank" }),
112
+ __metadata("design:type", Object)
113
+ ], Expenditure.prototype, "transactionBank", void 0);
114
+ __decorate([
115
+ (0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
116
+ __metadata("design:type", Date)
117
+ ], Expenditure.prototype, "createdAt", void 0);
118
+ __decorate([
119
+ (0, typeorm_1.UpdateDateColumn)({ type: "timestamp" }),
120
+ __metadata("design:type", Date)
121
+ ], Expenditure.prototype, "updatedAt", void 0);
122
+ __decorate([
123
+ (0, typeorm_1.OneToMany)(() => ExpenditureDetail_1.ExpenditureDetail, (detail) => detail.expenditure, {
124
+ cascade: true,
125
+ }),
126
+ __metadata("design:type", Array)
127
+ ], Expenditure.prototype, "details", void 0);
128
+ exports.Expenditure = Expenditure = __decorate([
129
+ (0, typeorm_1.Entity)("expenditures"),
130
+ (0, typeorm_1.Index)(["expenditureType"]),
131
+ (0, typeorm_1.Index)(["expenditureDate"]),
132
+ (0, typeorm_1.Index)(["status"]),
133
+ (0, typeorm_1.Index)(["costType"]),
134
+ (0, typeorm_1.Index)(["budget"]),
135
+ (0, typeorm_1.Index)(["cropLot"])
136
+ ], Expenditure);
@@ -0,0 +1,17 @@
1
+ import { ObjectLiteral } from "typeorm";
2
+ import { Expenditure } from "./Expenditure";
3
+ import { Resource } from "../models/apu/Resource";
4
+ import { Inventory } from "./Inventory";
5
+ import { UnitOfMeasure } from "./UnitOfMesure";
6
+ export declare class ExpenditureDetail implements ObjectLiteral {
7
+ idExpenditureDetail: number;
8
+ expenditure: Expenditure;
9
+ concept: string;
10
+ quantity: number;
11
+ unitOfMeasure?: UnitOfMeasure | null;
12
+ unitPrice: number;
13
+ subtotal: number;
14
+ resource?: Resource | null;
15
+ inventory?: Inventory | null;
16
+ notes?: string | null;
17
+ }
@@ -0,0 +1,70 @@
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.ExpenditureDetail = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Expenditure_1 = require("./Expenditure");
15
+ const Resource_1 = require("../models/apu/Resource");
16
+ const Inventory_1 = require("./Inventory");
17
+ const UnitOfMesure_1 = require("./UnitOfMesure");
18
+ let ExpenditureDetail = class ExpenditureDetail {
19
+ };
20
+ exports.ExpenditureDetail = ExpenditureDetail;
21
+ __decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)("increment"),
23
+ __metadata("design:type", Number)
24
+ ], ExpenditureDetail.prototype, "idExpenditureDetail", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Expenditure_1.Expenditure, (expenditure) => expenditure.details, {
27
+ nullable: false,
28
+ onDelete: "CASCADE",
29
+ }),
30
+ (0, typeorm_1.JoinColumn)({ name: "idExpenditure" }),
31
+ __metadata("design:type", Expenditure_1.Expenditure)
32
+ ], ExpenditureDetail.prototype, "expenditure", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
35
+ __metadata("design:type", String)
36
+ ], ExpenditureDetail.prototype, "concept", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)("decimal", { precision: 12, scale: 4, nullable: false, default: 1 }),
39
+ __metadata("design:type", Number)
40
+ ], ExpenditureDetail.prototype, "quantity", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.ManyToOne)(() => UnitOfMesure_1.UnitOfMeasure, { nullable: true, onDelete: "SET NULL" }),
43
+ (0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
44
+ __metadata("design:type", Object)
45
+ ], ExpenditureDetail.prototype, "unitOfMeasure", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)("decimal", { precision: 14, scale: 4, nullable: false }),
48
+ __metadata("design:type", Number)
49
+ ], ExpenditureDetail.prototype, "unitPrice", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
52
+ __metadata("design:type", Number)
53
+ ], ExpenditureDetail.prototype, "subtotal", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.ManyToOne)(() => Resource_1.Resource, { nullable: true, onDelete: "SET NULL" }),
56
+ (0, typeorm_1.JoinColumn)({ name: "idResource" }),
57
+ __metadata("design:type", Object)
58
+ ], ExpenditureDetail.prototype, "resource", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.ManyToOne)(() => Inventory_1.Inventory, { nullable: true, onDelete: "SET NULL" }),
61
+ (0, typeorm_1.JoinColumn)({ name: "idInventory" }),
62
+ __metadata("design:type", Object)
63
+ ], ExpenditureDetail.prototype, "inventory", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)("text", { nullable: true }),
66
+ __metadata("design:type", Object)
67
+ ], ExpenditureDetail.prototype, "notes", void 0);
68
+ exports.ExpenditureDetail = ExpenditureDetail = __decorate([
69
+ (0, typeorm_1.Entity)("expenditure_details")
70
+ ], ExpenditureDetail);
@@ -95,7 +95,7 @@ __decorate([
95
95
  __metadata("design:type", Object)
96
96
  ], Income.prototype, "invoiceUuid", void 0);
97
97
  __decorate([
98
- (0, typeorm_1.OneToOne)(() => TransactionBank_1.TransactionBank, { nullable: true, cascade: true }),
98
+ (0, typeorm_1.OneToOne)(() => TransactionBank_1.TransactionBank, (tb) => tb.income, { nullable: true, cascade: true }),
99
99
  (0, typeorm_1.JoinColumn)({ name: "idTransactionBank" }),
100
100
  __metadata("design:type", Object)
101
101
  ], Income.prototype, "transactionBank", void 0);
@@ -19,6 +19,8 @@ export { ExpenseType } from "./ExpenseType";
19
19
  export { Payment } from "./Payment";
20
20
  export { PaymentCfdi } from "./PaymentCfdi";
21
21
  export { Income } from "./Income";
22
+ export { Expenditure } from "./Expenditure";
23
+ export { ExpenditureDetail } from "./ExpenditureDetail";
22
24
  export { ProjectOrder } from "./ProjectOrder";
23
25
  export { UnitOfMeasure } from "./UnitOfMesure";
24
26
  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.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.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; } });
@@ -51,6 +51,11 @@ Object.defineProperty(exports, "PaymentCfdi", { enumerable: true, get: function
51
51
  // Income
52
52
  var Income_1 = require("./Income");
53
53
  Object.defineProperty(exports, "Income", { enumerable: true, get: function () { return Income_1.Income; } });
54
+ // Expenditures
55
+ var Expenditure_1 = require("./Expenditure");
56
+ Object.defineProperty(exports, "Expenditure", { enumerable: true, get: function () { return Expenditure_1.Expenditure; } });
57
+ var ExpenditureDetail_1 = require("./ExpenditureDetail");
58
+ Object.defineProperty(exports, "ExpenditureDetail", { enumerable: true, get: function () { return ExpenditureDetail_1.ExpenditureDetail; } });
54
59
  // Others
55
60
  var ProjectOrder_1 = require("./ProjectOrder");
56
61
  Object.defineProperty(exports, "ProjectOrder", { enumerable: true, get: function () { return ProjectOrder_1.ProjectOrder; } });