@deepintel-ltd/farmpro-contracts 1.5.18 → 1.5.20

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 (33) hide show
  1. package/dist/index.d.ts +7 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -0
  4. package/dist/routes/agents.routes.d.ts +192 -18
  5. package/dist/routes/agents.routes.d.ts.map +1 -1
  6. package/dist/routes/index.d.ts +9 -0
  7. package/dist/routes/index.d.ts.map +1 -1
  8. package/dist/routes/index.js +6 -0
  9. package/dist/routes/invoices.routes.d.ts +3608 -0
  10. package/dist/routes/invoices.routes.d.ts.map +1 -0
  11. package/dist/routes/invoices.routes.js +98 -0
  12. package/dist/routes/organizations.routes.d.ts +1669 -0
  13. package/dist/routes/organizations.routes.d.ts.map +1 -0
  14. package/dist/routes/organizations.routes.js +63 -0
  15. package/dist/routes/subscriptions.routes.d.ts +232 -0
  16. package/dist/routes/subscriptions.routes.d.ts.map +1 -1
  17. package/dist/routes/subscriptions.routes.js +25 -2
  18. package/dist/routes/waybills.routes.d.ts +3225 -0
  19. package/dist/routes/waybills.routes.d.ts.map +1 -0
  20. package/dist/routes/waybills.routes.js +95 -0
  21. package/dist/schemas/agents.schemas.d.ts +760 -49
  22. package/dist/schemas/agents.schemas.d.ts.map +1 -1
  23. package/dist/schemas/agents.schemas.js +21 -1
  24. package/dist/schemas/invoices.schemas.d.ts +1533 -0
  25. package/dist/schemas/invoices.schemas.d.ts.map +1 -0
  26. package/dist/schemas/invoices.schemas.js +85 -0
  27. package/dist/schemas/organizations.schemas.d.ts +509 -0
  28. package/dist/schemas/organizations.schemas.d.ts.map +1 -0
  29. package/dist/schemas/organizations.schemas.js +39 -0
  30. package/dist/schemas/waybills.schemas.d.ts +1261 -0
  31. package/dist/schemas/waybills.schemas.d.ts.map +1 -0
  32. package/dist/schemas/waybills.schemas.js +70 -0
  33. package/package.json +1 -1
@@ -0,0 +1 @@
1
+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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGzB,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import { createInvoiceSchema, updateInvoiceSchema, invoiceResponseSchema, invoiceListResponseSchema, } from '../schemas/invoices.schemas';
4
+ import { jsonApiErrorResponseSchema, jsonApiPaginationQuerySchema, jsonApiSortQuerySchema, } from '../schemas/common.schemas';
5
+ const c = initContract();
6
+ export const invoicesRouter = c.router({
7
+ // List all invoices for an organization
8
+ listInvoices: {
9
+ method: 'GET',
10
+ path: '/organizations/:organizationId/invoices',
11
+ pathParams: z.object({
12
+ organizationId: z.string().uuid(),
13
+ }),
14
+ query: jsonApiPaginationQuerySchema
15
+ .merge(jsonApiSortQuerySchema)
16
+ .extend({
17
+ 'filter[paymentStatus]': z.enum(['pending', 'paid', 'overdue', 'cancelled']).optional(),
18
+ }),
19
+ responses: {
20
+ 200: invoiceListResponseSchema,
21
+ 401: jsonApiErrorResponseSchema,
22
+ 404: jsonApiErrorResponseSchema,
23
+ },
24
+ summary: 'List all invoices for an organization',
25
+ description: 'Get a paginated list of invoices for the specified organization',
26
+ },
27
+ // Create a new invoice
28
+ createInvoice: {
29
+ method: 'POST',
30
+ path: '/organizations/:organizationId/invoices',
31
+ pathParams: z.object({
32
+ organizationId: z.string().uuid(),
33
+ }),
34
+ body: z.object({ data: createInvoiceSchema }),
35
+ responses: {
36
+ 201: invoiceResponseSchema,
37
+ 400: jsonApiErrorResponseSchema,
38
+ 401: jsonApiErrorResponseSchema,
39
+ 404: jsonApiErrorResponseSchema,
40
+ 422: jsonApiErrorResponseSchema,
41
+ },
42
+ summary: 'Create a new invoice',
43
+ description: 'Create a new invoice for an organization. The invoice will be generated with the organization logo.',
44
+ },
45
+ // Get invoice by ID
46
+ getInvoice: {
47
+ method: 'GET',
48
+ path: '/organizations/:organizationId/invoices/:id',
49
+ pathParams: z.object({
50
+ organizationId: z.string().uuid(),
51
+ id: z.string().uuid(),
52
+ }),
53
+ responses: {
54
+ 200: invoiceResponseSchema,
55
+ 404: jsonApiErrorResponseSchema,
56
+ 401: jsonApiErrorResponseSchema,
57
+ },
58
+ summary: 'Get invoice by ID',
59
+ description: 'Get detailed information about a specific invoice',
60
+ },
61
+ // Update invoice
62
+ updateInvoice: {
63
+ method: 'PATCH',
64
+ path: '/organizations/:organizationId/invoices/:id',
65
+ pathParams: z.object({
66
+ organizationId: z.string().uuid(),
67
+ id: z.string().uuid(),
68
+ }),
69
+ body: z.object({ data: updateInvoiceSchema }),
70
+ responses: {
71
+ 200: invoiceResponseSchema,
72
+ 400: jsonApiErrorResponseSchema,
73
+ 404: jsonApiErrorResponseSchema,
74
+ 401: jsonApiErrorResponseSchema,
75
+ 422: jsonApiErrorResponseSchema,
76
+ },
77
+ summary: 'Update invoice',
78
+ description: 'Update invoice information',
79
+ },
80
+ // Generate invoice PDF
81
+ generateInvoicePdf: {
82
+ method: 'POST',
83
+ path: '/organizations/:organizationId/invoices/:id/generate-pdf',
84
+ pathParams: z.object({
85
+ organizationId: z.string().uuid(),
86
+ id: z.string().uuid(),
87
+ }),
88
+ body: z.void(),
89
+ responses: {
90
+ 200: invoiceResponseSchema,
91
+ 404: jsonApiErrorResponseSchema,
92
+ 401: jsonApiErrorResponseSchema,
93
+ 500: jsonApiErrorResponseSchema,
94
+ },
95
+ summary: 'Generate invoice PDF',
96
+ description: 'Generate and save PDF for an invoice with organization logo',
97
+ },
98
+ });