proflores-db-model 0.1.33 → 0.2.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 (113) hide show
  1. package/dist/entities/Bank/BankAccount.js +2 -2
  2. package/dist/entities/Bank/TransactionBank.js +2 -2
  3. package/dist/entities/BranchImage.js +2 -2
  4. package/dist/entities/Branches.js +2 -2
  5. package/dist/entities/CategoryForCosting.js +2 -2
  6. package/dist/entities/CategoryForPlantType.js +2 -2
  7. package/dist/entities/ContainerType.js +2 -2
  8. package/dist/entities/ExpenseDetail.js +2 -2
  9. package/dist/entities/ExpenseTransaction.js +2 -2
  10. package/dist/entities/ExpenseType.js +2 -2
  11. package/dist/entities/Inventory.d.ts +2 -0
  12. package/dist/entities/Inventory.js +7 -2
  13. package/dist/entities/InventoryImage.js +2 -2
  14. package/dist/entities/InventoryItem.js +2 -2
  15. package/dist/entities/InventoryMovement.d.ts +15 -0
  16. package/dist/entities/InventoryMovement.js +67 -0
  17. package/dist/entities/ProductImage.js +2 -2
  18. package/dist/entities/Products.js +2 -2
  19. package/dist/entities/ProjectOrder.js +2 -2
  20. package/dist/entities/SupplierImage.js +2 -2
  21. package/dist/entities/Suppliers.js +2 -2
  22. package/dist/entities/UnitOfMesure.js +2 -2
  23. package/dist/entities/User.js +2 -2
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.js +4 -1
  26. package/dist/models/technical-sheet/CareInstructions.d.ts +16 -0
  27. package/dist/models/technical-sheet/CareInstructions.js +68 -0
  28. package/dist/models/technical-sheet/ClimateIdeal.d.ts +11 -0
  29. package/dist/models/technical-sheet/ClimateIdeal.js +48 -0
  30. package/dist/models/technical-sheet/FertilizationInfo.d.ts +20 -0
  31. package/dist/models/technical-sheet/FertilizationInfo.js +64 -0
  32. package/dist/models/technical-sheet/GrowthClassInfo.d.ts +15 -0
  33. package/dist/models/technical-sheet/GrowthClassInfo.js +49 -0
  34. package/dist/models/technical-sheet/HumidityInfo.d.ts +10 -0
  35. package/dist/models/technical-sheet/HumidityInfo.js +44 -0
  36. package/dist/models/technical-sheet/ImageInfo.d.ts +29 -0
  37. package/dist/models/technical-sheet/ImageInfo.js +134 -0
  38. package/dist/models/technical-sheet/LightInfo.d.ts +10 -0
  39. package/dist/models/technical-sheet/LightInfo.js +44 -0
  40. package/dist/models/technical-sheet/PestInfo.d.ts +18 -0
  41. package/dist/models/technical-sheet/PestInfo.js +76 -0
  42. package/dist/models/technical-sheet/PlantGrowthType.d.ts +15 -0
  43. package/dist/models/technical-sheet/PlantGrowthType.js +53 -0
  44. package/dist/models/technical-sheet/PlantSize.d.ts +14 -0
  45. package/dist/models/technical-sheet/PlantSize.js +62 -0
  46. package/dist/models/technical-sheet/PlantTechnicalSheet.d.ts +33 -0
  47. package/dist/models/technical-sheet/PlantTechnicalSheet.js +117 -0
  48. package/dist/models/technical-sheet/PropagationMethodInfo.d.ts +12 -0
  49. package/dist/models/technical-sheet/PropagationMethodInfo.js +52 -0
  50. package/dist/models/technical-sheet/SubstrateInfo.d.ts +13 -0
  51. package/dist/models/technical-sheet/SubstrateInfo.js +58 -0
  52. package/dist/models/technical-sheet/catalogs/climate-ideal.d.ts +11 -0
  53. package/dist/models/technical-sheet/catalogs/climate-ideal.js +14 -0
  54. package/dist/models/technical-sheet/catalogs/fertilization-info.d.ts +34 -0
  55. package/dist/models/technical-sheet/catalogs/fertilization-info.js +35 -0
  56. package/dist/models/technical-sheet/catalogs/growth-class.d.ts +10 -0
  57. package/dist/models/technical-sheet/catalogs/growth-class.js +14 -0
  58. package/dist/models/technical-sheet/catalogs/growth-type.d.ts +32 -0
  59. package/dist/models/technical-sheet/catalogs/growth-type.js +35 -0
  60. package/dist/models/technical-sheet/catalogs/humidity-info.d.ts +9 -0
  61. package/dist/models/technical-sheet/catalogs/humidity-info.js +12 -0
  62. package/dist/models/technical-sheet/catalogs/light-info.d.ts +9 -0
  63. package/dist/models/technical-sheet/catalogs/light-info.js +13 -0
  64. package/dist/models/technical-sheet/catalogs/pest-info.d.ts +32 -0
  65. package/dist/models/technical-sheet/catalogs/pest-info.js +33 -0
  66. package/dist/models/technical-sheet/catalogs/plant-size.d.ts +11 -0
  67. package/dist/models/technical-sheet/catalogs/plant-size.js +15 -0
  68. package/dist/models/technical-sheet/catalogs/propagation-method.d.ts +14 -0
  69. package/dist/models/technical-sheet/catalogs/propagation-method.js +18 -0
  70. package/dist/models/technical-sheet/catalogs/substrate-info.d.ts +17 -0
  71. package/dist/models/technical-sheet/catalogs/substrate-info.js +21 -0
  72. package/dist/models/technical-sheet/index.d.ts +13 -0
  73. package/dist/models/technical-sheet/index.js +29 -0
  74. package/dist/models/technical-sheet/utils/enumColumn.d.ts +6 -0
  75. package/dist/models/technical-sheet/utils/enumColumn.js +12 -0
  76. package/dist/models/technical-sheet/utils/makeCatalog.d.ts +8 -0
  77. package/dist/models/technical-sheet/utils/makeCatalog.js +19 -0
  78. package/dist/types/MovementType.d.ts +7 -0
  79. package/dist/types/MovementType.js +11 -0
  80. package/dist/types/index.d.ts +1 -0
  81. package/dist/types/index.js +3 -0
  82. package/package.json +5 -5
  83. package/src/entities/Inventory.ts +5 -0
  84. package/src/entities/InventoryMovement.ts +52 -0
  85. package/src/index.ts +2 -0
  86. package/src/models/technical-sheet/CareInstructions.ts +52 -0
  87. package/src/models/technical-sheet/ClimateIdeal.ts +34 -0
  88. package/src/models/technical-sheet/FertilizationInfo.ts +59 -0
  89. package/src/models/technical-sheet/GrowthClassInfo.ts +38 -0
  90. package/src/models/technical-sheet/HumidityInfo.ts +31 -0
  91. package/src/models/technical-sheet/ImageInfo.ts +111 -0
  92. package/src/models/technical-sheet/LightInfo.ts +31 -0
  93. package/src/models/technical-sheet/PestInfo.ts +65 -0
  94. package/src/models/technical-sheet/PlantGrowthType.ts +41 -0
  95. package/src/models/technical-sheet/PlantSize.ts +48 -0
  96. package/src/models/technical-sheet/PlantTechnicalSheet.ts +93 -0
  97. package/src/models/technical-sheet/PropagationMethodInfo.ts +37 -0
  98. package/src/models/technical-sheet/SubstrateInfo.ts +45 -0
  99. package/src/models/technical-sheet/catalogs/climate-ideal.ts +16 -0
  100. package/src/models/technical-sheet/catalogs/fertilization-info.ts +41 -0
  101. package/src/models/technical-sheet/catalogs/growth-class.ts +14 -0
  102. package/src/models/technical-sheet/catalogs/growth-type.ts +37 -0
  103. package/src/models/technical-sheet/catalogs/humidity-info.ts +12 -0
  104. package/src/models/technical-sheet/catalogs/light-info.ts +13 -0
  105. package/src/models/technical-sheet/catalogs/pest-info.ts +36 -0
  106. package/src/models/technical-sheet/catalogs/plant-size.ts +15 -0
  107. package/src/models/technical-sheet/catalogs/propagation-method.ts +18 -0
  108. package/src/models/technical-sheet/catalogs/substrate-info.ts +21 -0
  109. package/src/models/technical-sheet/index.ts +14 -0
  110. package/src/models/technical-sheet/utils/enumColumn.ts +17 -0
  111. package/src/models/technical-sheet/utils/makeCatalog.ts +17 -0
  112. package/src/types/MovementType.ts +7 -0
  113. package/src/types/index.ts +1 -0
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PEST_TYPE = exports.CONTROL_METHOD = exports.PLANT_PART = void 0;
4
+ const makeCatalog_1 = require("../utils/makeCatalog");
5
+ exports.PLANT_PART = (0, makeCatalog_1.makeCatalog)({
6
+ HOJAS: 'Hojas.',
7
+ TALLOS: 'Tallos.',
8
+ RAÍCES: 'Raíces.',
9
+ FLORES: 'Flores.',
10
+ FRUTOS: 'Frutos.',
11
+ TODA_LA_PLANTA: 'Daño sistémico.',
12
+ });
13
+ exports.CONTROL_METHOD = (0, makeCatalog_1.makeCatalog)({
14
+ JABÓN_POTÁSICO: 'Insecticida suave.',
15
+ ACEITE_DE_NEEM: 'Azadiractina sistémica.',
16
+ INSECTICIDA_SISTÉMICO: 'Absorción interna.',
17
+ INSECTICIDA_CONTACTO: 'Mata por contacto.',
18
+ FUNGICIDA_SISTÉMICO: 'Control interno hongos.',
19
+ FUNGICIDA_CONTACTO: 'Barrera superficial.',
20
+ TRAMPAS: 'Captura física.',
21
+ PODA_SANITARIA: 'Eliminación partes infectadas.',
22
+ CONTROL_BIOLÓGICO: 'Depredadores benéficos.',
23
+ OTRO: 'Otro método.',
24
+ });
25
+ exports.PEST_TYPE = (0, makeCatalog_1.makeCatalog)({
26
+ INSECTO: 'Insectos.',
27
+ HONGO: 'Hongos.',
28
+ ÁCARO: 'Aácaros.',
29
+ BACTERIA: 'Bacterias.',
30
+ VIRUS: 'Virus.',
31
+ NEMATODO: 'Nematodos.',
32
+ OTRO: 'Otro.',
33
+ });
@@ -0,0 +1,11 @@
1
+ export declare const GROWTH_HABIT_GEOM: {
2
+ COMPACTA: string;
3
+ EXPANSIVA: string;
4
+ ERECTA: string;
5
+ RASERA: string;
6
+ TREPADORA: string;
7
+ COLGANTE: string;
8
+ ARBUSTIVA: string;
9
+ ARBOREA: string;
10
+ };
11
+ export type GrowthHabit = keyof typeof GROWTH_HABIT_GEOM;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GROWTH_HABIT_GEOM = void 0;
4
+ // src/models/technical-sheet/catalogs/plant-size.ts
5
+ const makeCatalog_1 = require("../utils/makeCatalog");
6
+ exports.GROWTH_HABIT_GEOM = (0, makeCatalog_1.makeCatalog)({
7
+ COMPACTA: 'Poco volumen.',
8
+ EXPANSIVA: 'Brotes laterales extensos.',
9
+ ERECTA: 'Vertical sin soporte.',
10
+ RASERA: 'Se extiende sobre el suelo.',
11
+ TREPADORA: 'Escala estructuras.',
12
+ COLGANTE: 'Tallos péndulos.',
13
+ ARBUSTIVA: 'Múltiples ramas leñosas.',
14
+ ARBOREA: 'Tronco leñoso único.',
15
+ });
@@ -0,0 +1,14 @@
1
+ export declare const PROPAGATION: {
2
+ ESQUEJE_TALLO: string;
3
+ ESQUEJE_HOJA: string;
4
+ ESQUEJE_RAÍZ: string;
5
+ SEMILLA: string;
6
+ DIVISIÓN_MATA: string;
7
+ ACODO_SIMPLE: string;
8
+ ACODO_AÉREO: string;
9
+ IN_VITRO: string;
10
+ BULBO_RIZOMA_TUBÉRCULO: string;
11
+ HIJUELOS: string;
12
+ NO_APLICA: string;
13
+ };
14
+ export type PropagationMethod = keyof typeof PROPAGATION;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROPAGATION = void 0;
4
+ // src/models/technical-sheet/catalogs/propagation-method.ts
5
+ const makeCatalog_1 = require("../utils/makeCatalog");
6
+ exports.PROPAGATION = (0, makeCatalog_1.makeCatalog)({
7
+ ESQUEJE_TALLO: 'Corte de tallo.',
8
+ ESQUEJE_HOJA: 'Esqueje de hoja.',
9
+ ESQUEJE_RAÍZ: 'Fragmento de raíz.',
10
+ SEMILLA: 'Propagación sexual.',
11
+ DIVISIÓN_MATA: 'División de mata.',
12
+ ACODO_SIMPLE: 'Acodo simple.',
13
+ ACODO_AÉREO: 'Acodo aéreo.',
14
+ IN_VITRO: 'Cultivo in vitro.',
15
+ BULBO_RIZOMA_TUBÉRCULO: 'Órgano subterráneo.',
16
+ HIJUELOS: 'Brotes basales.',
17
+ NO_APLICA: 'No aplicable.',
18
+ });
@@ -0,0 +1,17 @@
1
+ export declare const SUBSTRATE: {
2
+ UNIVERSAL: string;
3
+ INTERIOR_LIGERO: string;
4
+ CACTUS_SUCULENTAS: string;
5
+ ORQUÍDEAS_EPÍFITAS: string;
6
+ BROMELIAS: string;
7
+ ACUÁTICO: string;
8
+ HELECHOS_HUMEDOS: string;
9
+ SEMILLERO: string;
10
+ BONSAI: string;
11
+ HIDROPONÍA: string;
12
+ ARENA_GRAVILLA: string;
13
+ FIBRA_COCO_PURA: string;
14
+ TURBA: string;
15
+ COMPOST_HOJARASCA: string;
16
+ };
17
+ export type SubstrateType = keyof typeof SUBSTRATE;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUBSTRATE = void 0;
4
+ // src/models/technical-sheet/catalogs/substrate-info.ts
5
+ const makeCatalog_1 = require("../utils/makeCatalog");
6
+ exports.SUBSTRATE = (0, makeCatalog_1.makeCatalog)({
7
+ UNIVERSAL: 'Mezcla equilibrada.',
8
+ INTERIOR_LIGERO: 'Turba + perlita.',
9
+ CACTUS_SUCULENTAS: 'Arena + grava, baja materia orgánica.',
10
+ ORQUÍDEAS_EPÍFITAS: 'Corteza gruesa + carbón.',
11
+ BROMELIAS: 'Fibra coco + corteza.',
12
+ ACUÁTICO: 'Arcilla y arena sumergida.',
13
+ HELECHOS_HUMEDOS: 'Turba + musgo esfagno.',
14
+ SEMILLERO: 'Turba fina esterilizada.',
15
+ BONSAI: 'Akadama + kiryuzuna + grava.',
16
+ HIDROPONÍA: 'Sustrato inerte.',
17
+ ARENA_GRAVILLA: '100 % mineral.',
18
+ FIBRA_COCO_PURA: 'Coco hidratado.',
19
+ TURBA: 'Turba rubia o negra.',
20
+ COMPOST_HOJARASCA: 'Orgánico descompuesto.',
21
+ });
@@ -0,0 +1,13 @@
1
+ export * from './PlantTechnicalSheet';
2
+ export * from './GrowthClassInfo';
3
+ export * from './CareInstructions';
4
+ export * from './ImageInfo';
5
+ export * from './LightInfo';
6
+ export * from './HumidityInfo';
7
+ export * from './PestInfo';
8
+ export * from './PlantGrowthType';
9
+ export * from './PlantSize';
10
+ export * from './SubstrateInfo';
11
+ export * from './ClimateIdeal';
12
+ export * from './FertilizationInfo';
13
+ export * from './PropagationMethodInfo';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./PlantTechnicalSheet"), exports);
18
+ __exportStar(require("./GrowthClassInfo"), exports);
19
+ __exportStar(require("./CareInstructions"), exports);
20
+ __exportStar(require("./ImageInfo"), exports);
21
+ __exportStar(require("./LightInfo"), exports);
22
+ __exportStar(require("./HumidityInfo"), exports);
23
+ __exportStar(require("./PestInfo"), exports);
24
+ __exportStar(require("./PlantGrowthType"), exports);
25
+ __exportStar(require("./PlantSize"), exports);
26
+ __exportStar(require("./SubstrateInfo"), exports);
27
+ __exportStar(require("./ClimateIdeal"), exports);
28
+ __exportStar(require("./FertilizationInfo"), exports);
29
+ __exportStar(require("./PropagationMethodInfo"), exports);
@@ -0,0 +1,6 @@
1
+ import { ColumnOptions } from "typeorm";
2
+ /**
3
+ * Utilidad para columnas enum basadas en catálogos TypeScript.
4
+ * Permite usar `keyof typeof ENUM` como tipo en la entidad.
5
+ */
6
+ export declare function EnumColumn<T extends string>(values: readonly T[], options?: Omit<ColumnOptions, "type" | "enum">): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnumColumn = EnumColumn;
4
+ // src/models/technical-sheet/utils/enumColumn.ts
5
+ const typeorm_1 = require("typeorm");
6
+ /**
7
+ * Utilidad para columnas enum basadas en catálogos TypeScript.
8
+ * Permite usar `keyof typeof ENUM` como tipo en la entidad.
9
+ */
10
+ function EnumColumn(values, options = {}) {
11
+ return (0, typeorm_1.Column)(Object.assign({ type: "enum", enum: values }, options));
12
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Define un catálogo estático e inmutable y devuelve el mismo objeto.
3
+ * TypeScript infiere correctamente los tipos de clave.
4
+ *
5
+ * @param c Objeto Record<string, string> que representa el catálogo
6
+ * @returns El mismo objeto `c`, como constante tipada
7
+ */
8
+ export declare function makeCatalog<C extends Record<string, string>>(c: C): C;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /* =============================================================================
3
+ * UTILITY ───────────── makeCatalog
4
+ * ---------------------------------------------------------------------------
5
+ * Crea un Record<K, string> inmutable para catálogos
6
+ * y permite derivar tipos clave (keyof).
7
+ * ===========================================================================*/
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.makeCatalog = makeCatalog;
10
+ /**
11
+ * Define un catálogo estático e inmutable y devuelve el mismo objeto.
12
+ * TypeScript infiere correctamente los tipos de clave.
13
+ *
14
+ * @param c Objeto Record<string, string> que representa el catálogo
15
+ * @returns El mismo objeto `c`, como constante tipada
16
+ */
17
+ function makeCatalog(c) {
18
+ return c;
19
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum MovementType {
2
+ PURCHASE = "PURCHASE",
3
+ SALE = "SALE",
4
+ ADJUSTMENT = "ADJUSTMENT",
5
+ TRANSFER_IN = "TRANSFER_IN",
6
+ TRANSFER_OUT = "TRANSFER_OUT"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MovementType = void 0;
4
+ var MovementType;
5
+ (function (MovementType) {
6
+ MovementType["PURCHASE"] = "PURCHASE";
7
+ MovementType["SALE"] = "SALE";
8
+ MovementType["ADJUSTMENT"] = "ADJUSTMENT";
9
+ MovementType["TRANSFER_IN"] = "TRANSFER_IN";
10
+ MovementType["TRANSFER_OUT"] = "TRANSFER_OUT";
11
+ })(MovementType || (exports.MovementType = MovementType = {}));
@@ -2,3 +2,4 @@ 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";
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MovementType = void 0;
4
+ var MovementType_1 = require("./MovementType");
5
+ Object.defineProperty(exports, "MovementType", { enumerable: true, get: function () { return MovementType_1.MovementType; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.1.33",
3
+ "version": "0.2.0",
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",
@@ -11,12 +11,12 @@
11
11
  "prepublishOnly": "yarn build"
12
12
  },
13
13
  "dependencies": {
14
- "reflect-metadata": "^0.1.13",
15
- "typeorm": "^0.2.45"
14
+ "reflect-metadata": "^0.2.2",
15
+ "typeorm": "^0.3.22"
16
16
  },
17
17
  "devDependencies": {
18
- "@types/node": "^22.8.7",
18
+ "@types/node": "^22.15.3",
19
19
  "ts-node": "^10.0.0",
20
- "typescript": "^4.0.0"
20
+ "typescript": "^5.8.3"
21
21
  }
22
22
  }
@@ -13,6 +13,8 @@ import { Branch } from "./Branches";
13
13
  import { ContainerType } from "./ContainerType";
14
14
  import { Supplier } from "./Suppliers";
15
15
  import { InventoryImage } from "./InventoryImage";
16
+ import { InventoryMovement } from "./InventoryMovement";
17
+
16
18
  @Entity("inventory")
17
19
  export class Inventory implements ObjectLiteral {
18
20
  @PrimaryGeneratedColumn("increment")
@@ -58,4 +60,7 @@ export class Inventory implements ObjectLiteral {
58
60
  }
59
61
  )
60
62
  images!: InventoryImage[] | null;
63
+
64
+ @OneToMany(() => InventoryMovement, (movement) => movement.inventory)
65
+ movements!: InventoryMovement[];
61
66
  }
@@ -0,0 +1,52 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ManyToOne,
6
+ JoinColumn,
7
+ CreateDateColumn,
8
+ UpdateDateColumn,
9
+ ObjectLiteral,
10
+ } from "typeorm";
11
+ import { Inventory } from "./Inventory";
12
+ import { MovementType } from "../types/MovementType";
13
+ @Entity("inventory_movement")
14
+ export class InventoryMovement implements ObjectLiteral {
15
+ @PrimaryGeneratedColumn("increment")
16
+ idMovement!: number;
17
+
18
+ @ManyToOne(() => Inventory, (inventory) => inventory.movements, {
19
+ nullable: false,
20
+ })
21
+ @JoinColumn({ name: "idInventory" })
22
+ inventory!: Inventory;
23
+
24
+ @Column({
25
+ type: "enum",
26
+ enum: MovementType,
27
+ })
28
+ movementType!: MovementType;
29
+
30
+ @Column("decimal", { precision: 10, scale: 2, nullable: false, default: 0 })
31
+ quantityChange!: number;
32
+
33
+ @Column("decimal", { precision: 10, scale: 2, nullable: true })
34
+ resultingStock?: number;
35
+
36
+ @CreateDateColumn()
37
+ createdAt!: Date;
38
+
39
+ @UpdateDateColumn()
40
+ updatedAt!: Date;
41
+
42
+ @Column("varchar", { length: 255, nullable: true })
43
+ description?: string;
44
+
45
+ @Column("int", { nullable: true })
46
+ referenceId?: number;
47
+
48
+ @Column("varchar", { length: 50, nullable: true })
49
+ referenceModule?: string;
50
+
51
+ }
52
+
package/src/index.ts CHANGED
@@ -14,9 +14,11 @@ export { TransactionBank } from "./entities/Bank/TransactionBank";
14
14
  export { ProductImage } from "./entities/ProductImage";
15
15
  export { Product } from "./entities/Products";
16
16
  export { Inventory } from "./entities/Inventory";
17
+ export { InventoryMovement } from "./entities/InventoryMovement";
17
18
  export { Branch } from "./entities/Branches";
18
19
  export { BranchImage } from "./entities/BranchImage";
19
20
  export { SupplierImage } from "./entities/SupplierImage";
20
21
  export { InventoryImage } from "./entities/InventoryImage";
21
22
 
22
23
  export * from "./types";
24
+ export * from "./models/technical-sheet";
@@ -0,0 +1,52 @@
1
+ // src/models/technical-sheet/entities/CareInstructions.ts
2
+
3
+ import {
4
+ Entity,
5
+ Column,
6
+ PrimaryGeneratedColumn,
7
+ ObjectLiteral,
8
+ OneToOne,
9
+ JoinColumn,
10
+ } from 'typeorm';
11
+ import { PlantTechnicalSheet } from './PlantTechnicalSheet';
12
+
13
+ @Entity('care_instructions')
14
+ export class CareInstructions implements ObjectLiteral {
15
+ @PrimaryGeneratedColumn('increment')
16
+ idCareInstructions!: number;
17
+
18
+ @Column('text')
19
+ light!: string;
20
+
21
+ @Column('text')
22
+ watering!: string;
23
+
24
+ @Column('text')
25
+ humidity!: string;
26
+
27
+ @Column('text')
28
+ temperature!: string;
29
+
30
+ @Column('text')
31
+ substrate!: string;
32
+
33
+ @Column('text')
34
+ fertilization!: string;
35
+
36
+ @Column('text')
37
+ pruning!: string;
38
+
39
+ @Column('text', { nullable: true })
40
+ notes?: string;
41
+
42
+ /** Relación inversa con la ficha técnica */
43
+ @OneToOne(() => PlantTechnicalSheet, (sheet) => sheet.care, {
44
+ onDelete: 'CASCADE',
45
+ })
46
+ @JoinColumn({ name: 'plantTechnicalSheetId' })
47
+ plantTechnicalSheet?: PlantTechnicalSheet;
48
+
49
+ @Column({ type: 'boolean', default: true })
50
+ isActive!: boolean;
51
+ }
52
+
@@ -0,0 +1,34 @@
1
+ import {
2
+ Column,
3
+ Entity,
4
+ PrimaryGeneratedColumn,
5
+ OneToMany,
6
+ ObjectLiteral,
7
+ } from 'typeorm';
8
+ import { CLIMATE, ClimateType } from './catalogs/climate-ideal';
9
+ import { ImageInfo } from './ImageInfo';
10
+ import { EnumColumn } from './utils/enumColumn';
11
+
12
+ @Entity('climate_ideal')
13
+ export class ClimateIdeal implements ObjectLiteral {
14
+ @PrimaryGeneratedColumn('increment')
15
+ idClimateIdeal!: number;
16
+
17
+ @EnumColumn(Object.keys(CLIMATE) as ClimateType[])
18
+ type!: ClimateType;
19
+
20
+ @Column('text', { nullable: true })
21
+ description?: string;
22
+
23
+ @Column('simple-json', { nullable: true })
24
+ temperatureRangeC?: [number, number];
25
+
26
+ @OneToMany(() => ImageInfo, (image) => image.climateIdeal, {
27
+ cascade: true,
28
+ })
29
+ images?: ImageInfo[];
30
+
31
+ @Column({ type: 'boolean', default: true })
32
+ isActive!: boolean;
33
+ }
34
+
@@ -0,0 +1,59 @@
1
+ import {
2
+ Entity,
3
+ Column,
4
+ PrimaryGeneratedColumn,
5
+ ManyToOne,
6
+ OneToMany,
7
+ ObjectLiteral,
8
+ } from "typeorm";
9
+ import {
10
+ FERTILIZER_TYPE,
11
+ FERTILIZER_FREQ,
12
+ FERTILIZER_METHOD,
13
+ FertilizerType,
14
+ FertilizerFrequency,
15
+ FertilizerMethod,
16
+ } from "./catalogs/fertilization-info";
17
+ import { PlantTechnicalSheet } from "./PlantTechnicalSheet";
18
+ import { ImageInfo } from "./ImageInfo";
19
+ import { EnumColumn } from "./utils/enumColumn";
20
+
21
+ @Entity("fertilization_info")
22
+ export class FertilizationInfo implements ObjectLiteral {
23
+ @PrimaryGeneratedColumn("increment")
24
+ idFertilizationInfo!: number;
25
+
26
+ /** Tipo de fertilizante según catálogo */
27
+ @EnumColumn(Object.keys(FERTILIZER_TYPE) as FertilizerType[])
28
+ type!: FertilizerType;
29
+
30
+ /** Frecuencia de aplicación según catálogo */
31
+ @EnumColumn(Object.keys(FERTILIZER_FREQ) as FertilizerFrequency[])
32
+ frequency!: FertilizerFrequency;
33
+
34
+ /** Método de aplicación según catálogo */
35
+ @EnumColumn(Object.keys(FERTILIZER_METHOD) as FertilizerMethod[])
36
+ method!: FertilizerMethod;
37
+
38
+ @Column("text", { nullable: true })
39
+ formula?: string;
40
+
41
+ @Column("text", { nullable: true })
42
+ notes?: string;
43
+
44
+ /** Imágenes asociadas */
45
+ @OneToMany(() => ImageInfo, (image) => image.fertilizationInfo, {
46
+ cascade: true,
47
+ })
48
+ images?: ImageInfo[];
49
+
50
+ /** Ficha técnica a la que pertenece esta fertilización */
51
+ @ManyToOne(() => PlantTechnicalSheet, (sheet) => sheet.fertilization, {
52
+ nullable: false,
53
+ onDelete: "CASCADE",
54
+ })
55
+ plant!: PlantTechnicalSheet;
56
+
57
+ @Column({ type: "boolean", default: true })
58
+ isActive!: boolean;
59
+ }
@@ -0,0 +1,38 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ OneToMany,
6
+ ObjectLiteral,
7
+ } from 'typeorm';
8
+ import { GROWTH_CLASS, GrowthClass } from './catalogs/growth-class';
9
+ import { PlantTechnicalSheet } from './PlantTechnicalSheet';
10
+ import { ImageInfo } from './ImageInfo';
11
+ import { EnumColumn } from './utils/enumColumn';
12
+
13
+ @Entity('growth_class_info')
14
+ export class GrowthClassInfo implements ObjectLiteral {
15
+ @PrimaryGeneratedColumn('increment')
16
+ idGrowthClassInfo!: number;
17
+
18
+ /** Clase de crecimiento (catálogo) */
19
+ @EnumColumn(Object.keys(GROWTH_CLASS) as GrowthClass[])
20
+ type!: GrowthClass;
21
+
22
+ @Column('text', { nullable: true })
23
+ description?: string;
24
+
25
+ /** Imágenes asociadas */
26
+ @OneToMany(() => ImageInfo, (image) => image.growthClassInfo, {
27
+ cascade: true,
28
+ })
29
+ images?: ImageInfo[];
30
+
31
+ /** Fichas técnicas asociadas */
32
+ @OneToMany(() => PlantTechnicalSheet, (sheet) => sheet.growthClass)
33
+ sheets!: PlantTechnicalSheet[];
34
+
35
+ @Column({ type: 'boolean', default: true })
36
+ isActive!: boolean;
37
+ }
38
+
@@ -0,0 +1,31 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ OneToMany,
6
+ ObjectLiteral,
7
+ } from 'typeorm';
8
+ import { HUMIDITY, HumidityRequirement } from './catalogs/humidity-info';
9
+ import { ImageInfo } from './ImageInfo';
10
+ import { EnumColumn } from './utils/enumColumn';
11
+
12
+ @Entity('humidity_info')
13
+ export class HumidityInfo implements ObjectLiteral {
14
+ @PrimaryGeneratedColumn('increment')
15
+ idHumidityInfo!: number;
16
+
17
+ @EnumColumn(Object.keys(HUMIDITY) as HumidityRequirement[])
18
+ type!: HumidityRequirement;
19
+
20
+ @Column('text', { nullable: true })
21
+ description?: string;
22
+
23
+ @OneToMany(() => ImageInfo, (image) => image.humidityInfo, {
24
+ cascade: true,
25
+ })
26
+ images?: ImageInfo[];
27
+
28
+ @Column({ type: 'boolean', default: true })
29
+ isActive!: boolean;
30
+ }
31
+