@deepintel-ltd/farmpro-contracts 1.0.4 → 1.1.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.
- package/dist/routes/categories.routes.d.ts +426 -129
- package/dist/routes/categories.routes.d.ts.map +1 -1
- package/dist/routes/categories.routes.js +13 -40
- package/dist/routes/tasks.routes.d.ts +7 -7
- package/dist/schemas/categories.schemas.d.ts +1 -35
- package/dist/schemas/categories.schemas.d.ts.map +1 -1
- package/dist/schemas/categories.schemas.js +2 -6
- package/dist/schemas/tasks.schemas.d.ts +8 -8
- package/dist/schemas/tasks.schemas.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"categories.routes.d.ts","sourceRoot":"","sources":["../../src/routes/categories.routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"categories.routes.d.ts","sourceRoot":"","sources":["../../src/routes/categories.routes.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoF3B,CAAC"}
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.categoriesRouter = void 0;
|
|
4
4
|
const core_1 = require("@ts-rest/core");
|
|
5
5
|
const categories_schemas_1 = require("../schemas/categories.schemas");
|
|
6
|
+
const common_schemas_1 = require("../schemas/common.schemas");
|
|
6
7
|
const zod_1 = require("zod");
|
|
7
8
|
const c = (0, core_1.initContract)();
|
|
8
9
|
/**
|
|
9
10
|
* Categories API contract
|
|
10
|
-
* Provides endpoints for managing categories (
|
|
11
|
+
* Provides endpoints for managing universal categories (can be used for tasks, budgets, expenses)
|
|
11
12
|
*/
|
|
12
13
|
exports.categoriesRouter = c.router({
|
|
13
14
|
/**
|
|
@@ -21,30 +22,22 @@ exports.categoriesRouter = c.router({
|
|
|
21
22
|
responses: {
|
|
22
23
|
200: categories_schemas_1.categoryListResponseSchema,
|
|
23
24
|
},
|
|
24
|
-
summary: 'Get categories
|
|
25
|
-
description: 'Returns system default categories and optionally farm-specific categories.
|
|
25
|
+
summary: 'Get categories',
|
|
26
|
+
description: 'Returns system default categories and optionally farm-specific categories. Categories are universal and can be used for tasks, budgets, and expenses.',
|
|
26
27
|
},
|
|
27
28
|
/**
|
|
28
|
-
* Get default category
|
|
29
|
+
* Get default category
|
|
29
30
|
* Returns the default category that should be used when none is specified
|
|
30
31
|
*/
|
|
31
32
|
getDefaultCategory: {
|
|
32
33
|
method: 'GET',
|
|
33
|
-
path: '/categories/default
|
|
34
|
-
pathParams: zod_1.z.object({
|
|
35
|
-
type: zod_1.z.enum(['task', 'budget', 'expense']),
|
|
36
|
-
}),
|
|
34
|
+
path: '/categories/default',
|
|
37
35
|
responses: {
|
|
38
36
|
200: categories_schemas_1.categoryResponseSchema,
|
|
39
|
-
404:
|
|
40
|
-
error: zod_1.z.object({
|
|
41
|
-
message: zod_1.z.string(),
|
|
42
|
-
code: zod_1.z.string(),
|
|
43
|
-
}),
|
|
44
|
-
}),
|
|
37
|
+
404: common_schemas_1.jsonApiErrorResponseSchema,
|
|
45
38
|
},
|
|
46
|
-
summary: 'Get default category
|
|
47
|
-
description: 'Returns the default category that should be used when creating a task, budget, or expense without specifying a category.',
|
|
39
|
+
summary: 'Get default category',
|
|
40
|
+
description: 'Returns the system-wide default category that should be used when creating a task, budget, or expense without specifying a category.',
|
|
48
41
|
},
|
|
49
42
|
/**
|
|
50
43
|
* Create category
|
|
@@ -56,18 +49,8 @@ exports.categoriesRouter = c.router({
|
|
|
56
49
|
body: categories_schemas_1.createCategorySchema,
|
|
57
50
|
responses: {
|
|
58
51
|
201: categories_schemas_1.categoryResponseSchema,
|
|
59
|
-
400:
|
|
60
|
-
|
|
61
|
-
message: zod_1.z.string(),
|
|
62
|
-
code: zod_1.z.string(),
|
|
63
|
-
}),
|
|
64
|
-
}),
|
|
65
|
-
409: zod_1.z.object({
|
|
66
|
-
error: zod_1.z.object({
|
|
67
|
-
message: zod_1.z.string(),
|
|
68
|
-
code: zod_1.z.string(),
|
|
69
|
-
}),
|
|
70
|
-
}),
|
|
52
|
+
400: common_schemas_1.jsonApiErrorResponseSchema,
|
|
53
|
+
409: common_schemas_1.jsonApiErrorResponseSchema,
|
|
71
54
|
},
|
|
72
55
|
summary: 'Create a new category',
|
|
73
56
|
description: 'Creates a farm-specific category or system default category. Farm-specific categories override system defaults for that farm.',
|
|
@@ -85,12 +68,7 @@ exports.categoriesRouter = c.router({
|
|
|
85
68
|
body: categories_schemas_1.updateCategorySchema,
|
|
86
69
|
responses: {
|
|
87
70
|
200: categories_schemas_1.categoryResponseSchema,
|
|
88
|
-
404:
|
|
89
|
-
error: zod_1.z.object({
|
|
90
|
-
message: zod_1.z.string(),
|
|
91
|
-
code: zod_1.z.string(),
|
|
92
|
-
}),
|
|
93
|
-
}),
|
|
71
|
+
404: common_schemas_1.jsonApiErrorResponseSchema,
|
|
94
72
|
},
|
|
95
73
|
summary: 'Update a category',
|
|
96
74
|
description: 'Updates a farm-specific category. System default categories cannot be updated through this endpoint.',
|
|
@@ -107,12 +85,7 @@ exports.categoriesRouter = c.router({
|
|
|
107
85
|
}),
|
|
108
86
|
responses: {
|
|
109
87
|
204: zod_1.z.object({}),
|
|
110
|
-
404:
|
|
111
|
-
error: zod_1.z.object({
|
|
112
|
-
message: zod_1.z.string(),
|
|
113
|
-
code: zod_1.z.string(),
|
|
114
|
-
}),
|
|
115
|
-
}),
|
|
88
|
+
404: common_schemas_1.jsonApiErrorResponseSchema,
|
|
116
89
|
},
|
|
117
90
|
summary: 'Delete a category',
|
|
118
91
|
description: 'Deletes a farm-specific category. System default categories cannot be deleted.',
|
|
@@ -525,7 +525,7 @@ export declare const tasksRouter: {
|
|
|
525
525
|
fieldId: z.ZodString;
|
|
526
526
|
date: z.ZodString;
|
|
527
527
|
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["pending", "in-progress", "completed", "cancelled"]>>>;
|
|
528
|
-
category: z.
|
|
528
|
+
category: z.ZodString;
|
|
529
529
|
inventoryItemId: z.ZodOptional<z.ZodString>;
|
|
530
530
|
plannedQuantity: z.ZodOptional<z.ZodNumber>;
|
|
531
531
|
assignedTo: z.ZodOptional<z.ZodString>;
|
|
@@ -534,8 +534,8 @@ export declare const tasksRouter: {
|
|
|
534
534
|
date: string;
|
|
535
535
|
title: string;
|
|
536
536
|
fieldId: string;
|
|
537
|
+
category: string;
|
|
537
538
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
538
|
-
category?: string | undefined;
|
|
539
539
|
inventoryItemId?: string | undefined;
|
|
540
540
|
plannedQuantity?: number | undefined;
|
|
541
541
|
assignedTo?: string | undefined;
|
|
@@ -544,8 +544,8 @@ export declare const tasksRouter: {
|
|
|
544
544
|
date: string;
|
|
545
545
|
title: string;
|
|
546
546
|
fieldId: string;
|
|
547
|
+
category: string;
|
|
547
548
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
548
|
-
category?: string | undefined;
|
|
549
549
|
inventoryItemId?: string | undefined;
|
|
550
550
|
plannedQuantity?: number | undefined;
|
|
551
551
|
assignedTo?: string | undefined;
|
|
@@ -557,8 +557,8 @@ export declare const tasksRouter: {
|
|
|
557
557
|
date: string;
|
|
558
558
|
title: string;
|
|
559
559
|
fieldId: string;
|
|
560
|
+
category: string;
|
|
560
561
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
561
|
-
category?: string | undefined;
|
|
562
562
|
inventoryItemId?: string | undefined;
|
|
563
563
|
plannedQuantity?: number | undefined;
|
|
564
564
|
assignedTo?: string | undefined;
|
|
@@ -570,8 +570,8 @@ export declare const tasksRouter: {
|
|
|
570
570
|
date: string;
|
|
571
571
|
title: string;
|
|
572
572
|
fieldId: string;
|
|
573
|
+
category: string;
|
|
573
574
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
574
|
-
category?: string | undefined;
|
|
575
575
|
inventoryItemId?: string | undefined;
|
|
576
576
|
plannedQuantity?: number | undefined;
|
|
577
577
|
assignedTo?: string | undefined;
|
|
@@ -585,8 +585,8 @@ export declare const tasksRouter: {
|
|
|
585
585
|
date: string;
|
|
586
586
|
title: string;
|
|
587
587
|
fieldId: string;
|
|
588
|
+
category: string;
|
|
588
589
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
589
|
-
category?: string | undefined;
|
|
590
590
|
inventoryItemId?: string | undefined;
|
|
591
591
|
plannedQuantity?: number | undefined;
|
|
592
592
|
assignedTo?: string | undefined;
|
|
@@ -600,8 +600,8 @@ export declare const tasksRouter: {
|
|
|
600
600
|
date: string;
|
|
601
601
|
title: string;
|
|
602
602
|
fieldId: string;
|
|
603
|
+
category: string;
|
|
603
604
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
604
|
-
category?: string | undefined;
|
|
605
605
|
inventoryItemId?: string | undefined;
|
|
606
606
|
plannedQuantity?: number | undefined;
|
|
607
607
|
assignedTo?: string | undefined;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Category schemas - JSON:API compliant
|
|
4
|
+
* Categories are universal and can be used for tasks, budgets, and expenses
|
|
4
5
|
*/
|
|
5
|
-
export declare const categoryTypeSchema: z.ZodEnum<["task", "budget", "expense"]>;
|
|
6
6
|
export declare const categoryAttributesSchema: z.ZodObject<{
|
|
7
7
|
name: z.ZodString;
|
|
8
|
-
type: z.ZodEnum<["task", "budget", "expense"]>;
|
|
9
8
|
farmId: z.ZodNullable<z.ZodString>;
|
|
10
9
|
isDefault: z.ZodBoolean;
|
|
11
10
|
} & {
|
|
12
11
|
createdAt: z.ZodString;
|
|
13
12
|
updatedAt: z.ZodString;
|
|
14
13
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
type: "expense" | "task" | "budget";
|
|
16
14
|
createdAt: string;
|
|
17
15
|
updatedAt: string;
|
|
18
16
|
name: string;
|
|
19
17
|
farmId: string | null;
|
|
20
18
|
isDefault: boolean;
|
|
21
19
|
}, {
|
|
22
|
-
type: "expense" | "task" | "budget";
|
|
23
20
|
createdAt: string;
|
|
24
21
|
updatedAt: string;
|
|
25
22
|
name: string;
|
|
@@ -28,16 +25,13 @@ export declare const categoryAttributesSchema: z.ZodObject<{
|
|
|
28
25
|
}>;
|
|
29
26
|
export declare const createCategoryAttributesSchema: z.ZodObject<{
|
|
30
27
|
name: z.ZodString;
|
|
31
|
-
type: z.ZodEnum<["task", "budget", "expense"]>;
|
|
32
28
|
farmId: z.ZodOptional<z.ZodString>;
|
|
33
29
|
isDefault: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
34
30
|
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
type: "expense" | "task" | "budget";
|
|
36
31
|
name: string;
|
|
37
32
|
isDefault: boolean;
|
|
38
33
|
farmId?: string | undefined;
|
|
39
34
|
}, {
|
|
40
|
-
type: "expense" | "task" | "budget";
|
|
41
35
|
name: string;
|
|
42
36
|
farmId?: string | undefined;
|
|
43
37
|
isDefault?: boolean | undefined;
|
|
@@ -56,16 +50,13 @@ export declare const createCategorySchema: z.ZodObject<{
|
|
|
56
50
|
type: z.ZodLiteral<"categories">;
|
|
57
51
|
attributes: z.ZodObject<{
|
|
58
52
|
name: z.ZodString;
|
|
59
|
-
type: z.ZodEnum<["task", "budget", "expense"]>;
|
|
60
53
|
farmId: z.ZodOptional<z.ZodString>;
|
|
61
54
|
isDefault: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
62
55
|
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
type: "expense" | "task" | "budget";
|
|
64
56
|
name: string;
|
|
65
57
|
isDefault: boolean;
|
|
66
58
|
farmId?: string | undefined;
|
|
67
59
|
}, {
|
|
68
|
-
type: "expense" | "task" | "budget";
|
|
69
60
|
name: string;
|
|
70
61
|
farmId?: string | undefined;
|
|
71
62
|
isDefault?: boolean | undefined;
|
|
@@ -73,7 +64,6 @@ export declare const createCategorySchema: z.ZodObject<{
|
|
|
73
64
|
}, "strip", z.ZodTypeAny, {
|
|
74
65
|
type: "categories";
|
|
75
66
|
attributes: {
|
|
76
|
-
type: "expense" | "task" | "budget";
|
|
77
67
|
name: string;
|
|
78
68
|
isDefault: boolean;
|
|
79
69
|
farmId?: string | undefined;
|
|
@@ -81,7 +71,6 @@ export declare const createCategorySchema: z.ZodObject<{
|
|
|
81
71
|
}, {
|
|
82
72
|
type: "categories";
|
|
83
73
|
attributes: {
|
|
84
|
-
type: "expense" | "task" | "budget";
|
|
85
74
|
name: string;
|
|
86
75
|
farmId?: string | undefined;
|
|
87
76
|
isDefault?: boolean | undefined;
|
|
@@ -120,21 +109,18 @@ export declare const categoryResourceSchema: z.ZodObject<{
|
|
|
120
109
|
id: z.ZodString;
|
|
121
110
|
attributes: z.ZodObject<{
|
|
122
111
|
name: z.ZodString;
|
|
123
|
-
type: z.ZodEnum<["task", "budget", "expense"]>;
|
|
124
112
|
farmId: z.ZodNullable<z.ZodString>;
|
|
125
113
|
isDefault: z.ZodBoolean;
|
|
126
114
|
} & {
|
|
127
115
|
createdAt: z.ZodString;
|
|
128
116
|
updatedAt: z.ZodString;
|
|
129
117
|
}, "strip", z.ZodTypeAny, {
|
|
130
|
-
type: "expense" | "task" | "budget";
|
|
131
118
|
createdAt: string;
|
|
132
119
|
updatedAt: string;
|
|
133
120
|
name: string;
|
|
134
121
|
farmId: string | null;
|
|
135
122
|
isDefault: boolean;
|
|
136
123
|
}, {
|
|
137
|
-
type: "expense" | "task" | "budget";
|
|
138
124
|
createdAt: string;
|
|
139
125
|
updatedAt: string;
|
|
140
126
|
name: string;
|
|
@@ -148,7 +134,6 @@ export declare const categoryResourceSchema: z.ZodObject<{
|
|
|
148
134
|
type: string;
|
|
149
135
|
id: string;
|
|
150
136
|
attributes: {
|
|
151
|
-
type: "expense" | "task" | "budget";
|
|
152
137
|
createdAt: string;
|
|
153
138
|
updatedAt: string;
|
|
154
139
|
name: string;
|
|
@@ -162,7 +147,6 @@ export declare const categoryResourceSchema: z.ZodObject<{
|
|
|
162
147
|
type: string;
|
|
163
148
|
id: string;
|
|
164
149
|
attributes: {
|
|
165
|
-
type: "expense" | "task" | "budget";
|
|
166
150
|
createdAt: string;
|
|
167
151
|
updatedAt: string;
|
|
168
152
|
name: string;
|
|
@@ -179,21 +163,18 @@ export declare const categoryResponseSchema: z.ZodObject<{
|
|
|
179
163
|
id: z.ZodString;
|
|
180
164
|
attributes: z.ZodObject<{
|
|
181
165
|
name: z.ZodString;
|
|
182
|
-
type: z.ZodEnum<["task", "budget", "expense"]>;
|
|
183
166
|
farmId: z.ZodNullable<z.ZodString>;
|
|
184
167
|
isDefault: z.ZodBoolean;
|
|
185
168
|
} & {
|
|
186
169
|
createdAt: z.ZodString;
|
|
187
170
|
updatedAt: z.ZodString;
|
|
188
171
|
}, "strip", z.ZodTypeAny, {
|
|
189
|
-
type: "expense" | "task" | "budget";
|
|
190
172
|
createdAt: string;
|
|
191
173
|
updatedAt: string;
|
|
192
174
|
name: string;
|
|
193
175
|
farmId: string | null;
|
|
194
176
|
isDefault: boolean;
|
|
195
177
|
}, {
|
|
196
|
-
type: "expense" | "task" | "budget";
|
|
197
178
|
createdAt: string;
|
|
198
179
|
updatedAt: string;
|
|
199
180
|
name: string;
|
|
@@ -207,7 +188,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
|
|
|
207
188
|
type: string;
|
|
208
189
|
id: string;
|
|
209
190
|
attributes: {
|
|
210
|
-
type: "expense" | "task" | "budget";
|
|
211
191
|
createdAt: string;
|
|
212
192
|
updatedAt: string;
|
|
213
193
|
name: string;
|
|
@@ -221,7 +201,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
|
|
|
221
201
|
type: string;
|
|
222
202
|
id: string;
|
|
223
203
|
attributes: {
|
|
224
|
-
type: "expense" | "task" | "budget";
|
|
225
204
|
createdAt: string;
|
|
226
205
|
updatedAt: string;
|
|
227
206
|
name: string;
|
|
@@ -261,7 +240,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
|
|
|
261
240
|
type: string;
|
|
262
241
|
id: string;
|
|
263
242
|
attributes: {
|
|
264
|
-
type: "expense" | "task" | "budget";
|
|
265
243
|
createdAt: string;
|
|
266
244
|
updatedAt: string;
|
|
267
245
|
name: string;
|
|
@@ -287,7 +265,6 @@ export declare const categoryResponseSchema: z.ZodObject<{
|
|
|
287
265
|
type: string;
|
|
288
266
|
id: string;
|
|
289
267
|
attributes: {
|
|
290
|
-
type: "expense" | "task" | "budget";
|
|
291
268
|
createdAt: string;
|
|
292
269
|
updatedAt: string;
|
|
293
270
|
name: string;
|
|
@@ -315,21 +292,18 @@ export declare const categoryListResponseSchema: z.ZodObject<{
|
|
|
315
292
|
id: z.ZodString;
|
|
316
293
|
attributes: z.ZodObject<{
|
|
317
294
|
name: z.ZodString;
|
|
318
|
-
type: z.ZodEnum<["task", "budget", "expense"]>;
|
|
319
295
|
farmId: z.ZodNullable<z.ZodString>;
|
|
320
296
|
isDefault: z.ZodBoolean;
|
|
321
297
|
} & {
|
|
322
298
|
createdAt: z.ZodString;
|
|
323
299
|
updatedAt: z.ZodString;
|
|
324
300
|
}, "strip", z.ZodTypeAny, {
|
|
325
|
-
type: "expense" | "task" | "budget";
|
|
326
301
|
createdAt: string;
|
|
327
302
|
updatedAt: string;
|
|
328
303
|
name: string;
|
|
329
304
|
farmId: string | null;
|
|
330
305
|
isDefault: boolean;
|
|
331
306
|
}, {
|
|
332
|
-
type: "expense" | "task" | "budget";
|
|
333
307
|
createdAt: string;
|
|
334
308
|
updatedAt: string;
|
|
335
309
|
name: string;
|
|
@@ -343,7 +317,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
|
|
|
343
317
|
type: string;
|
|
344
318
|
id: string;
|
|
345
319
|
attributes: {
|
|
346
|
-
type: "expense" | "task" | "budget";
|
|
347
320
|
createdAt: string;
|
|
348
321
|
updatedAt: string;
|
|
349
322
|
name: string;
|
|
@@ -357,7 +330,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
|
|
|
357
330
|
type: string;
|
|
358
331
|
id: string;
|
|
359
332
|
attributes: {
|
|
360
|
-
type: "expense" | "task" | "budget";
|
|
361
333
|
createdAt: string;
|
|
362
334
|
updatedAt: string;
|
|
363
335
|
name: string;
|
|
@@ -397,7 +369,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
|
|
|
397
369
|
type: string;
|
|
398
370
|
id: string;
|
|
399
371
|
attributes: {
|
|
400
|
-
type: "expense" | "task" | "budget";
|
|
401
372
|
createdAt: string;
|
|
402
373
|
updatedAt: string;
|
|
403
374
|
name: string;
|
|
@@ -423,7 +394,6 @@ export declare const categoryListResponseSchema: z.ZodObject<{
|
|
|
423
394
|
type: string;
|
|
424
395
|
id: string;
|
|
425
396
|
attributes: {
|
|
426
|
-
type: "expense" | "task" | "budget";
|
|
427
397
|
createdAt: string;
|
|
428
398
|
updatedAt: string;
|
|
429
399
|
name: string;
|
|
@@ -446,19 +416,15 @@ export declare const categoryListResponseSchema: z.ZodObject<{
|
|
|
446
416
|
}[] | undefined;
|
|
447
417
|
}>;
|
|
448
418
|
export declare const getCategoriesQuerySchema: z.ZodObject<{
|
|
449
|
-
type: z.ZodOptional<z.ZodEnum<["task", "budget", "expense"]>>;
|
|
450
419
|
farmId: z.ZodOptional<z.ZodString>;
|
|
451
420
|
includeDefaults: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
452
421
|
}, "strip", z.ZodTypeAny, {
|
|
453
422
|
includeDefaults: boolean;
|
|
454
|
-
type?: "expense" | "task" | "budget" | undefined;
|
|
455
423
|
farmId?: string | undefined;
|
|
456
424
|
}, {
|
|
457
|
-
type?: "expense" | "task" | "budget" | undefined;
|
|
458
425
|
farmId?: string | undefined;
|
|
459
426
|
includeDefaults?: boolean | undefined;
|
|
460
427
|
}>;
|
|
461
|
-
export type CategoryType = z.infer<typeof categoryTypeSchema>;
|
|
462
428
|
export type CreateCategoryAttributes = z.infer<typeof createCategoryAttributesSchema>;
|
|
463
429
|
export type UpdateCategoryAttributes = z.infer<typeof updateCategoryAttributesSchema>;
|
|
464
430
|
export type CreateCategoryInput = z.infer<typeof createCategorySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"categories.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/categories.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB
|
|
1
|
+
{"version":3,"file":"categories.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/categories.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;GAGG;AAGH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;EAIX,CAAC;AAG3B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;EAIzC,CAAC;AAGH,eAAO,MAAM,8BAA8B;;;;;;;;;EAGzC,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AAGH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/B,CAAC;AAGH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsE,CAAC;AAG1G,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsD,CAAC;AAC1F,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA0D,CAAC;AAGlG,eAAO,MAAM,wBAAwB;;;;;;;;;EAGnC,CAAC;AAGH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCategoriesQuerySchema = exports.categoryListResponseSchema = exports.categoryResponseSchema = exports.categoryResourceSchema = exports.updateCategorySchema = exports.createCategorySchema = exports.updateCategoryAttributesSchema = exports.createCategoryAttributesSchema = exports.categoryAttributesSchema =
|
|
3
|
+
exports.getCategoriesQuerySchema = exports.categoryListResponseSchema = exports.categoryResponseSchema = exports.categoryResourceSchema = exports.updateCategorySchema = exports.createCategorySchema = exports.updateCategoryAttributesSchema = exports.createCategoryAttributesSchema = exports.categoryAttributesSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const common_schemas_1 = require("./common.schemas");
|
|
6
6
|
/**
|
|
7
7
|
* Category schemas - JSON:API compliant
|
|
8
|
+
* Categories are universal and can be used for tasks, budgets, and expenses
|
|
8
9
|
*/
|
|
9
|
-
// Category type enum
|
|
10
|
-
exports.categoryTypeSchema = zod_1.z.enum(['task', 'budget', 'expense']);
|
|
11
10
|
// Category attributes schema (for JSON:API attributes object)
|
|
12
11
|
exports.categoryAttributesSchema = zod_1.z.object({
|
|
13
12
|
name: zod_1.z.string(),
|
|
14
|
-
type: exports.categoryTypeSchema,
|
|
15
13
|
farmId: zod_1.z.string().uuid().nullable(),
|
|
16
14
|
isDefault: zod_1.z.boolean(),
|
|
17
15
|
}).merge(common_schemas_1.timestampsSchema);
|
|
18
16
|
// Category attributes for creation (input)
|
|
19
17
|
exports.createCategoryAttributesSchema = zod_1.z.object({
|
|
20
18
|
name: zod_1.z.string().min(1).max(100),
|
|
21
|
-
type: exports.categoryTypeSchema,
|
|
22
19
|
farmId: zod_1.z.string().uuid().optional(), // Optional - if not provided, creates system default
|
|
23
20
|
isDefault: zod_1.z.boolean().optional().default(false),
|
|
24
21
|
});
|
|
@@ -45,7 +42,6 @@ exports.categoryResponseSchema = (0, common_schemas_1.jsonApiSingleResponseSchem
|
|
|
45
42
|
exports.categoryListResponseSchema = (0, common_schemas_1.jsonApiCollectionResponseSchema)(exports.categoryResourceSchema);
|
|
46
43
|
// Get categories query parameters
|
|
47
44
|
exports.getCategoriesQuerySchema = zod_1.z.object({
|
|
48
|
-
type: exports.categoryTypeSchema.optional(),
|
|
49
45
|
farmId: zod_1.z.string().uuid().optional(),
|
|
50
46
|
includeDefaults: zod_1.z.boolean().optional().default(true),
|
|
51
47
|
});
|
|
@@ -121,7 +121,7 @@ export declare const createTaskAttributesSchema: z.ZodObject<{
|
|
|
121
121
|
fieldId: z.ZodString;
|
|
122
122
|
date: z.ZodString;
|
|
123
123
|
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["pending", "in-progress", "completed", "cancelled"]>>>;
|
|
124
|
-
category: z.
|
|
124
|
+
category: z.ZodString;
|
|
125
125
|
inventoryItemId: z.ZodOptional<z.ZodString>;
|
|
126
126
|
plannedQuantity: z.ZodOptional<z.ZodNumber>;
|
|
127
127
|
assignedTo: z.ZodOptional<z.ZodString>;
|
|
@@ -130,8 +130,8 @@ export declare const createTaskAttributesSchema: z.ZodObject<{
|
|
|
130
130
|
date: string;
|
|
131
131
|
title: string;
|
|
132
132
|
fieldId: string;
|
|
133
|
+
category: string;
|
|
133
134
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
134
|
-
category?: string | undefined;
|
|
135
135
|
inventoryItemId?: string | undefined;
|
|
136
136
|
plannedQuantity?: number | undefined;
|
|
137
137
|
assignedTo?: string | undefined;
|
|
@@ -140,8 +140,8 @@ export declare const createTaskAttributesSchema: z.ZodObject<{
|
|
|
140
140
|
date: string;
|
|
141
141
|
title: string;
|
|
142
142
|
fieldId: string;
|
|
143
|
+
category: string;
|
|
143
144
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
144
|
-
category?: string | undefined;
|
|
145
145
|
inventoryItemId?: string | undefined;
|
|
146
146
|
plannedQuantity?: number | undefined;
|
|
147
147
|
assignedTo?: string | undefined;
|
|
@@ -205,7 +205,7 @@ export declare const createTaskSchema: z.ZodObject<{
|
|
|
205
205
|
fieldId: z.ZodString;
|
|
206
206
|
date: z.ZodString;
|
|
207
207
|
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["pending", "in-progress", "completed", "cancelled"]>>>;
|
|
208
|
-
category: z.
|
|
208
|
+
category: z.ZodString;
|
|
209
209
|
inventoryItemId: z.ZodOptional<z.ZodString>;
|
|
210
210
|
plannedQuantity: z.ZodOptional<z.ZodNumber>;
|
|
211
211
|
assignedTo: z.ZodOptional<z.ZodString>;
|
|
@@ -214,8 +214,8 @@ export declare const createTaskSchema: z.ZodObject<{
|
|
|
214
214
|
date: string;
|
|
215
215
|
title: string;
|
|
216
216
|
fieldId: string;
|
|
217
|
+
category: string;
|
|
217
218
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
218
|
-
category?: string | undefined;
|
|
219
219
|
inventoryItemId?: string | undefined;
|
|
220
220
|
plannedQuantity?: number | undefined;
|
|
221
221
|
assignedTo?: string | undefined;
|
|
@@ -224,8 +224,8 @@ export declare const createTaskSchema: z.ZodObject<{
|
|
|
224
224
|
date: string;
|
|
225
225
|
title: string;
|
|
226
226
|
fieldId: string;
|
|
227
|
+
category: string;
|
|
227
228
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
228
|
-
category?: string | undefined;
|
|
229
229
|
inventoryItemId?: string | undefined;
|
|
230
230
|
plannedQuantity?: number | undefined;
|
|
231
231
|
assignedTo?: string | undefined;
|
|
@@ -237,8 +237,8 @@ export declare const createTaskSchema: z.ZodObject<{
|
|
|
237
237
|
date: string;
|
|
238
238
|
title: string;
|
|
239
239
|
fieldId: string;
|
|
240
|
+
category: string;
|
|
240
241
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
241
|
-
category?: string | undefined;
|
|
242
242
|
inventoryItemId?: string | undefined;
|
|
243
243
|
plannedQuantity?: number | undefined;
|
|
244
244
|
assignedTo?: string | undefined;
|
|
@@ -250,8 +250,8 @@ export declare const createTaskSchema: z.ZodObject<{
|
|
|
250
250
|
date: string;
|
|
251
251
|
title: string;
|
|
252
252
|
fieldId: string;
|
|
253
|
+
category: string;
|
|
253
254
|
status?: "pending" | "in-progress" | "completed" | "cancelled" | undefined;
|
|
254
|
-
category?: string | undefined;
|
|
255
255
|
inventoryItemId?: string | undefined;
|
|
256
256
|
plannedQuantity?: number | undefined;
|
|
257
257
|
assignedTo?: string | undefined;
|
|
@@ -44,7 +44,7 @@ exports.createTaskAttributesSchema = zod_1.z.object({
|
|
|
44
44
|
fieldId: zod_1.z.string().uuid(),
|
|
45
45
|
date: zod_1.z.string().datetime(),
|
|
46
46
|
status: exports.taskStatusSchema.default('pending').optional(),
|
|
47
|
-
category: zod_1.z.string().min(1).max(100)
|
|
47
|
+
category: zod_1.z.string().min(1).max(100), // Required - frontend should use default category if user doesn't select
|
|
48
48
|
// Inventory linking
|
|
49
49
|
inventoryItemId: zod_1.z.string().uuid().optional(),
|
|
50
50
|
plannedQuantity: zod_1.z.number().positive().optional(),
|