proflores-db-model 0.1.34 → 0.2.1

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 (105) 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.js +2 -2
  12. package/dist/entities/InventoryImage.js +2 -2
  13. package/dist/entities/InventoryItem.js +2 -2
  14. package/dist/entities/InventoryMovement.js +2 -2
  15. package/dist/entities/ProductImage.js +2 -2
  16. package/dist/entities/Products.js +2 -2
  17. package/dist/entities/ProjectOrder.js +2 -2
  18. package/dist/entities/SupplierImage.js +2 -2
  19. package/dist/entities/Suppliers.js +2 -2
  20. package/dist/entities/UnitOfMesure.js +2 -2
  21. package/dist/entities/User.js +2 -2
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/models/technical-sheet/CareInstructions.d.ts +13 -0
  25. package/dist/models/technical-sheet/CareInstructions.js +60 -0
  26. package/dist/models/technical-sheet/ClimateIdeal.d.ts +11 -0
  27. package/dist/models/technical-sheet/ClimateIdeal.js +46 -0
  28. package/dist/models/technical-sheet/FertilizationInfo.d.ts +17 -0
  29. package/dist/models/technical-sheet/FertilizationInfo.js +54 -0
  30. package/dist/models/technical-sheet/GrowthClassInfo.d.ts +12 -0
  31. package/dist/models/technical-sheet/GrowthClassInfo.js +44 -0
  32. package/dist/models/technical-sheet/HumidityInfo.d.ts +10 -0
  33. package/dist/models/technical-sheet/HumidityInfo.js +44 -0
  34. package/dist/models/technical-sheet/ImageInfo.d.ts +29 -0
  35. package/dist/models/technical-sheet/ImageInfo.js +124 -0
  36. package/dist/models/technical-sheet/LightInfo.d.ts +10 -0
  37. package/dist/models/technical-sheet/LightInfo.js +44 -0
  38. package/dist/models/technical-sheet/PestInfo.d.ts +18 -0
  39. package/dist/models/technical-sheet/PestInfo.js +76 -0
  40. package/dist/models/technical-sheet/PlantGrowthType.d.ts +13 -0
  41. package/dist/models/technical-sheet/PlantGrowthType.js +48 -0
  42. package/dist/models/technical-sheet/PlantSize.d.ts +12 -0
  43. package/dist/models/technical-sheet/PlantSize.js +53 -0
  44. package/dist/models/technical-sheet/PlantTechnicalSheet.d.ts +33 -0
  45. package/dist/models/technical-sheet/PlantTechnicalSheet.js +117 -0
  46. package/dist/models/technical-sheet/PropagationMethodInfo.d.ts +10 -0
  47. package/dist/models/technical-sheet/PropagationMethodInfo.js +47 -0
  48. package/dist/models/technical-sheet/SubstrateInfo.d.ts +11 -0
  49. package/dist/models/technical-sheet/SubstrateInfo.js +49 -0
  50. package/dist/models/technical-sheet/catalogs/climate-ideal.d.ts +11 -0
  51. package/dist/models/technical-sheet/catalogs/climate-ideal.js +14 -0
  52. package/dist/models/technical-sheet/catalogs/fertilization-info.d.ts +34 -0
  53. package/dist/models/technical-sheet/catalogs/fertilization-info.js +35 -0
  54. package/dist/models/technical-sheet/catalogs/growth-class.d.ts +10 -0
  55. package/dist/models/technical-sheet/catalogs/growth-class.js +14 -0
  56. package/dist/models/technical-sheet/catalogs/growth-type.d.ts +32 -0
  57. package/dist/models/technical-sheet/catalogs/growth-type.js +35 -0
  58. package/dist/models/technical-sheet/catalogs/humidity-info.d.ts +9 -0
  59. package/dist/models/technical-sheet/catalogs/humidity-info.js +12 -0
  60. package/dist/models/technical-sheet/catalogs/light-info.d.ts +9 -0
  61. package/dist/models/technical-sheet/catalogs/light-info.js +13 -0
  62. package/dist/models/technical-sheet/catalogs/pest-info.d.ts +32 -0
  63. package/dist/models/technical-sheet/catalogs/pest-info.js +33 -0
  64. package/dist/models/technical-sheet/catalogs/plant-size.d.ts +11 -0
  65. package/dist/models/technical-sheet/catalogs/plant-size.js +15 -0
  66. package/dist/models/technical-sheet/catalogs/propagation-method.d.ts +14 -0
  67. package/dist/models/technical-sheet/catalogs/propagation-method.js +18 -0
  68. package/dist/models/technical-sheet/catalogs/substrate-info.d.ts +17 -0
  69. package/dist/models/technical-sheet/catalogs/substrate-info.js +21 -0
  70. package/dist/models/technical-sheet/index.d.ts +13 -0
  71. package/dist/models/technical-sheet/index.js +29 -0
  72. package/dist/models/technical-sheet/utils/enumColumn.d.ts +6 -0
  73. package/dist/models/technical-sheet/utils/enumColumn.js +12 -0
  74. package/dist/models/technical-sheet/utils/makeCatalog.d.ts +8 -0
  75. package/dist/models/technical-sheet/utils/makeCatalog.js +19 -0
  76. package/dist/types/MovementType.js +1 -1
  77. package/package.json +5 -5
  78. package/src/entities/Inventory.ts +1 -0
  79. package/src/index.ts +1 -0
  80. package/src/models/technical-sheet/CareInstructions.ts +45 -0
  81. package/src/models/technical-sheet/ClimateIdeal.ts +32 -0
  82. package/src/models/technical-sheet/FertilizationInfo.ts +50 -0
  83. package/src/models/technical-sheet/GrowthClassInfo.ts +35 -0
  84. package/src/models/technical-sheet/HumidityInfo.ts +31 -0
  85. package/src/models/technical-sheet/ImageInfo.ts +102 -0
  86. package/src/models/technical-sheet/LightInfo.ts +31 -0
  87. package/src/models/technical-sheet/PestInfo.ts +65 -0
  88. package/src/models/technical-sheet/PlantGrowthType.ts +38 -0
  89. package/src/models/technical-sheet/PlantSize.ts +41 -0
  90. package/src/models/technical-sheet/PlantTechnicalSheet.ts +93 -0
  91. package/src/models/technical-sheet/PropagationMethodInfo.ts +33 -0
  92. package/src/models/technical-sheet/SubstrateInfo.ts +36 -0
  93. package/src/models/technical-sheet/catalogs/climate-ideal.ts +16 -0
  94. package/src/models/technical-sheet/catalogs/fertilization-info.ts +41 -0
  95. package/src/models/technical-sheet/catalogs/growth-class.ts +14 -0
  96. package/src/models/technical-sheet/catalogs/growth-type.ts +37 -0
  97. package/src/models/technical-sheet/catalogs/humidity-info.ts +12 -0
  98. package/src/models/technical-sheet/catalogs/light-info.ts +13 -0
  99. package/src/models/technical-sheet/catalogs/pest-info.ts +36 -0
  100. package/src/models/technical-sheet/catalogs/plant-size.ts +15 -0
  101. package/src/models/technical-sheet/catalogs/propagation-method.ts +18 -0
  102. package/src/models/technical-sheet/catalogs/substrate-info.ts +21 -0
  103. package/src/models/technical-sheet/index.ts +14 -0
  104. package/src/models/technical-sheet/utils/enumColumn.ts +17 -0
  105. package/src/models/technical-sheet/utils/makeCatalog.ts +17 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proflores-db-model",
3
- "version": "0.1.34",
3
+ "version": "0.2.1",
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
  }
@@ -14,6 +14,7 @@ import { ContainerType } from "./ContainerType";
14
14
  import { Supplier } from "./Suppliers";
15
15
  import { InventoryImage } from "./InventoryImage";
16
16
  import { InventoryMovement } from "./InventoryMovement";
17
+
17
18
  @Entity("inventory")
18
19
  export class Inventory implements ObjectLiteral {
19
20
  @PrimaryGeneratedColumn("increment")
package/src/index.ts CHANGED
@@ -21,3 +21,4 @@ export { SupplierImage } from "./entities/SupplierImage";
21
21
  export { InventoryImage } from "./entities/InventoryImage";
22
22
 
23
23
  export * from "./types";
24
+ export * from "./models/technical-sheet";
@@ -0,0 +1,45 @@
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
+ @Column({ type: 'boolean', default: true })
43
+ isActive!: boolean;
44
+ }
45
+
@@ -0,0 +1,32 @@
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
+ images?: ImageInfo[];
28
+
29
+ @Column({ type: 'boolean', default: true })
30
+ isActive!: boolean;
31
+ }
32
+
@@ -0,0 +1,50 @@
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
+ images?: ImageInfo[];
47
+
48
+ @Column({ type: "boolean", default: true })
49
+ isActive!: boolean;
50
+ }
@@ -0,0 +1,35 @@
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
+
32
+ @Column({ type: 'boolean', default: true })
33
+ isActive!: boolean;
34
+ }
35
+
@@ -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
+
@@ -0,0 +1,102 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ObjectLiteral,
6
+ ManyToOne,
7
+ JoinColumn,
8
+ } from "typeorm";
9
+ import { PlantTechnicalSheet } from "./PlantTechnicalSheet";
10
+ import { PlantGrowthType } from "./PlantGrowthType";
11
+ import { LightInfo } from "./LightInfo";
12
+ import { HumidityInfo } from "./HumidityInfo";
13
+ import { ClimateIdeal } from "./ClimateIdeal";
14
+ import { SubstrateInfo } from "./SubstrateInfo";
15
+ import { FertilizationInfo } from "./FertilizationInfo";
16
+ import { PestInfo } from "./PestInfo";
17
+ import { PropagationMethodInfo } from "./PropagationMethodInfo";
18
+ import { PlantSize } from "./PlantSize";
19
+ import { GrowthClassInfo } from "./GrowthClassInfo";
20
+
21
+ @Entity("technical_sheet_images")
22
+ export class ImageInfo implements ObjectLiteral {
23
+ @PrimaryGeneratedColumn("increment")
24
+ idImage!: number;
25
+
26
+ @Column("varchar", { length: 500 })
27
+ url!: string;
28
+
29
+ @Column("text", { nullable: true })
30
+ description?: string;
31
+
32
+ @Column({ type: "boolean", default: true })
33
+ isActive!: boolean;
34
+
35
+ @ManyToOne(() => PlantTechnicalSheet, (sheet) => sheet.images, {
36
+ nullable: true,
37
+ onDelete: "CASCADE",
38
+ })
39
+ @JoinColumn({ name: "plantTechnicalSheetId" })
40
+ plantTechnicalSheet?: PlantTechnicalSheet;
41
+
42
+ @ManyToOne(() => PlantGrowthType, (growthType) => growthType.images, {
43
+ nullable: true,
44
+ })
45
+ @JoinColumn({ name: "plantGrowthTypeId" })
46
+ plantGrowthType?: PlantGrowthType;
47
+
48
+ @ManyToOne(() => LightInfo, (lightInfo) => lightInfo.images, {
49
+ nullable: true,
50
+ })
51
+ @JoinColumn({ name: "lightInfoId" })
52
+ lightInfo?: LightInfo;
53
+
54
+ @ManyToOne(() => HumidityInfo, (humidityInfo) => humidityInfo.images, {
55
+ nullable: true,
56
+ })
57
+ @JoinColumn({ name: "humidityInfoId" })
58
+ humidityInfo?: HumidityInfo;
59
+
60
+ @ManyToOne(() => ClimateIdeal, (climate) => climate.images, {
61
+ nullable: true,
62
+ })
63
+ @JoinColumn({ name: "climateIdealId" })
64
+ climateIdeal?: ClimateIdeal;
65
+
66
+ @ManyToOne(() => SubstrateInfo, (substrate) => substrate.images, {
67
+ nullable: true,
68
+ })
69
+ @JoinColumn({ name: "substrateInfoId" })
70
+ substrateInfo?: SubstrateInfo;
71
+
72
+ @ManyToOne(() => FertilizationInfo, (f) => f.images, {
73
+ nullable: true,
74
+ })
75
+ @JoinColumn({ name: "fertilizationInfoId" })
76
+ fertilizationInfo?: FertilizationInfo;
77
+
78
+ @ManyToOne(() => PestInfo, (pest) => pest.images, {
79
+ nullable: true,
80
+ })
81
+ @JoinColumn({ name: "pestId" })
82
+ pest?: PestInfo;
83
+
84
+ @ManyToOne(() => PropagationMethodInfo, (info) => info.images, {
85
+ nullable: true,
86
+ })
87
+ @JoinColumn({ name: "propagationMethodId" })
88
+ propagationMethod?: PropagationMethodInfo;
89
+
90
+ @ManyToOne(() => PlantSize, (size) => size.images, {
91
+ nullable: true,
92
+ })
93
+ @JoinColumn({ name: "plantSizeId" })
94
+ plantSize?: PlantSize;
95
+
96
+ @ManyToOne(() => GrowthClassInfo, (growthClass) => growthClass.images, {
97
+ nullable: true,
98
+ })
99
+ @JoinColumn({ name: "growthClassInfoId" })
100
+ growthClassInfo?: GrowthClassInfo;
101
+ }
102
+
@@ -0,0 +1,31 @@
1
+ import {
2
+ Entity,
3
+ Column,
4
+ PrimaryGeneratedColumn,
5
+ OneToMany,
6
+ ObjectLiteral,
7
+ } from 'typeorm';
8
+ import { LIGHT, LightRequirement } from './catalogs/light-info';
9
+ import { ImageInfo } from './ImageInfo';
10
+ import { EnumColumn } from './utils/enumColumn';
11
+
12
+ @Entity('light_info')
13
+ export class LightInfo implements ObjectLiteral {
14
+ @PrimaryGeneratedColumn('increment')
15
+ idLightInfo!: number;
16
+
17
+ @EnumColumn(Object.keys(LIGHT) as LightRequirement[])
18
+ type!: LightRequirement;
19
+
20
+ @Column('text', { nullable: true })
21
+ description?: string;
22
+
23
+ @OneToMany(() => ImageInfo, (image) => image.lightInfo, {
24
+ cascade: true,
25
+ })
26
+ images?: ImageInfo[];
27
+
28
+ @Column({ type: 'boolean', default: true })
29
+ isActive!: boolean;
30
+ }
31
+
@@ -0,0 +1,65 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ObjectLiteral,
6
+ ManyToOne,
7
+ JoinColumn,
8
+ OneToMany,
9
+ } from 'typeorm';
10
+ import { PlantTechnicalSheet } from './PlantTechnicalSheet';
11
+ import { ImageInfo } from './ImageInfo';
12
+ import {
13
+ PEST_TYPE,
14
+ PestType,
15
+ PLANT_PART,
16
+ PlantPart,
17
+ CONTROL_METHOD,
18
+ ControlMethod,
19
+ } from './catalogs/pest-info';
20
+ import { EnumColumn } from './utils/enumColumn';
21
+
22
+ @Entity('pests')
23
+ export class PestInfo implements ObjectLiteral {
24
+ @PrimaryGeneratedColumn('increment')
25
+ idPestInfo!: number;
26
+
27
+ @Column('varchar', { length: 255 })
28
+ commonName!: string;
29
+
30
+ @Column('varchar', { nullable: true, length: 255 })
31
+ scientificName?: string;
32
+
33
+ @EnumColumn(Object.keys(PEST_TYPE) as PestType[])
34
+ type!: PestType;
35
+
36
+ @EnumColumn(Object.keys(PLANT_PART) as PlantPart[])
37
+ affectedParts!: PlantPart;
38
+
39
+ @Column('text')
40
+ symptoms!: string;
41
+
42
+ @Column('text', { nullable: true })
43
+ appearanceConditions?: string;
44
+
45
+ @EnumColumn(Object.keys(CONTROL_METHOD) as ControlMethod[])
46
+ controlMethod!: ControlMethod;
47
+
48
+ @Column('text', { nullable: true })
49
+ controlNotes?: string;
50
+
51
+ @ManyToOne(() => PlantTechnicalSheet, (sheet) => sheet.pests, {
52
+ onDelete: 'CASCADE',
53
+ })
54
+ @JoinColumn({ name: 'technicalSheetId' })
55
+ technicalSheet!: PlantTechnicalSheet;
56
+
57
+ @OneToMany(() => ImageInfo, (image) => image.pest, {
58
+ cascade: true,
59
+ })
60
+ images?: ImageInfo[];
61
+
62
+ @Column({ type: 'boolean', default: true })
63
+ isActive!: boolean;
64
+ }
65
+
@@ -0,0 +1,38 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ObjectLiteral,
6
+ OneToMany,
7
+ } from 'typeorm';
8
+ import { EnumColumn } from './utils/enumColumn';
9
+ import { GROWTH_AREA, GROWTH_HABIT } from './catalogs/growth-type';
10
+ import { PlantTechnicalSheet } from './PlantTechnicalSheet';
11
+ import { ImageInfo } from './ImageInfo';
12
+
13
+ export type PlantGrowthArea = keyof typeof GROWTH_AREA;
14
+ export type PlantGrowthHabit = keyof typeof GROWTH_HABIT;
15
+
16
+ @Entity('plant_growth_types')
17
+ export class PlantGrowthType implements ObjectLiteral {
18
+ @PrimaryGeneratedColumn('increment')
19
+ idPlantGrowthType!: number;
20
+
21
+ @EnumColumn(Object.keys(GROWTH_AREA) as PlantGrowthArea[])
22
+ area!: PlantGrowthArea;
23
+
24
+ @EnumColumn(Object.keys(GROWTH_HABIT) as PlantGrowthHabit[])
25
+ habit!: PlantGrowthHabit;
26
+
27
+ @Column('text', { nullable: true })
28
+ description?: string;
29
+
30
+ @OneToMany(() => ImageInfo, (image) => image.plantGrowthType, {
31
+ cascade: true,
32
+ })
33
+ images?: ImageInfo[];
34
+
35
+ @Column({ type: 'boolean', default: true })
36
+ isActive!: boolean;
37
+ }
38
+
@@ -0,0 +1,41 @@
1
+ import {
2
+ Entity,
3
+ Column,
4
+ PrimaryGeneratedColumn,
5
+ ManyToOne,
6
+ OneToMany,
7
+ JoinColumn,
8
+ ObjectLiteral,
9
+ } from 'typeorm';
10
+ import { GROWTH_HABIT_GEOM, GrowthHabit } from './catalogs/plant-size';
11
+ import { PlantTechnicalSheet } from './PlantTechnicalSheet';
12
+ import { ImageInfo } from './ImageInfo';
13
+ import { EnumColumn } from './utils/enumColumn';
14
+
15
+ @Entity('plant_size')
16
+ export class PlantSize implements ObjectLiteral {
17
+ @PrimaryGeneratedColumn('increment')
18
+ idPlantSize!: number;
19
+
20
+ @Column('int')
21
+ heightCm!: number;
22
+
23
+ @Column('int', { nullable: true })
24
+ widthCm?: number | null;
25
+
26
+ @EnumColumn(Object.keys(GROWTH_HABIT_GEOM) as GrowthHabit[], { nullable: true })
27
+ habit?: GrowthHabit | undefined;
28
+
29
+ @Column('text', { nullable: true })
30
+ notes?: string | null;
31
+
32
+ @OneToMany(() => ImageInfo, (image) => image.plantSize, {
33
+ cascade: true,
34
+ nullable: true,
35
+ })
36
+ images?: ImageInfo[] | undefined;
37
+
38
+ @Column({ type: 'boolean', default: true })
39
+ isActive!: boolean;
40
+ }
41
+
@@ -0,0 +1,93 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ ObjectLiteral,
6
+ OneToOne,
7
+ JoinColumn,
8
+ OneToMany,
9
+ } from "typeorm";
10
+ import { PlantGrowthType } from "./PlantGrowthType";
11
+ import { LightInfo } from "./LightInfo";
12
+ import { HumidityInfo } from "./HumidityInfo";
13
+ import { ClimateIdeal } from "./ClimateIdeal";
14
+ import { SubstrateInfo } from "./SubstrateInfo";
15
+ import { FertilizationInfo } from "./FertilizationInfo";
16
+ import { PestInfo } from "./PestInfo";
17
+ import { CareInstructions } from "./CareInstructions";
18
+ import { PropagationMethodInfo } from "./PropagationMethodInfo";
19
+ import { PlantSize } from "./PlantSize";
20
+ import { GrowthClassInfo } from "./GrowthClassInfo";
21
+ import { ImageInfo } from "./ImageInfo";
22
+
23
+ @Entity("plant_technical_sheets")
24
+ export class PlantTechnicalSheet implements ObjectLiteral {
25
+ @PrimaryGeneratedColumn("increment")
26
+ idPlantTechnicalSheet!: number;
27
+
28
+ @Column("varchar", { length: 255 })
29
+ commonName!: string;
30
+
31
+ @Column("varchar", { length: 255 })
32
+ scientificName!: string;
33
+
34
+ @Column("varchar", { length: 255 })
35
+ origin!: string;
36
+
37
+ @OneToOne(() => PlantGrowthType, { cascade: true })
38
+ @JoinColumn({ name: "plantGrowthTypeId" })
39
+ plantType!: PlantGrowthType;
40
+
41
+ @OneToOne(() => LightInfo, { cascade: true })
42
+ @JoinColumn({ name: "lightInfoId" })
43
+ light!: LightInfo;
44
+
45
+ @OneToOne(() => HumidityInfo, { cascade: true })
46
+ @JoinColumn({ name: "humidityInfoId" })
47
+ humidity!: HumidityInfo;
48
+
49
+ @OneToOne(() => ClimateIdeal, { cascade: true })
50
+ @JoinColumn({ name: "climateIdealId" })
51
+ climate!: ClimateIdeal;
52
+
53
+ @OneToOne(() => SubstrateInfo, { cascade: true })
54
+ @JoinColumn({ name: "substrateInfoId" })
55
+ substrate!: SubstrateInfo;
56
+
57
+ @OneToOne(() => FertilizationInfo, { cascade: true })
58
+ @JoinColumn({ name: "fertilizationInfoId" })
59
+ fertilization!: FertilizationInfo;
60
+
61
+ @OneToMany(() => PestInfo, (pest) => pest.technicalSheet, {
62
+ cascade: true,
63
+ })
64
+ pests!: PestInfo[];
65
+
66
+ @OneToOne(() => CareInstructions, { cascade: true })
67
+ @JoinColumn({ name: "careInstructionsId" })
68
+ care!: CareInstructions;
69
+
70
+ @OneToOne(() => PropagationMethodInfo, { cascade: true })
71
+ @JoinColumn({ name: "propagationMethodId" })
72
+ propagation!: PropagationMethodInfo;
73
+
74
+ @OneToOne(() => PlantSize, { cascade: true })
75
+ @JoinColumn({ name: "plantSizeId" })
76
+ size!: PlantSize;
77
+
78
+ @OneToOne(() => GrowthClassInfo, { cascade: true })
79
+ @JoinColumn({ name: "growthClassInfoId" })
80
+ growthClass!: GrowthClassInfo;
81
+
82
+ @OneToMany(() => ImageInfo, (img) => img.plantTechnicalSheet, {
83
+ cascade: true,
84
+ })
85
+ images?: ImageInfo[];
86
+
87
+ @Column("text", { nullable: true })
88
+ notes?: string;
89
+
90
+ @Column({ type: "boolean", default: true })
91
+ isActive!: boolean;
92
+ }
93
+
@@ -0,0 +1,33 @@
1
+ import {
2
+ Entity,
3
+ Column,
4
+ PrimaryGeneratedColumn,
5
+ OneToMany,
6
+ ObjectLiteral,
7
+ } from "typeorm";
8
+ import { PropagationMethod, PROPAGATION } from "./catalogs/propagation-method";
9
+ import { ImageInfo } from "./ImageInfo";
10
+ import { EnumColumn } from "./utils/enumColumn";
11
+
12
+ @Entity("propagation_method_info")
13
+ export class PropagationMethodInfo implements ObjectLiteral {
14
+ @PrimaryGeneratedColumn("increment")
15
+ idPropagationMethodInfo!: number;
16
+
17
+ @EnumColumn(Object.keys(PROPAGATION) as PropagationMethod[], {
18
+ nullable: false,
19
+ })
20
+ type!: PropagationMethod | undefined;
21
+
22
+ @Column("text", { nullable: true })
23
+ description?: string | null;
24
+
25
+ @OneToMany(() => ImageInfo, (image) => image.propagationMethod, {
26
+ cascade: true,
27
+ nullable: true,
28
+ })
29
+ images?: ImageInfo[] | undefined;
30
+
31
+ @Column({ type: "boolean", default: true })
32
+ isActive?: boolean | undefined;
33
+ }
@@ -0,0 +1,36 @@
1
+ import {
2
+ Entity,
3
+ Column,
4
+ PrimaryGeneratedColumn,
5
+ OneToMany,
6
+ ObjectLiteral,
7
+ } from 'typeorm';
8
+ import { SubstrateType, SUBSTRATE } from './catalogs/substrate-info';
9
+ import { ImageInfo } from './ImageInfo';
10
+
11
+ import { EnumColumn } from './utils/enumColumn';
12
+
13
+ @Entity('substrate_info')
14
+ export class SubstrateInfo implements ObjectLiteral {
15
+ @PrimaryGeneratedColumn('increment')
16
+ idSubstrateInfo!: number;
17
+
18
+ @EnumColumn(Object.keys(SUBSTRATE) as SubstrateType[])
19
+ type!: SubstrateType;
20
+
21
+ @Column('text', { nullable: true })
22
+ recipe?: string;
23
+
24
+ @Column('text', { nullable: true })
25
+ notes?: string;
26
+
27
+ @OneToMany(() => ImageInfo, (image) => image.substrateInfo, {
28
+ cascade: true,
29
+ nullable: true,
30
+ })
31
+ images?: ImageInfo[];
32
+
33
+ @Column({ type: 'boolean', default: true })
34
+ isActive!: boolean;
35
+ }
36
+