@deepintel-ltd/farmpro-contracts 1.7.3 → 1.7.5

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"livestock.routes.d.ts","sourceRoot":"","sources":["../../src/routes/livestock.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6BxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoN1B,CAAC"}
@@ -0,0 +1,206 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import { createLivestockSchema, updateLivestockSchema, createHealthRecordSchema, createWeightRecordSchema, createMovementRecordSchema, livestockResponseSchema, livestockListResponseSchema, healthRecordResponseSchema, healthRecordListResponseSchema, weightRecordResponseSchema, movementRecordResponseSchema, movementRecordListResponseSchema, livestockStatsResponseSchema, livestockCategorySchema, livestockStatusSchema, livestockSexSchema, } from '../schemas/livestock.schemas';
4
+ import { jsonApiErrorResponseSchema, jsonApiSuccessResponseSchema, jsonApiPaginationQuerySchema, jsonApiSortQuerySchema, jsonApiIncludeQuerySchema, } from '../schemas/common.schemas';
5
+ const c = initContract();
6
+ export const livestockRouter = c.router({
7
+ // List livestock for a farm
8
+ listLivestock: {
9
+ method: 'GET',
10
+ path: '/farms/:farmId/livestock',
11
+ pathParams: z.object({ farmId: z.string().uuid() }),
12
+ query: jsonApiPaginationQuerySchema
13
+ .merge(jsonApiSortQuerySchema)
14
+ .merge(jsonApiIncludeQuerySchema)
15
+ .merge(z.object({
16
+ 'filter[category]': livestockCategorySchema.optional(),
17
+ 'filter[status]': livestockStatusSchema.optional(),
18
+ 'filter[sex]': livestockSexSchema.optional(),
19
+ 'filter[breed]': z.string().optional(),
20
+ 'filter[groupId]': z.string().optional(),
21
+ 'filter[location]': z.string().optional(),
22
+ search: z.string().optional(), // Search by tagId or name
23
+ })),
24
+ responses: {
25
+ 200: livestockListResponseSchema,
26
+ 404: jsonApiErrorResponseSchema,
27
+ 401: jsonApiErrorResponseSchema,
28
+ },
29
+ summary: 'List livestock',
30
+ description: 'Get all livestock for a farm with optional filtering',
31
+ },
32
+ // Get livestock statistics
33
+ getLivestockStats: {
34
+ method: 'GET',
35
+ path: '/farms/:farmId/livestock/stats',
36
+ pathParams: z.object({ farmId: z.string().uuid() }),
37
+ responses: {
38
+ 200: livestockStatsResponseSchema,
39
+ 404: jsonApiErrorResponseSchema,
40
+ 401: jsonApiErrorResponseSchema,
41
+ },
42
+ summary: 'Get livestock statistics',
43
+ description: 'Get summary statistics for all livestock on the farm',
44
+ },
45
+ // Create livestock
46
+ createLivestock: {
47
+ method: 'POST',
48
+ path: '/farms/:farmId/livestock',
49
+ pathParams: z.object({ farmId: z.string().uuid() }),
50
+ body: z.object({ data: createLivestockSchema }),
51
+ responses: {
52
+ 201: livestockResponseSchema,
53
+ 400: jsonApiErrorResponseSchema,
54
+ 404: jsonApiErrorResponseSchema,
55
+ 401: jsonApiErrorResponseSchema,
56
+ 409: jsonApiErrorResponseSchema, // Duplicate tagId
57
+ 422: jsonApiErrorResponseSchema,
58
+ },
59
+ summary: 'Create livestock',
60
+ description: 'Add new livestock to the farm',
61
+ },
62
+ // Get livestock by ID
63
+ getLivestock: {
64
+ method: 'GET',
65
+ path: '/farms/:farmId/livestock/:id',
66
+ pathParams: z.object({
67
+ farmId: z.string().uuid(),
68
+ id: z.string().uuid(),
69
+ }),
70
+ query: jsonApiIncludeQuerySchema,
71
+ responses: {
72
+ 200: livestockResponseSchema,
73
+ 404: jsonApiErrorResponseSchema,
74
+ 401: jsonApiErrorResponseSchema,
75
+ },
76
+ summary: 'Get livestock by ID',
77
+ description: 'Get detailed information about livestock including health and weight records',
78
+ },
79
+ // Update livestock
80
+ updateLivestock: {
81
+ method: 'PATCH',
82
+ path: '/farms/:farmId/livestock/:id',
83
+ pathParams: z.object({
84
+ farmId: z.string().uuid(),
85
+ id: z.string().uuid(),
86
+ }),
87
+ body: z.object({ data: updateLivestockSchema }),
88
+ responses: {
89
+ 200: livestockResponseSchema,
90
+ 400: jsonApiErrorResponseSchema,
91
+ 404: jsonApiErrorResponseSchema,
92
+ 401: jsonApiErrorResponseSchema,
93
+ 409: jsonApiErrorResponseSchema, // Duplicate tagId
94
+ 422: jsonApiErrorResponseSchema,
95
+ },
96
+ summary: 'Update livestock',
97
+ description: 'Update livestock information',
98
+ },
99
+ // Delete livestock
100
+ deleteLivestock: {
101
+ method: 'DELETE',
102
+ path: '/farms/:farmId/livestock/:id',
103
+ pathParams: z.object({
104
+ farmId: z.string().uuid(),
105
+ id: z.string().uuid(),
106
+ }),
107
+ responses: {
108
+ 204: jsonApiSuccessResponseSchema,
109
+ 404: jsonApiErrorResponseSchema,
110
+ 401: jsonApiErrorResponseSchema,
111
+ },
112
+ summary: 'Delete livestock',
113
+ description: 'Delete livestock record',
114
+ },
115
+ // Add health record
116
+ addHealthRecord: {
117
+ method: 'POST',
118
+ path: '/farms/:farmId/livestock/:id/health-records',
119
+ pathParams: z.object({
120
+ farmId: z.string().uuid(),
121
+ id: z.string().uuid(),
122
+ }),
123
+ body: z.object({ data: createHealthRecordSchema }),
124
+ responses: {
125
+ 201: healthRecordResponseSchema,
126
+ 400: jsonApiErrorResponseSchema,
127
+ 404: jsonApiErrorResponseSchema,
128
+ 401: jsonApiErrorResponseSchema,
129
+ 422: jsonApiErrorResponseSchema,
130
+ },
131
+ summary: 'Add health record',
132
+ description: 'Record health event (vaccination, treatment, checkup, etc.)',
133
+ },
134
+ // List health records
135
+ listHealthRecords: {
136
+ method: 'GET',
137
+ path: '/farms/:farmId/livestock/:id/health-records',
138
+ pathParams: z.object({
139
+ farmId: z.string().uuid(),
140
+ id: z.string().uuid(),
141
+ }),
142
+ query: jsonApiPaginationQuerySchema.merge(jsonApiSortQuerySchema),
143
+ responses: {
144
+ 200: healthRecordListResponseSchema,
145
+ 404: jsonApiErrorResponseSchema,
146
+ 401: jsonApiErrorResponseSchema,
147
+ },
148
+ summary: 'List health records',
149
+ description: 'Get all health records for a livestock',
150
+ },
151
+ // Add weight record
152
+ addWeightRecord: {
153
+ method: 'POST',
154
+ path: '/farms/:farmId/livestock/:id/weight-records',
155
+ pathParams: z.object({
156
+ farmId: z.string().uuid(),
157
+ id: z.string().uuid(),
158
+ }),
159
+ body: z.object({ data: createWeightRecordSchema }),
160
+ responses: {
161
+ 201: weightRecordResponseSchema,
162
+ 400: jsonApiErrorResponseSchema,
163
+ 404: jsonApiErrorResponseSchema,
164
+ 401: jsonApiErrorResponseSchema,
165
+ 422: jsonApiErrorResponseSchema,
166
+ },
167
+ summary: 'Add weight record',
168
+ description: 'Record weight measurement for livestock',
169
+ },
170
+ // Add movement record
171
+ addMovementRecord: {
172
+ method: 'POST',
173
+ path: '/farms/:farmId/livestock/:id/movements',
174
+ pathParams: z.object({
175
+ farmId: z.string().uuid(),
176
+ id: z.string().uuid(),
177
+ }),
178
+ body: z.object({ data: createMovementRecordSchema }),
179
+ responses: {
180
+ 201: movementRecordResponseSchema,
181
+ 400: jsonApiErrorResponseSchema,
182
+ 404: jsonApiErrorResponseSchema,
183
+ 401: jsonApiErrorResponseSchema,
184
+ 422: jsonApiErrorResponseSchema,
185
+ },
186
+ summary: 'Add movement record',
187
+ description: 'Record livestock movement (transfer, sale, death, etc.)',
188
+ },
189
+ // List movements
190
+ listMovements: {
191
+ method: 'GET',
192
+ path: '/farms/:farmId/livestock/:id/movements',
193
+ pathParams: z.object({
194
+ farmId: z.string().uuid(),
195
+ id: z.string().uuid(),
196
+ }),
197
+ query: jsonApiPaginationQuerySchema.merge(jsonApiSortQuerySchema),
198
+ responses: {
199
+ 200: movementRecordListResponseSchema,
200
+ 404: jsonApiErrorResponseSchema,
201
+ 401: jsonApiErrorResponseSchema,
202
+ },
203
+ summary: 'List movements',
204
+ description: 'Get all movement records for a livestock',
205
+ },
206
+ });