@deepintel-ltd/farmpro-contracts 1.5.8 → 1.5.9

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 (53) hide show
  1. package/dist/index.js +50 -92
  2. package/dist/routes/admin.routes.js +13 -16
  3. package/dist/routes/agent-workflows.routes.js +81 -84
  4. package/dist/routes/agents.routes.js +29 -32
  5. package/dist/routes/analytics.routes.js +11 -14
  6. package/dist/routes/auth.routes.js +55 -58
  7. package/dist/routes/categories.routes.js +23 -26
  8. package/dist/routes/documents.routes.js +67 -70
  9. package/dist/routes/equipment.routes.js +55 -58
  10. package/dist/routes/farms.routes.js +32 -35
  11. package/dist/routes/field-monitoring.routes.js +70 -73
  12. package/dist/routes/field-observations.routes.js +41 -44
  13. package/dist/routes/fields.routes.js +44 -47
  14. package/dist/routes/finance.routes.js +121 -124
  15. package/dist/routes/harvest.routes.js +46 -49
  16. package/dist/routes/health.routes.js +6 -9
  17. package/dist/routes/index.js +51 -54
  18. package/dist/routes/input-usage.routes.js +14 -17
  19. package/dist/routes/inventory.routes.js +57 -60
  20. package/dist/routes/seasonal-plans.routes.js +14 -17
  21. package/dist/routes/soil-tests.routes.js +45 -48
  22. package/dist/routes/suppliers.routes.js +70 -73
  23. package/dist/routes/tasks.routes.js +65 -68
  24. package/dist/routes/team.routes.js +57 -60
  25. package/dist/routes/users.routes.js +13 -16
  26. package/dist/routes/weather.routes.js +10 -13
  27. package/dist/schemas/admin.schemas.js +43 -46
  28. package/dist/schemas/agent-workflows.schemas.js +34 -37
  29. package/dist/schemas/agents.schemas.js +46 -49
  30. package/dist/schemas/analytics.schemas.js +51 -54
  31. package/dist/schemas/auth.schemas.js +96 -99
  32. package/dist/schemas/categories.schemas.js +27 -30
  33. package/dist/schemas/common.schemas.js +89 -95
  34. package/dist/schemas/documents.schemas.js +59 -62
  35. package/dist/schemas/equipment.schemas.js +86 -89
  36. package/dist/schemas/farms.schemas.js +40 -43
  37. package/dist/schemas/field-monitoring.schemas.js +207 -210
  38. package/dist/schemas/field-observations.schemas.js +93 -96
  39. package/dist/schemas/fields.schemas.js +82 -85
  40. package/dist/schemas/finance.schemas.js +134 -137
  41. package/dist/schemas/harvest.schemas.js +46 -49
  42. package/dist/schemas/health.schemas.js +14 -17
  43. package/dist/schemas/input-usage.schemas.js +21 -24
  44. package/dist/schemas/inventory.schemas.js +58 -61
  45. package/dist/schemas/recommendations.schemas.js +22 -25
  46. package/dist/schemas/seasonal-plans.schemas.js +21 -24
  47. package/dist/schemas/soil-tests.schemas.js +70 -73
  48. package/dist/schemas/suppliers.schemas.js +90 -93
  49. package/dist/schemas/tasks.schemas.js +93 -96
  50. package/dist/schemas/team.schemas.js +35 -38
  51. package/dist/schemas/users.schemas.js +19 -22
  52. package/dist/schemas/weather.schemas.js +32 -35
  53. package/package.json +9 -1
@@ -1,22 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.authRouter = void 0;
4
- const core_1 = require("@ts-rest/core");
5
- const zod_1 = require("zod");
6
- const auth_schemas_1 = require("../schemas/auth.schemas");
7
- const common_schemas_1 = require("../schemas/common.schemas");
8
- const c = (0, core_1.initContract)();
9
- exports.authRouter = c.router({
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import { loginSchema, signupSchema, googleAuthInitiateSchema, googleAuthCallbackSchema, refreshTokenSchema, requestPasswordResetSchema, resetPasswordSchema, changePasswordSchema, verifyEmailSchema, resendVerificationSchema, logoutSchema, authResponseSchema, googleAuthInitiateResponseSchema, refreshTokenResponseSchema, passwordResetResponseSchema, logoutResponseSchema, emailVerificationResponseSchema, } from '../schemas/auth.schemas';
4
+ import { jsonApiErrorResponseSchema } from '../schemas/common.schemas';
5
+ const c = initContract();
6
+ export const authRouter = c.router({
10
7
  // Login with email/password
11
8
  login: {
12
9
  method: 'POST',
13
10
  path: '/auth/login',
14
- body: zod_1.z.object({ data: auth_schemas_1.loginSchema }),
11
+ body: z.object({ data: loginSchema }),
15
12
  responses: {
16
- 200: auth_schemas_1.authResponseSchema,
17
- 401: common_schemas_1.jsonApiErrorResponseSchema,
18
- 400: common_schemas_1.jsonApiErrorResponseSchema,
19
- 422: common_schemas_1.jsonApiErrorResponseSchema,
13
+ 200: authResponseSchema,
14
+ 401: jsonApiErrorResponseSchema,
15
+ 400: jsonApiErrorResponseSchema,
16
+ 422: jsonApiErrorResponseSchema,
20
17
  },
21
18
  summary: 'Login with email and password',
22
19
  description: 'Authenticate user with email and password, returns user data and tokens',
@@ -25,12 +22,12 @@ exports.authRouter = c.router({
25
22
  signup: {
26
23
  method: 'POST',
27
24
  path: '/auth/signup',
28
- body: zod_1.z.object({ data: auth_schemas_1.signupSchema }),
25
+ body: z.object({ data: signupSchema }),
29
26
  responses: {
30
- 201: auth_schemas_1.authResponseSchema,
31
- 400: common_schemas_1.jsonApiErrorResponseSchema,
32
- 409: common_schemas_1.jsonApiErrorResponseSchema,
33
- 422: common_schemas_1.jsonApiErrorResponseSchema,
27
+ 201: authResponseSchema,
28
+ 400: jsonApiErrorResponseSchema,
29
+ 409: jsonApiErrorResponseSchema,
30
+ 422: jsonApiErrorResponseSchema,
34
31
  },
35
32
  summary: 'Register new user',
36
33
  description: 'Create a new user account with email and password',
@@ -39,11 +36,11 @@ exports.authRouter = c.router({
39
36
  googleAuthInitiate: {
40
37
  method: 'POST',
41
38
  path: '/auth/google/initiate',
42
- body: zod_1.z.object({ data: auth_schemas_1.googleAuthInitiateSchema }),
39
+ body: z.object({ data: googleAuthInitiateSchema }),
43
40
  responses: {
44
- 200: auth_schemas_1.googleAuthInitiateResponseSchema,
45
- 400: common_schemas_1.jsonApiErrorResponseSchema,
46
- 422: common_schemas_1.jsonApiErrorResponseSchema,
41
+ 200: googleAuthInitiateResponseSchema,
42
+ 400: jsonApiErrorResponseSchema,
43
+ 422: jsonApiErrorResponseSchema,
47
44
  },
48
45
  summary: 'Initiate Google OAuth flow',
49
46
  description: 'Get Google OAuth authorization URL and state token',
@@ -52,12 +49,12 @@ exports.authRouter = c.router({
52
49
  googleAuthCallback: {
53
50
  method: 'POST',
54
51
  path: '/auth/google/callback',
55
- body: zod_1.z.object({ data: auth_schemas_1.googleAuthCallbackSchema }),
52
+ body: z.object({ data: googleAuthCallbackSchema }),
56
53
  responses: {
57
- 200: auth_schemas_1.authResponseSchema,
58
- 400: common_schemas_1.jsonApiErrorResponseSchema,
59
- 401: common_schemas_1.jsonApiErrorResponseSchema,
60
- 422: common_schemas_1.jsonApiErrorResponseSchema,
54
+ 200: authResponseSchema,
55
+ 400: jsonApiErrorResponseSchema,
56
+ 401: jsonApiErrorResponseSchema,
57
+ 422: jsonApiErrorResponseSchema,
61
58
  },
62
59
  summary: 'Handle Google OAuth callback',
63
60
  description: 'Exchange Google OAuth code for access and refresh tokens',
@@ -66,11 +63,11 @@ exports.authRouter = c.router({
66
63
  refreshToken: {
67
64
  method: 'POST',
68
65
  path: '/auth/refresh',
69
- body: zod_1.z.object({ data: auth_schemas_1.refreshTokenSchema }),
66
+ body: z.object({ data: refreshTokenSchema }),
70
67
  responses: {
71
- 200: auth_schemas_1.refreshTokenResponseSchema,
72
- 401: common_schemas_1.jsonApiErrorResponseSchema,
73
- 422: common_schemas_1.jsonApiErrorResponseSchema,
68
+ 200: refreshTokenResponseSchema,
69
+ 401: jsonApiErrorResponseSchema,
70
+ 422: jsonApiErrorResponseSchema,
74
71
  },
75
72
  summary: 'Refresh access token',
76
73
  description: 'Get a new access token using a valid refresh token',
@@ -79,10 +76,10 @@ exports.authRouter = c.router({
79
76
  logout: {
80
77
  method: 'POST',
81
78
  path: '/auth/logout',
82
- body: zod_1.z.object({ data: auth_schemas_1.logoutSchema }),
79
+ body: z.object({ data: logoutSchema }),
83
80
  responses: {
84
- 200: auth_schemas_1.logoutResponseSchema,
85
- 401: common_schemas_1.jsonApiErrorResponseSchema,
81
+ 200: logoutResponseSchema,
82
+ 401: jsonApiErrorResponseSchema,
86
83
  },
87
84
  summary: 'Logout user',
88
85
  description: 'Invalidate user session and optionally refresh token',
@@ -91,11 +88,11 @@ exports.authRouter = c.router({
91
88
  requestPasswordReset: {
92
89
  method: 'POST',
93
90
  path: '/auth/password/reset-request',
94
- body: zod_1.z.object({ data: auth_schemas_1.requestPasswordResetSchema }),
91
+ body: z.object({ data: requestPasswordResetSchema }),
95
92
  responses: {
96
- 200: auth_schemas_1.passwordResetResponseSchema,
97
- 400: common_schemas_1.jsonApiErrorResponseSchema,
98
- 422: common_schemas_1.jsonApiErrorResponseSchema,
93
+ 200: passwordResetResponseSchema,
94
+ 400: jsonApiErrorResponseSchema,
95
+ 422: jsonApiErrorResponseSchema,
99
96
  },
100
97
  summary: 'Request password reset',
101
98
  description: 'Send password reset email to user',
@@ -104,12 +101,12 @@ exports.authRouter = c.router({
104
101
  resetPassword: {
105
102
  method: 'POST',
106
103
  path: '/auth/password/reset',
107
- body: zod_1.z.object({ data: auth_schemas_1.resetPasswordSchema }),
104
+ body: z.object({ data: resetPasswordSchema }),
108
105
  responses: {
109
- 200: auth_schemas_1.passwordResetResponseSchema,
110
- 400: common_schemas_1.jsonApiErrorResponseSchema,
111
- 401: common_schemas_1.jsonApiErrorResponseSchema,
112
- 422: common_schemas_1.jsonApiErrorResponseSchema,
106
+ 200: passwordResetResponseSchema,
107
+ 400: jsonApiErrorResponseSchema,
108
+ 401: jsonApiErrorResponseSchema,
109
+ 422: jsonApiErrorResponseSchema,
113
110
  },
114
111
  summary: 'Reset password',
115
112
  description: 'Reset password using token from email',
@@ -118,12 +115,12 @@ exports.authRouter = c.router({
118
115
  changePassword: {
119
116
  method: 'POST',
120
117
  path: '/auth/password/change',
121
- body: zod_1.z.object({ data: auth_schemas_1.changePasswordSchema }),
118
+ body: z.object({ data: changePasswordSchema }),
122
119
  responses: {
123
- 200: auth_schemas_1.passwordResetResponseSchema,
124
- 400: common_schemas_1.jsonApiErrorResponseSchema,
125
- 401: common_schemas_1.jsonApiErrorResponseSchema,
126
- 422: common_schemas_1.jsonApiErrorResponseSchema,
120
+ 200: passwordResetResponseSchema,
121
+ 400: jsonApiErrorResponseSchema,
122
+ 401: jsonApiErrorResponseSchema,
123
+ 422: jsonApiErrorResponseSchema,
127
124
  },
128
125
  summary: 'Change password',
129
126
  description: 'Change password for authenticated user',
@@ -132,12 +129,12 @@ exports.authRouter = c.router({
132
129
  verifyEmail: {
133
130
  method: 'POST',
134
131
  path: '/auth/email/verify',
135
- body: zod_1.z.object({ data: auth_schemas_1.verifyEmailSchema }),
132
+ body: z.object({ data: verifyEmailSchema }),
136
133
  responses: {
137
- 200: auth_schemas_1.emailVerificationResponseSchema,
138
- 400: common_schemas_1.jsonApiErrorResponseSchema,
139
- 401: common_schemas_1.jsonApiErrorResponseSchema,
140
- 422: common_schemas_1.jsonApiErrorResponseSchema,
134
+ 200: emailVerificationResponseSchema,
135
+ 400: jsonApiErrorResponseSchema,
136
+ 401: jsonApiErrorResponseSchema,
137
+ 422: jsonApiErrorResponseSchema,
141
138
  },
142
139
  summary: 'Verify email address',
143
140
  description: 'Verify email address using token from email',
@@ -146,11 +143,11 @@ exports.authRouter = c.router({
146
143
  resendVerification: {
147
144
  method: 'POST',
148
145
  path: '/auth/email/resend-verification',
149
- body: zod_1.z.object({ data: auth_schemas_1.resendVerificationSchema }),
146
+ body: z.object({ data: resendVerificationSchema }),
150
147
  responses: {
151
- 200: auth_schemas_1.emailVerificationResponseSchema,
152
- 400: common_schemas_1.jsonApiErrorResponseSchema,
153
- 422: common_schemas_1.jsonApiErrorResponseSchema,
148
+ 200: emailVerificationResponseSchema,
149
+ 400: jsonApiErrorResponseSchema,
150
+ 422: jsonApiErrorResponseSchema,
154
151
  },
155
152
  summary: 'Resend verification email',
156
153
  description: 'Resend email verification link',
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.categoriesRouter = void 0;
4
- const core_1 = require("@ts-rest/core");
5
- const categories_schemas_1 = require("../schemas/categories.schemas");
6
- const common_schemas_1 = require("../schemas/common.schemas");
7
- const zod_1 = require("zod");
8
- const c = (0, core_1.initContract)();
1
+ import { initContract } from '@ts-rest/core';
2
+ import { categoryListResponseSchema, categoryResponseSchema, createCategorySchema, updateCategorySchema, getCategoriesQuerySchema, } from '../schemas/categories.schemas';
3
+ import { jsonApiErrorResponseSchema } from '../schemas/common.schemas';
4
+ import { z } from 'zod';
5
+ const c = initContract();
9
6
  /**
10
7
  * Categories API contract
11
8
  * Provides endpoints for managing universal categories (can be used for tasks, budgets, expenses)
12
9
  */
13
- exports.categoriesRouter = c.router({
10
+ export const categoriesRouter = c.router({
14
11
  /**
15
12
  * Get categories
16
13
  * Returns system defaults and optionally farm-specific categories
@@ -18,9 +15,9 @@ exports.categoriesRouter = c.router({
18
15
  getCategories: {
19
16
  method: 'GET',
20
17
  path: '/categories',
21
- query: categories_schemas_1.getCategoriesQuerySchema,
18
+ query: getCategoriesQuerySchema,
22
19
  responses: {
23
- 200: categories_schemas_1.categoryListResponseSchema,
20
+ 200: categoryListResponseSchema,
24
21
  },
25
22
  summary: 'Get categories',
26
23
  description: 'Returns system default categories and optionally farm-specific categories. Categories are universal and can be used for tasks, budgets, and expenses.',
@@ -33,8 +30,8 @@ exports.categoriesRouter = c.router({
33
30
  method: 'GET',
34
31
  path: '/categories/default',
35
32
  responses: {
36
- 200: categories_schemas_1.categoryResponseSchema,
37
- 404: common_schemas_1.jsonApiErrorResponseSchema,
33
+ 200: categoryResponseSchema,
34
+ 404: jsonApiErrorResponseSchema,
38
35
  },
39
36
  summary: 'Get default category',
40
37
  description: 'Returns the system-wide default category that should be used when creating a task, budget, or expense without specifying a category.',
@@ -46,11 +43,11 @@ exports.categoriesRouter = c.router({
46
43
  createCategory: {
47
44
  method: 'POST',
48
45
  path: '/categories',
49
- body: categories_schemas_1.createCategorySchema,
46
+ body: createCategorySchema,
50
47
  responses: {
51
- 201: categories_schemas_1.categoryResponseSchema,
52
- 400: common_schemas_1.jsonApiErrorResponseSchema,
53
- 409: common_schemas_1.jsonApiErrorResponseSchema,
48
+ 201: categoryResponseSchema,
49
+ 400: jsonApiErrorResponseSchema,
50
+ 409: jsonApiErrorResponseSchema,
54
51
  },
55
52
  summary: 'Create a new category',
56
53
  description: 'Creates a farm-specific category or system default category. Farm-specific categories override system defaults for that farm.',
@@ -62,13 +59,13 @@ exports.categoriesRouter = c.router({
62
59
  updateCategory: {
63
60
  method: 'PATCH',
64
61
  path: '/categories/:id',
65
- pathParams: zod_1.z.object({
66
- id: zod_1.z.string().uuid(),
62
+ pathParams: z.object({
63
+ id: z.string().uuid(),
67
64
  }),
68
- body: categories_schemas_1.updateCategorySchema,
65
+ body: updateCategorySchema,
69
66
  responses: {
70
- 200: categories_schemas_1.categoryResponseSchema,
71
- 404: common_schemas_1.jsonApiErrorResponseSchema,
67
+ 200: categoryResponseSchema,
68
+ 404: jsonApiErrorResponseSchema,
72
69
  },
73
70
  summary: 'Update a category',
74
71
  description: 'Updates a farm-specific category. System default categories cannot be updated through this endpoint.',
@@ -80,12 +77,12 @@ exports.categoriesRouter = c.router({
80
77
  deleteCategory: {
81
78
  method: 'DELETE',
82
79
  path: '/categories/:id',
83
- pathParams: zod_1.z.object({
84
- id: zod_1.z.string().uuid(),
80
+ pathParams: z.object({
81
+ id: z.string().uuid(),
85
82
  }),
86
83
  responses: {
87
- 204: zod_1.z.object({}),
88
- 404: common_schemas_1.jsonApiErrorResponseSchema,
84
+ 204: z.object({}),
85
+ 404: jsonApiErrorResponseSchema,
89
86
  },
90
87
  summary: 'Delete a category',
91
88
  description: 'Deletes a farm-specific category. System default categories cannot be deleted.',
@@ -1,30 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.documentsRouter = void 0;
4
- const core_1 = require("@ts-rest/core");
5
- const zod_1 = require("zod");
6
- const documents_schemas_1 = require("../schemas/documents.schemas");
7
- const common_schemas_1 = require("../schemas/common.schemas");
8
- const c = (0, core_1.initContract)();
9
- exports.documentsRouter = c.router({
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import { createDocumentSchema, updateDocumentSchema, documentResponseSchema, documentListResponseSchema, uploadedFileResponseSchema, uploadFileBodySchema, documentTypeSchema, relatedEntityTypeSchema, } from '../schemas/documents.schemas';
4
+ import { jsonApiErrorResponseSchema, jsonApiSuccessResponseSchema, jsonApiPaginationQuerySchema, jsonApiSortQuerySchema, jsonApiIncludeQuerySchema, jsonApiFilterQuerySchema } from '../schemas/common.schemas';
5
+ const c = initContract();
6
+ export const documentsRouter = c.router({
10
7
  // List documents for a farm
11
8
  listDocuments: {
12
9
  method: 'GET',
13
10
  path: '/farms/:farmId/documents',
14
- pathParams: zod_1.z.object({ farmId: zod_1.z.string().uuid() }),
15
- query: common_schemas_1.jsonApiPaginationQuerySchema
16
- .merge(common_schemas_1.jsonApiSortQuerySchema)
17
- .merge(common_schemas_1.jsonApiIncludeQuerySchema)
18
- .merge(common_schemas_1.jsonApiFilterQuerySchema)
19
- .merge(zod_1.z.object({
20
- 'filter[type]': documents_schemas_1.documentTypeSchema.optional(),
21
- 'filter[relatedToType]': documents_schemas_1.relatedEntityTypeSchema.optional(),
22
- 'filter[relatedToId]': zod_1.z.string().uuid().optional(),
11
+ pathParams: z.object({ farmId: z.string().uuid() }),
12
+ query: jsonApiPaginationQuerySchema
13
+ .merge(jsonApiSortQuerySchema)
14
+ .merge(jsonApiIncludeQuerySchema)
15
+ .merge(jsonApiFilterQuerySchema)
16
+ .merge(z.object({
17
+ 'filter[type]': documentTypeSchema.optional(),
18
+ 'filter[relatedToType]': relatedEntityTypeSchema.optional(),
19
+ 'filter[relatedToId]': z.string().uuid().optional(),
23
20
  })),
24
21
  responses: {
25
- 200: documents_schemas_1.documentListResponseSchema,
26
- 404: common_schemas_1.jsonApiErrorResponseSchema,
27
- 401: common_schemas_1.jsonApiErrorResponseSchema,
22
+ 200: documentListResponseSchema,
23
+ 404: jsonApiErrorResponseSchema,
24
+ 401: jsonApiErrorResponseSchema,
28
25
  },
29
26
  summary: 'List documents',
30
27
  description: 'Get all documents for a farm with optional filtering',
@@ -34,13 +31,13 @@ exports.documentsRouter = c.router({
34
31
  method: 'POST',
35
32
  path: '/farms/:farmId/documents/upload',
36
33
  contentType: 'multipart/form-data',
37
- pathParams: zod_1.z.object({ farmId: zod_1.z.string().uuid() }),
38
- body: zod_1.z.union([documents_schemas_1.uploadFileBodySchema, zod_1.z.undefined()]),
34
+ pathParams: z.object({ farmId: z.string().uuid() }),
35
+ body: z.union([uploadFileBodySchema, z.undefined()]),
39
36
  responses: {
40
- 200: documents_schemas_1.uploadedFileResponseSchema,
41
- 400: common_schemas_1.jsonApiErrorResponseSchema,
42
- 404: common_schemas_1.jsonApiErrorResponseSchema,
43
- 401: common_schemas_1.jsonApiErrorResponseSchema,
37
+ 200: uploadedFileResponseSchema,
38
+ 400: jsonApiErrorResponseSchema,
39
+ 404: jsonApiErrorResponseSchema,
40
+ 401: jsonApiErrorResponseSchema,
44
41
  },
45
42
  summary: 'Upload document file',
46
43
  description: 'Upload a file and get back the file URL in JSON:API format',
@@ -50,16 +47,16 @@ exports.documentsRouter = c.router({
50
47
  method: 'POST',
51
48
  path: '/farms/:farmId/documents/:id/upload',
52
49
  contentType: 'multipart/form-data',
53
- pathParams: zod_1.z.object({
54
- farmId: zod_1.z.string().uuid(),
55
- id: zod_1.z.string().uuid(),
50
+ pathParams: z.object({
51
+ farmId: z.string().uuid(),
52
+ id: z.string().uuid(),
56
53
  }),
57
- body: documents_schemas_1.uploadFileBodySchema,
54
+ body: uploadFileBodySchema,
58
55
  responses: {
59
- 200: documents_schemas_1.documentResponseSchema,
60
- 400: common_schemas_1.jsonApiErrorResponseSchema,
61
- 404: common_schemas_1.jsonApiErrorResponseSchema,
62
- 401: common_schemas_1.jsonApiErrorResponseSchema,
56
+ 200: documentResponseSchema,
57
+ 400: jsonApiErrorResponseSchema,
58
+ 404: jsonApiErrorResponseSchema,
59
+ 401: jsonApiErrorResponseSchema,
63
60
  },
64
61
  summary: 'Upload file to existing document',
65
62
  description: 'Upload a file to an existing document record and update it with the file URL',
@@ -68,14 +65,14 @@ exports.documentsRouter = c.router({
68
65
  createDocument: {
69
66
  method: 'POST',
70
67
  path: '/farms/:farmId/documents',
71
- pathParams: zod_1.z.object({ farmId: zod_1.z.string().uuid() }),
72
- body: zod_1.z.object({ data: documents_schemas_1.createDocumentSchema }),
68
+ pathParams: z.object({ farmId: z.string().uuid() }),
69
+ body: z.object({ data: createDocumentSchema }),
73
70
  responses: {
74
- 201: documents_schemas_1.documentResponseSchema,
75
- 400: common_schemas_1.jsonApiErrorResponseSchema,
76
- 404: common_schemas_1.jsonApiErrorResponseSchema,
77
- 401: common_schemas_1.jsonApiErrorResponseSchema,
78
- 422: common_schemas_1.jsonApiErrorResponseSchema,
71
+ 201: documentResponseSchema,
72
+ 400: jsonApiErrorResponseSchema,
73
+ 404: jsonApiErrorResponseSchema,
74
+ 401: jsonApiErrorResponseSchema,
75
+ 422: jsonApiErrorResponseSchema,
79
76
  },
80
77
  summary: 'Create document',
81
78
  description: 'Upload and register a new document',
@@ -84,15 +81,15 @@ exports.documentsRouter = c.router({
84
81
  getDocument: {
85
82
  method: 'GET',
86
83
  path: '/farms/:farmId/documents/:id',
87
- pathParams: zod_1.z.object({
88
- farmId: zod_1.z.string().uuid(),
89
- id: zod_1.z.string().uuid(),
84
+ pathParams: z.object({
85
+ farmId: z.string().uuid(),
86
+ id: z.string().uuid(),
90
87
  }),
91
- query: common_schemas_1.jsonApiIncludeQuerySchema,
88
+ query: jsonApiIncludeQuerySchema,
92
89
  responses: {
93
- 200: documents_schemas_1.documentResponseSchema,
94
- 404: common_schemas_1.jsonApiErrorResponseSchema,
95
- 401: common_schemas_1.jsonApiErrorResponseSchema,
90
+ 200: documentResponseSchema,
91
+ 404: jsonApiErrorResponseSchema,
92
+ 401: jsonApiErrorResponseSchema,
96
93
  },
97
94
  summary: 'Get document by ID',
98
95
  description: 'Get detailed information about a document',
@@ -101,17 +98,17 @@ exports.documentsRouter = c.router({
101
98
  updateDocument: {
102
99
  method: 'PATCH',
103
100
  path: '/farms/:farmId/documents/:id',
104
- pathParams: zod_1.z.object({
105
- farmId: zod_1.z.string().uuid(),
106
- id: zod_1.z.string().uuid(),
101
+ pathParams: z.object({
102
+ farmId: z.string().uuid(),
103
+ id: z.string().uuid(),
107
104
  }),
108
- body: zod_1.z.object({ data: documents_schemas_1.updateDocumentSchema }),
105
+ body: z.object({ data: updateDocumentSchema }),
109
106
  responses: {
110
- 200: documents_schemas_1.documentResponseSchema,
111
- 400: common_schemas_1.jsonApiErrorResponseSchema,
112
- 404: common_schemas_1.jsonApiErrorResponseSchema,
113
- 401: common_schemas_1.jsonApiErrorResponseSchema,
114
- 422: common_schemas_1.jsonApiErrorResponseSchema,
107
+ 200: documentResponseSchema,
108
+ 400: jsonApiErrorResponseSchema,
109
+ 404: jsonApiErrorResponseSchema,
110
+ 401: jsonApiErrorResponseSchema,
111
+ 422: jsonApiErrorResponseSchema,
115
112
  },
116
113
  summary: 'Update document',
117
114
  description: 'Update document metadata',
@@ -120,14 +117,14 @@ exports.documentsRouter = c.router({
120
117
  deleteDocument: {
121
118
  method: 'DELETE',
122
119
  path: '/farms/:farmId/documents/:id',
123
- pathParams: zod_1.z.object({
124
- farmId: zod_1.z.string().uuid(),
125
- id: zod_1.z.string().uuid(),
120
+ pathParams: z.object({
121
+ farmId: z.string().uuid(),
122
+ id: z.string().uuid(),
126
123
  }),
127
124
  responses: {
128
- 204: common_schemas_1.jsonApiSuccessResponseSchema,
129
- 404: common_schemas_1.jsonApiErrorResponseSchema,
130
- 401: common_schemas_1.jsonApiErrorResponseSchema,
125
+ 204: jsonApiSuccessResponseSchema,
126
+ 404: jsonApiErrorResponseSchema,
127
+ 401: jsonApiErrorResponseSchema,
131
128
  },
132
129
  summary: 'Delete document',
133
130
  description: 'Delete a document record',
@@ -135,14 +132,14 @@ exports.documentsRouter = c.router({
135
132
  viewDocument: {
136
133
  method: 'GET',
137
134
  path: '/documents/view/:docId',
138
- pathParams: zod_1.z.object({
139
- docId: zod_1.z.string(),
135
+ pathParams: z.object({
136
+ docId: z.string(),
140
137
  }),
141
138
  responses: {
142
- 200: zod_1.z.any(),
143
- 404: common_schemas_1.jsonApiErrorResponseSchema,
144
- 401: common_schemas_1.jsonApiErrorResponseSchema,
145
- 403: common_schemas_1.jsonApiErrorResponseSchema,
139
+ 200: z.any(),
140
+ 404: jsonApiErrorResponseSchema,
141
+ 401: jsonApiErrorResponseSchema,
142
+ 403: jsonApiErrorResponseSchema,
146
143
  },
147
144
  summary: 'View document file',
148
145
  description: 'Stream or download a document file by its UUID. Extension is optional - both /documents/view/{docId} and /documents/view/{docId}.{ext} work for the same file.',