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.
- package/dist/entities/ExpenseDetail.d.ts +6 -0
- package/dist/entities/ExpenseDetail.js +19 -1
- package/dist/entities/ExpenseTransaction.d.ts +2 -0
- package/dist/entities/ExpenseTransaction.js +11 -1
- package/dist/entities/Income.d.ts +29 -0
- package/dist/entities/Income.js +121 -0
- package/dist/entities/InventoryMovement.d.ts +2 -0
- package/dist/entities/InventoryMovement.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -1
- package/dist/models/apu/Budget.d.ts +4 -0
- package/dist/models/apu/Budget.js +10 -0
- package/dist/models/apu/budget-snapshot.entity.js +1 -0
- package/dist/models/production/CropActivity.d.ts +20 -0
- package/dist/models/production/CropActivity.js +85 -0
- package/dist/models/production/CropExpense.d.ts +22 -0
- package/dist/models/production/CropExpense.js +93 -0
- package/dist/models/production/CropLot.d.ts +33 -0
- package/dist/models/production/CropLot.js +132 -0
- package/dist/models/production/CropStage.d.ts +13 -0
- package/dist/models/production/CropStage.js +58 -0
- package/dist/models/production/CropStageImage.d.ts +9 -0
- package/dist/models/production/CropStageImage.js +44 -0
- package/dist/models/production/GrowthArea.d.ts +13 -0
- package/dist/models/production/GrowthArea.js +55 -0
- package/dist/models/production/Harvest.d.ts +16 -0
- package/dist/models/production/Harvest.js +70 -0
- package/dist/models/production/ProductionSeason.d.ts +11 -0
- package/dist/models/production/ProductionSeason.js +49 -0
- package/dist/models/production/index.d.ts +8 -0
- package/dist/models/production/index.js +20 -0
- package/dist/types/CropActivityType.d.ts +12 -0
- package/dist/types/CropActivityType.js +16 -0
- package/dist/types/CropLotStatus.d.ts +10 -0
- package/dist/types/CropLotStatus.js +14 -0
- package/dist/types/GrowthStage.d.ts +10 -0
- package/dist/types/GrowthStage.js +14 -0
- package/dist/types/IncomeStatus.d.ts +5 -0
- package/dist/types/IncomeStatus.js +9 -0
- package/dist/types/IncomeType.d.ts +6 -0
- package/dist/types/IncomeType.js +10 -0
- package/dist/types/MovementType.d.ts +2 -1
- package/dist/types/MovementType.js +1 -0
- package/dist/types/QualityGrade.d.ts +6 -0
- package/dist/types/QualityGrade.js +10 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +15 -1
- package/package.json +1 -1
- package/src/entities/ExpenseDetail.ts +16 -1
- package/src/entities/ExpenseTransaction.ts +12 -2
- package/src/entities/Income.ts +99 -0
- package/src/entities/InventoryMovement.ts +7 -1
- package/src/index.ts +2 -0
- package/src/models/apu/Budget.ts +8 -0
- package/src/models/apu/budget-snapshot.entity.ts +1 -0
- package/src/models/production/CropActivity.ts +68 -0
- package/src/models/production/CropExpense.ts +74 -0
- package/src/models/production/CropLot.ts +106 -0
- package/src/models/production/CropStage.ts +45 -0
- package/src/models/production/CropStageImage.ts +32 -0
- package/src/models/production/GrowthArea.ts +41 -0
- package/src/models/production/Harvest.ts +56 -0
- package/src/models/production/ProductionSeason.ts +34 -0
- package/src/models/production/index.ts +9 -0
- package/src/types/CropActivityType.ts +12 -0
- package/src/types/CropLotStatus.ts +10 -0
- package/src/types/GrowthStage.ts +10 -0
- package/src/types/IncomeStatus.ts +5 -0
- package/src/types/IncomeType.ts +6 -0
- package/src/types/MovementType.ts +5 -4
- package/src/types/QualityGrade.ts +6 -0
- 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
|
+
}
|
|
@@ -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
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -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";
|