@deepintel-ltd/farmpro-contracts 1.5.19 → 1.5.21

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":"waybills.routes.d.ts","sourceRoot":"","sources":["../../src/routes/waybills.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6FzB,CAAC"}
@@ -0,0 +1,95 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import { createWaybillSchema, updateWaybillSchema, waybillResponseSchema, waybillListResponseSchema, } from '../schemas/waybills.schemas';
4
+ import { jsonApiErrorResponseSchema, jsonApiPaginationQuerySchema, jsonApiSortQuerySchema, } from '../schemas/common.schemas';
5
+ const c = initContract();
6
+ export const waybillsRouter = c.router({
7
+ // List all waybills for an organization
8
+ listWaybills: {
9
+ method: 'GET',
10
+ path: '/organizations/:organizationId/waybills',
11
+ pathParams: z.object({
12
+ organizationId: z.string().uuid(),
13
+ }),
14
+ query: jsonApiPaginationQuerySchema
15
+ .merge(jsonApiSortQuerySchema),
16
+ responses: {
17
+ 200: waybillListResponseSchema,
18
+ 401: jsonApiErrorResponseSchema,
19
+ 404: jsonApiErrorResponseSchema,
20
+ },
21
+ summary: 'List all waybills for an organization',
22
+ description: 'Get a paginated list of waybills for the specified organization',
23
+ },
24
+ // Create a new waybill
25
+ createWaybill: {
26
+ method: 'POST',
27
+ path: '/organizations/:organizationId/waybills',
28
+ pathParams: z.object({
29
+ organizationId: z.string().uuid(),
30
+ }),
31
+ body: z.object({ data: createWaybillSchema }),
32
+ responses: {
33
+ 201: waybillResponseSchema,
34
+ 400: jsonApiErrorResponseSchema,
35
+ 401: jsonApiErrorResponseSchema,
36
+ 404: jsonApiErrorResponseSchema,
37
+ 422: jsonApiErrorResponseSchema,
38
+ },
39
+ summary: 'Create a new waybill',
40
+ description: 'Create a new waybill for an organization. The waybill will be generated with the organization logo.',
41
+ },
42
+ // Get waybill by ID
43
+ getWaybill: {
44
+ method: 'GET',
45
+ path: '/organizations/:organizationId/waybills/:id',
46
+ pathParams: z.object({
47
+ organizationId: z.string().uuid(),
48
+ id: z.string().uuid(),
49
+ }),
50
+ responses: {
51
+ 200: waybillResponseSchema,
52
+ 404: jsonApiErrorResponseSchema,
53
+ 401: jsonApiErrorResponseSchema,
54
+ },
55
+ summary: 'Get waybill by ID',
56
+ description: 'Get detailed information about a specific waybill',
57
+ },
58
+ // Update waybill
59
+ updateWaybill: {
60
+ method: 'PATCH',
61
+ path: '/organizations/:organizationId/waybills/:id',
62
+ pathParams: z.object({
63
+ organizationId: z.string().uuid(),
64
+ id: z.string().uuid(),
65
+ }),
66
+ body: z.object({ data: updateWaybillSchema }),
67
+ responses: {
68
+ 200: waybillResponseSchema,
69
+ 400: jsonApiErrorResponseSchema,
70
+ 404: jsonApiErrorResponseSchema,
71
+ 401: jsonApiErrorResponseSchema,
72
+ 422: jsonApiErrorResponseSchema,
73
+ },
74
+ summary: 'Update waybill',
75
+ description: 'Update waybill information',
76
+ },
77
+ // Generate waybill PDF
78
+ generateWaybillPdf: {
79
+ method: 'POST',
80
+ path: '/organizations/:organizationId/waybills/:id/generate-pdf',
81
+ pathParams: z.object({
82
+ organizationId: z.string().uuid(),
83
+ id: z.string().uuid(),
84
+ }),
85
+ body: z.void(),
86
+ responses: {
87
+ 200: waybillResponseSchema,
88
+ 404: jsonApiErrorResponseSchema,
89
+ 401: jsonApiErrorResponseSchema,
90
+ 500: jsonApiErrorResponseSchema,
91
+ },
92
+ summary: 'Generate waybill PDF',
93
+ description: 'Generate and save PDF for a waybill with organization logo',
94
+ },
95
+ });