proflores-db-model 0.2.51 → 0.2.53

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 (72) hide show
  1. package/dist/entities/ExpenseDetail.d.ts +6 -0
  2. package/dist/entities/ExpenseDetail.js +19 -1
  3. package/dist/entities/ExpenseTransaction.d.ts +2 -0
  4. package/dist/entities/ExpenseTransaction.js +11 -1
  5. package/dist/entities/Income.d.ts +29 -0
  6. package/dist/entities/Income.js +121 -0
  7. package/dist/entities/InventoryMovement.d.ts +2 -0
  8. package/dist/entities/InventoryMovement.js +7 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +4 -1
  11. package/dist/models/apu/Budget.d.ts +4 -0
  12. package/dist/models/apu/Budget.js +10 -0
  13. package/dist/models/apu/budget-snapshot.entity.js +1 -0
  14. package/dist/models/production/CropActivity.d.ts +20 -0
  15. package/dist/models/production/CropActivity.js +85 -0
  16. package/dist/models/production/CropExpense.d.ts +22 -0
  17. package/dist/models/production/CropExpense.js +93 -0
  18. package/dist/models/production/CropLot.d.ts +33 -0
  19. package/dist/models/production/CropLot.js +132 -0
  20. package/dist/models/production/CropStage.d.ts +13 -0
  21. package/dist/models/production/CropStage.js +58 -0
  22. package/dist/models/production/CropStageImage.d.ts +9 -0
  23. package/dist/models/production/CropStageImage.js +44 -0
  24. package/dist/models/production/GrowthArea.d.ts +13 -0
  25. package/dist/models/production/GrowthArea.js +55 -0
  26. package/dist/models/production/Harvest.d.ts +16 -0
  27. package/dist/models/production/Harvest.js +70 -0
  28. package/dist/models/production/ProductionSeason.d.ts +11 -0
  29. package/dist/models/production/ProductionSeason.js +49 -0
  30. package/dist/models/production/index.d.ts +8 -0
  31. package/dist/models/production/index.js +20 -0
  32. package/dist/types/CropActivityType.d.ts +12 -0
  33. package/dist/types/CropActivityType.js +16 -0
  34. package/dist/types/CropLotStatus.d.ts +10 -0
  35. package/dist/types/CropLotStatus.js +14 -0
  36. package/dist/types/GrowthStage.d.ts +10 -0
  37. package/dist/types/GrowthStage.js +14 -0
  38. package/dist/types/IncomeStatus.d.ts +5 -0
  39. package/dist/types/IncomeStatus.js +9 -0
  40. package/dist/types/IncomeType.d.ts +6 -0
  41. package/dist/types/IncomeType.js +10 -0
  42. package/dist/types/MovementType.d.ts +2 -1
  43. package/dist/types/MovementType.js +1 -0
  44. package/dist/types/QualityGrade.d.ts +6 -0
  45. package/dist/types/QualityGrade.js +10 -0
  46. package/dist/types/index.d.ts +6 -0
  47. package/dist/types/index.js +15 -1
  48. package/package.json +1 -1
  49. package/src/entities/ExpenseDetail.ts +16 -1
  50. package/src/entities/ExpenseTransaction.ts +12 -2
  51. package/src/entities/Income.ts +99 -0
  52. package/src/entities/InventoryMovement.ts +7 -1
  53. package/src/index.ts +2 -0
  54. package/src/models/apu/Budget.ts +8 -0
  55. package/src/models/apu/budget-snapshot.entity.ts +1 -0
  56. package/src/models/production/CropActivity.ts +68 -0
  57. package/src/models/production/CropExpense.ts +74 -0
  58. package/src/models/production/CropLot.ts +106 -0
  59. package/src/models/production/CropStage.ts +45 -0
  60. package/src/models/production/CropStageImage.ts +32 -0
  61. package/src/models/production/GrowthArea.ts +41 -0
  62. package/src/models/production/Harvest.ts +56 -0
  63. package/src/models/production/ProductionSeason.ts +34 -0
  64. package/src/models/production/index.ts +9 -0
  65. package/src/types/CropActivityType.ts +12 -0
  66. package/src/types/CropLotStatus.ts +10 -0
  67. package/src/types/GrowthStage.ts +10 -0
  68. package/src/types/IncomeStatus.ts +5 -0
  69. package/src/types/IncomeType.ts +6 -0
  70. package/src/types/MovementType.ts +5 -4
  71. package/src/types/QualityGrade.ts +6 -0
  72. package/src/types/index.ts +11 -1
@@ -0,0 +1,56 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ManyToOne,
6
+ OneToOne,
7
+ JoinColumn,
8
+ ObjectLiteral,
9
+ Index,
10
+ CreateDateColumn,
11
+ } from "typeorm";
12
+ import { CropLot } from "./CropLot";
13
+ import { UnitOfMeasure } from "../../entities/UnitOfMesure";
14
+ import { QualityGrade } from "../../types/QualityGrade";
15
+ import { InventoryMovement } from "../../entities/InventoryMovement";
16
+
17
+ @Entity("harvests")
18
+ @Index(["cropLot", "harvestDate"])
19
+ export class Harvest implements ObjectLiteral {
20
+ @PrimaryGeneratedColumn("increment")
21
+ idHarvest!: number;
22
+
23
+ @ManyToOne(() => CropLot, (cropLot) => cropLot.harvests, {
24
+ nullable: false,
25
+ onDelete: "CASCADE",
26
+ })
27
+ @JoinColumn({ name: "idCropLot" })
28
+ cropLot!: CropLot;
29
+
30
+ @Column("date", { nullable: false })
31
+ harvestDate!: Date;
32
+
33
+ @Column("decimal", { precision: 12, scale: 2, nullable: false })
34
+ quantity!: number;
35
+
36
+ @ManyToOne(() => UnitOfMeasure, { nullable: true, onDelete: "SET NULL" })
37
+ @JoinColumn({ name: "idUnitOfMeasure" })
38
+ unitOfMeasure?: UnitOfMeasure | null;
39
+
40
+ @Column({
41
+ type: "enum",
42
+ enum: QualityGrade,
43
+ nullable: true,
44
+ })
45
+ qualityGrade?: QualityGrade | null;
46
+
47
+ @Column("text", { nullable: true })
48
+ notes?: string | null;
49
+
50
+ @CreateDateColumn({ type: "timestamp" })
51
+ createdAt!: Date;
52
+
53
+ @OneToOne(() => InventoryMovement, { nullable: true, cascade: true })
54
+ @JoinColumn({ name: "idInventoryMovement" })
55
+ inventoryMovement?: InventoryMovement | null;
56
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ OneToMany,
6
+ ObjectLiteral,
7
+ Index,
8
+ } from "typeorm";
9
+ import { CropLot } from "./CropLot";
10
+
11
+ @Entity("production_seasons")
12
+ @Index(["code"], { unique: true })
13
+ export class ProductionSeason implements ObjectLiteral {
14
+ @PrimaryGeneratedColumn("increment")
15
+ idSeason!: number;
16
+
17
+ @Column("varchar", { length: 255, nullable: false })
18
+ name!: string;
19
+
20
+ @Column("varchar", { length: 64, nullable: false, unique: true })
21
+ code!: string;
22
+
23
+ @Column("date", { nullable: false })
24
+ startDate!: Date;
25
+
26
+ @Column("date", { nullable: true })
27
+ endDate?: Date | null;
28
+
29
+ @Column("boolean", { default: true })
30
+ isActive!: boolean;
31
+
32
+ @OneToMany(() => CropLot, (cropLot) => cropLot.season)
33
+ cropLots?: CropLot[];
34
+ }
@@ -0,0 +1,9 @@
1
+ // Production entities
2
+ export { GrowthArea } from "./GrowthArea";
3
+ export { ProductionSeason } from "./ProductionSeason";
4
+ export { CropLot } from "./CropLot";
5
+ export { CropStage } from "./CropStage";
6
+ export { CropStageImage } from "./CropStageImage";
7
+ export { CropActivity } from "./CropActivity";
8
+ export { CropExpense } from "./CropExpense";
9
+ export { Harvest } from "./Harvest";
@@ -0,0 +1,12 @@
1
+ export enum CropActivityType {
2
+ IRRIGATION = "IRRIGATION",
3
+ FERTILIZATION = "FERTILIZATION",
4
+ PRUNING = "PRUNING",
5
+ PEST_CONTROL = "PEST_CONTROL",
6
+ DISEASE_CONTROL = "DISEASE_CONTROL",
7
+ TRANSPLANT = "TRANSPLANT",
8
+ WEEDING = "WEEDING",
9
+ HARVESTING = "HARVESTING",
10
+ QUALITY_CHECK = "QUALITY_CHECK",
11
+ OTHER = "OTHER",
12
+ }
@@ -0,0 +1,10 @@
1
+ export enum CropLotStatus {
2
+ PLANNED = "PLANNED",
3
+ SOWING = "SOWING",
4
+ GROWING = "GROWING",
5
+ FLOWERING = "FLOWERING",
6
+ READY_TO_HARVEST = "READY_TO_HARVEST",
7
+ HARVESTING = "HARVESTING",
8
+ COMPLETED = "COMPLETED",
9
+ CANCELLED = "CANCELLED",
10
+ }
@@ -0,0 +1,10 @@
1
+ export enum GrowthStage {
2
+ SOWING = "SOWING",
3
+ GERMINATION = "GERMINATION",
4
+ SEEDLING = "SEEDLING",
5
+ VEGETATIVE = "VEGETATIVE",
6
+ FLOWERING = "FLOWERING",
7
+ FRUITING = "FRUITING",
8
+ MATURATION = "MATURATION",
9
+ HARVEST = "HARVEST",
10
+ }
@@ -0,0 +1,5 @@
1
+ export enum IncomeStatus {
2
+ PENDING = "PENDING",
3
+ CONFIRMED = "CONFIRMED",
4
+ CANCELLED = "CANCELLED",
5
+ }
@@ -0,0 +1,6 @@
1
+ export enum IncomeType {
2
+ BUDGET_PAYMENT = "BUDGET_PAYMENT",
3
+ SPOT_SALE = "SPOT_SALE",
4
+ HARVEST_SALE = "HARVEST_SALE",
5
+ OTHER = "OTHER",
6
+ }
@@ -1,7 +1,8 @@
1
1
  export enum MovementType {
2
- PURCHASE = "PURCHASE",
3
- SALE = "SALE",
2
+ PURCHASE = "PURCHASE",
3
+ SALE = "SALE",
4
4
  ADJUSTMENT = "ADJUSTMENT",
5
- TRANSFER_IN = "TRANSFER_IN",
6
- TRANSFER_OUT = "TRANSFER_OUT",
5
+ TRANSFER_IN = "TRANSFER_IN",
6
+ TRANSFER_OUT = "TRANSFER_OUT",
7
+ HARVEST = "HARVEST",
7
8
  }
@@ -0,0 +1,6 @@
1
+ export enum QualityGrade {
2
+ PREMIUM = "PREMIUM",
3
+ STANDARD = "STANDARD",
4
+ ECONOMY = "ECONOMY",
5
+ REJECTED = "REJECTED",
6
+ }
@@ -2,4 +2,14 @@ export { ExpenseTransactionType } from "./ExpenseTransactionType";
2
2
  export { ExpenseDetailType } from "./ExpenseDetailType";
3
3
  export { ExpenseTypeType } from "./ExpenseTypeType";
4
4
  export { ProjectOrderType } from "./ProjectOrderType";
5
- export { MovementType } from "./MovementType";
5
+ export { MovementType } from "./MovementType";
6
+
7
+ // Production enums
8
+ export { CropLotStatus } from "./CropLotStatus";
9
+ export { GrowthStage } from "./GrowthStage";
10
+ export { CropActivityType } from "./CropActivityType";
11
+ export { QualityGrade } from "./QualityGrade";
12
+
13
+ // Income enums
14
+ export { IncomeType } from "./IncomeType";
15
+ export { IncomeStatus } from "./IncomeStatus";