@la-main-verte/shared-types 1.0.57 → 1.0.59

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/src/plant.d.ts CHANGED
@@ -1,85 +1,98 @@
1
- export interface PlantI {
2
- id: number
3
- name: string
4
- slug: string
5
- description: string
6
- descriptionSource?: string
7
- female: boolean
8
- family?: string | null
9
- spaceBetweenSeedMin: number
10
- spaceBetweenSeedMax: number
11
- spaceBetweenAlleyMin: number
12
- spaceBetweenAlleyMax: number
13
- weeksInTransplant: number
14
- weeksDuringWhichYouCanSeedOutdoor: number
15
- weeksToMaturity: number
16
- weeksToWaitAfterFreezingDate: number
17
- weeksToHarvest: number
18
- indoorSeeding: boolean
19
- outdoorSeeding: boolean
20
- azoteNeedsKgPerHa: number
21
- hibernate: boolean
22
- germinationTemperature: number | null
23
- minGerminationTemperature: number | null
24
- germinationNumberOfDays: string | null
25
- germinationSeedDepth: string | null
26
- cultivationInfo: string | null
27
- parentId: number | null
28
- memberId?: number
29
- shared: boolean
30
- hexColor: string | null
31
- sunRequirements: 'partialShade' | 'fullSun' | 'fullShade' | null
32
- isHardy: boolean | null
33
- imageURL: string
34
- totalWeeksToMaturity: number
35
- hasNoInformation: boolean
36
- createdAt: Date
37
- updatedAt: Date
38
- translatedSunRequirements: 'Plein soleil' | 'Mi-ombre' | 'Ombre' | null
39
- parent?: PlantI
40
- children?: PlantI[]
41
- PlantInventories?: PlantInventoryI[]
42
- taggedItems?: TaggedItemI[]
43
- /**
44
- * List of selections that the plant is in.
45
- * --------------------------------------
46
- * Tends to be used for featured selections
47
- */
48
- Selections?: SelectionI[]
49
- tasks?: TaskI[]
50
- Images?: ImageI[]
51
- notes?: NoteI[]
52
- rotationFamily?: string
53
- }
54
-
55
- interface PlantTagI {
56
- name: string
57
- /**
58
- * Font color of the tag
59
- * Ex: #ffffff
60
- */
61
- fontColor: string
62
- /**
63
- * Background color of the tag
64
- * Ex: #1B76E6
65
- */
66
- backgroundColor: string
67
- /**
68
- * Font awesome Icon name
69
- * Ex: 'tomato'
70
- */
71
- iconName: string
72
- /** Selection slug related to the tag */
73
- slug: string
74
- }
75
-
76
- interface PlantInventoryI {
77
- id: number
78
- plantId: number
79
- supplierName: string
80
- plantName: string
81
- supplierURL: string
82
- imageLocation: string
83
- description: string
84
- inStock: boolean
85
- }
1
+ import type { TaxonFamilyI } from './taxonFamily'
2
+ /**
3
+ * Plant filter value types
4
+ * Represents the possible values for a single filter
5
+ */
6
+ export type PlantFilterValueI = string | string[] | number | boolean
7
+
8
+ /**
9
+ * Plant attributes for filtering
10
+ * Used in JSONB field and as query parameters
11
+ * Supports multiple value types for different filter types
12
+ */
13
+ export type PlantAttributesI = Record<string, PlantFilterValueI>
14
+
15
+ export interface PlantI {
16
+ id: number
17
+ name: string
18
+ slug: string
19
+ description: string
20
+ descriptionSource?: string
21
+ female: boolean
22
+ family?: string | null
23
+ taxonFamilyId?: number | null
24
+ spaceBetweenSeedMin: number
25
+ spaceBetweenSeedMax: number
26
+ spaceBetweenAlleyMin: number
27
+ spaceBetweenAlleyMax: number
28
+ weeksInTransplant: number
29
+ weeksDuringWhichYouCanSeedOutdoor: number
30
+ weeksToMaturity: number
31
+ weeksToWaitAfterFreezingDate: number
32
+ weeksToHarvest: number
33
+ indoorSeeding: boolean
34
+ outdoorSeeding: boolean
35
+ azoteNeedsKgPerHa: number
36
+ hibernate: boolean
37
+ germinationTemperature: number | null
38
+ minGerminationTemperature: number | null
39
+ germinationNumberOfDays: string | null
40
+ germinationSeedDepth: string | null
41
+ cultivationInfo: string | null
42
+ parentId: number | null
43
+ memberId?: number
44
+ shared: boolean
45
+ hexColor: string | null
46
+ sunRequirements: 'partialShade' | 'fullSun' | 'fullShade' | null
47
+ isHardy: boolean | null
48
+ imageURL: string
49
+ totalWeeksToMaturity: number
50
+ hasNoInformation: boolean
51
+ createdAt: Date
52
+ updatedAt: Date
53
+ translatedSunRequirements: 'Plein soleil' | 'Mi-ombre' | 'Ombre' | null
54
+ parent?: PlantI
55
+ children?: PlantI[]
56
+ PlantInventories?: PlantInventoryI[]
57
+ taggedItems?: TaggedItemI[]
58
+ /**
59
+ * List of selections that the plant is in.
60
+ * --------------------------------------
61
+ * Tends to be used for featured selections
62
+ */
63
+ Selections?: SelectionI[]
64
+ tasks?: TaskI[]
65
+ Images?: ImageI[]
66
+ notes?: NoteI[]
67
+ rotationGroup?: string
68
+ // @deprecate once v1.8.1 is fully adopted
69
+ rotationFamily?: string
70
+ taxonFamily?: TaxonFamilyI
71
+ }
72
+
73
+ interface PlantTagI {
74
+ name: string
75
+ /**
76
+ * JSONB field containing plant-specific attributes for filtering
77
+ * Ex: { growth: { type: 'déterminée' }, fruit: { color: 'rouge' } }
78
+ */
79
+ attributes?: PlantAttributesI
80
+ }
81
+
82
+ interface PlantInventoryI {
83
+ id: number
84
+ plantId: number
85
+ supplierName: string
86
+ plantName: string
87
+ supplierURL: string
88
+ imageLocation: string
89
+ description: string
90
+ inStock: boolean
91
+ }
92
+
93
+ export interface PlantSearchResultI {
94
+ plants: PlantModelI[]
95
+ selections: SelectionModelI[]
96
+ total?: number
97
+ familyName?: string
98
+ }
@@ -0,0 +1,19 @@
1
+ export interface PlantFiltersConfigI {
2
+ filters: PlantFilterI[]
3
+ helpText?: string
4
+ }
5
+
6
+ export interface PlantFilterI {
7
+ key: string // Path in the JSONB (ex: "growth.type")
8
+ label: string // Label to display
9
+ type: 'select' | 'multiselect' | 'boolean' | 'range'
10
+ isMain?: boolean // If true, displayed as button filter; if false/undefined, in modal
11
+ options?: FilterOptionI[] // For select/multiselect
12
+ min?: number // For range
13
+ max?: number // For range
14
+ }
15
+
16
+ export interface FilterOptionI {
17
+ value: string
18
+ label: string
19
+ }
@@ -1,13 +1,13 @@
1
- import { PlantI } from './plant.d.ts'
2
- import { SelectionI } from './selection.d.ts'
3
-
4
- export interface PlantSelectionI {
5
- id: number
6
- plantId: number
7
- selectionId: number
8
- seedQuantity: number
9
- createdAt: Date
10
- updatedAt: Date
11
- Plant: PlantI
12
- Selection: SelectionI
13
- }
1
+ import { PlantI } from './plant.d.ts'
2
+ import { SelectionI } from './selection.d.ts'
3
+
4
+ export interface PlantSelectionI {
5
+ id: number
6
+ plantId: number
7
+ selectionId: number
8
+ seedQuantity: number
9
+ createdAt: Date
10
+ updatedAt: Date
11
+ Plant: PlantI
12
+ Selection: SelectionI
13
+ }
@@ -1,84 +1,92 @@
1
- import { PlantI } from './plant.d'
2
- import { SelectionI } from './selection.d'
3
- import { ImageDataI } from './image.d'
4
-
5
- interface PlantExtendedDataI extends PlantI {
6
- /**
7
- * Future plant images gallery for now using notes as a proxy
8
- */
9
- Images: ImageDataI[]
10
- /**
11
- * Selections of the plant
12
- */
13
- Selections: SelectionI[]
14
- }
15
-
16
- export namespace PLANTS {
17
- export namespace RECOMMENDATIONS {
18
- /**
19
- * Request parameters for plant recommendations
20
- * @remarks identification by session token is optional
21
- */
22
- export interface Request {
23
- headers?: {
24
- 'x-session-token'?: string
25
- }
26
- }
27
- /**
28
- * Response containing recommended plants with their tags
29
- */
30
- export type Response = PlantExtendedDataI[]
31
- }
32
- export namespace SEARCH {
33
- /**
34
- * Request parameters for plant recommendations
35
- * @remarks identification by session token is optional
36
- */
37
- export interface Request {
38
- headers?: {
39
- 'x-session-token'?: string
40
- }
41
- query?: {
42
- withAzoteNeedsKgPerHa?: boolean
43
- withSpacing?: boolean
44
- parentsOnly?: boolean
45
- search?: string
46
- family?: string
47
- limit?: number
48
- /**
49
- * If submitted, it means we are searching for plants that can be planted in the given garden zone.
50
- * It almost means:
51
- * - withSpacing will be set to true automatically.
52
- * - Plant.contextualSearchText may be added to the results to provided additional contextual information to the search results (and therefore the member)
53
- */
54
- gardenZoneId?: string | number
55
- }
56
- }
57
- /**
58
- * Response containing search plants with their tags
59
- */
60
- export type Response = PlantExtendedDataI[]
61
- }
62
- export namespace UPDATE {
63
- export interface Request {
64
- params: {
65
- slug: string
66
- }
67
- body: {
68
- name?: string
69
- description?: string
70
- shared?: boolean
71
- spaceBetweenSeedMin?: number | null
72
- spaceBetweenSeedMax?: number | null
73
- spaceBetweenAlleyMin?: number | null
74
- spaceBetweenAlleyMax?: number | null
75
- weeksToMaturity?: number | null
76
- indoorSeeding?: boolean
77
- outdoorSeeding?: boolean
78
- sunRequirements?: 'partialShade' | 'fullSun' | 'fullShade' | null
79
- isHardy?: boolean | null
80
- }
81
- }
82
- export type Response = PlantI
83
- }
84
- }
1
+ import { PlantI } from './plant.d'
2
+ import { SelectionI } from './selection.d'
3
+ import { ImageDataI } from './image.d'
4
+
5
+ interface PlantExtendedDataI extends PlantI {
6
+ /**
7
+ * Future plant images gallery for now using notes as a proxy
8
+ */
9
+ Images: ImageDataI[]
10
+ /**
11
+ * Selections of the plant
12
+ */
13
+ Selections: SelectionI[]
14
+ }
15
+
16
+ export namespace PLANTS {
17
+ export namespace RECOMMENDATIONS {
18
+ /**
19
+ * Request parameters for plant recommendations
20
+ * @remarks identification by session token is optional
21
+ */
22
+ export interface Request {
23
+ headers?: {
24
+ 'x-session-token'?: string
25
+ }
26
+ query?: {
27
+ gardenZoneId?: string | number
28
+ selectionSlug?: string
29
+ }
30
+ }
31
+ export type RecommendedPlantI = PlantExtendedDataI & {
32
+ contextualSearchText?: string
33
+ }
34
+ export type Response = RecommendedPlantI[]
35
+ }
36
+ export namespace SEARCH {
37
+ /**
38
+ * Request parameters for plant recommendations
39
+ * @remarks identification by session token is optional
40
+ */
41
+ export interface Request {
42
+ headers?: {
43
+ 'x-session-token'?: string
44
+ }
45
+ query?: {
46
+ withAzoteNeedsKgPerHa?: boolean
47
+ withSpacing?: boolean
48
+ parentsOnly?: boolean
49
+ search?: string
50
+ family?: string
51
+ limit?: number
52
+ /**
53
+ * If submitted, it means we are searching for plants that can be planted in the given garden zone.
54
+ * It almost means:
55
+ * - withSpacing will be set to true automatically.
56
+ * - Plant.contextualSearchText may be added to the results to provided additional contextual information to the search results (and therefore the member)
57
+ */
58
+ gardenZoneId?: string | number
59
+ /**
60
+ * Slug of the selection currently being edited. Used to contextualize rotation insights for search results.
61
+ */
62
+ selectionSlug?: string
63
+ }
64
+ }
65
+ /**
66
+ * Response containing search plants with their tags
67
+ */
68
+ export type Response = PlantExtendedDataI[]
69
+ }
70
+ export namespace UPDATE {
71
+ export interface Request {
72
+ params: {
73
+ slug: string
74
+ }
75
+ body: {
76
+ name?: string
77
+ description?: string
78
+ shared?: boolean
79
+ spaceBetweenSeedMin?: number | null
80
+ spaceBetweenSeedMax?: number | null
81
+ spaceBetweenAlleyMin?: number | null
82
+ spaceBetweenAlleyMax?: number | null
83
+ weeksToMaturity?: number | null
84
+ indoorSeeding?: boolean
85
+ outdoorSeeding?: boolean
86
+ sunRequirements?: 'partialShade' | 'fullSun' | 'fullShade' | null
87
+ isHardy?: boolean | null
88
+ }
89
+ }
90
+ export type Response = PlantI
91
+ }
92
+ }
@@ -0,0 +1,3 @@
1
+ export type RotationGroup = 'regenerative' | 'demanding' | 'moderately_demanding' | 'less_demanding'
2
+
3
+ export const ROTATION_GROUPS: RotationGroup[] = ['regenerative', 'demanding', 'moderately_demanding', 'less_demanding']
@@ -1,55 +1,55 @@
1
- import { PlantI } from './plant'
2
-
3
- export interface SelectionI {
4
- id: number
5
- memberId: number
6
- title: string
7
- slug: string
8
- description?: string
9
- orderBy?: 'startDate' | 'name'
10
- default?: boolean
11
- viewsCount?: number
12
- imageLocation?: string
13
- imageURL?: string
14
- /**
15
- * Indicates if the selection is featured on the app (search, explore, etc).
16
- **/
17
- featured: boolean
18
- /**
19
- * Indicates if the selection is dynamically generated on the fly by the API.
20
- * Ex: "What you can seed in March"
21
- * INTERNAL USE ONLY
22
- */
23
- isDynamic: boolean
24
- /**
25
- * Background color of the selection, for UI purposes.
26
- */
27
- backgroundColor: string | null
28
- /**
29
- * Font color of the selection, for UI purposes.
30
- */
31
- fontColor: string | null
32
- /**
33
- * Font awesome icon name of the selection, for UI purposes.
34
- * -----------------------------------------
35
- * Not all icons are available in the react-native-app. Must be explicitly declared first.
36
- * Ex: 'fa-bag-seedling', 'fa-bug', etc.
37
- */
38
- iconName: string | null
39
- link?: string
40
- sharingURL?: string
41
- createdAt: Date
42
- updatedAt: Date
43
- Plants?: PlantI[]
44
- yearOfCulture: number
45
- }
46
-
47
- /**
48
- * Those are the different possible types for a selection.
49
- */
50
- export type SelectionType = 'Serre' | 'Potager' | 'Recette' | 'Coup de coeur' | "Jardin d'intérieur" | 'Autres'
51
-
52
- export interface SelectionTypeI {
53
- name: SelectionType
54
- iconName?: IconName
55
- }
1
+ import { PlantI } from './plant'
2
+
3
+ export interface SelectionI {
4
+ id: number
5
+ memberId: number
6
+ title: string
7
+ slug: string
8
+ description?: string
9
+ orderBy?: 'startDate' | 'name'
10
+ default?: boolean
11
+ viewsCount?: number
12
+ imageLocation?: string
13
+ imageURL?: string
14
+ /**
15
+ * Indicates if the selection is featured on the app (search, explore, etc).
16
+ **/
17
+ featured: boolean
18
+ /**
19
+ * Indicates if the selection is dynamically generated on the fly by the API.
20
+ * Ex: "What you can seed in March"
21
+ * INTERNAL USE ONLY
22
+ */
23
+ isDynamic: boolean
24
+ /**
25
+ * Background color of the selection, for UI purposes.
26
+ */
27
+ backgroundColor: string | null
28
+ /**
29
+ * Font color of the selection, for UI purposes.
30
+ */
31
+ fontColor: string | null
32
+ /**
33
+ * Font awesome icon name of the selection, for UI purposes.
34
+ * -----------------------------------------
35
+ * Not all icons are available in the react-native-app. Must be explicitly declared first.
36
+ * Ex: 'fa-bag-seedling', 'fa-bug', etc.
37
+ */
38
+ iconName: string | null
39
+ link?: string
40
+ sharingURL?: string
41
+ createdAt: Date
42
+ updatedAt: Date
43
+ Plants?: PlantI[]
44
+ yearOfCulture: number
45
+ }
46
+
47
+ /**
48
+ * Those are the different possible types for a selection.
49
+ */
50
+ export type SelectionType = 'Serre' | 'Potager' | 'Recette' | 'Coup de coeur' | "Jardin d'intérieur" | 'Autres'
51
+
52
+ export interface SelectionTypeI {
53
+ name: SelectionType
54
+ iconName?: IconName
55
+ }