@voyant-travel/distribution 0.109.8

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 (168) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +42 -0
  3. package/dist/booking-extension.d.ts +168 -0
  4. package/dist/booking-extension.d.ts.map +1 -0
  5. package/dist/booking-extension.js +102 -0
  6. package/dist/channel-push/admin-routes.d.ts +31 -0
  7. package/dist/channel-push/admin-routes.d.ts.map +1 -0
  8. package/dist/channel-push/admin-routes.js +165 -0
  9. package/dist/channel-push/availability-push.d.ts +76 -0
  10. package/dist/channel-push/availability-push.d.ts.map +1 -0
  11. package/dist/channel-push/availability-push.js +236 -0
  12. package/dist/channel-push/booking-push-helpers.d.ts +36 -0
  13. package/dist/channel-push/booking-push-helpers.d.ts.map +1 -0
  14. package/dist/channel-push/booking-push-helpers.js +169 -0
  15. package/dist/channel-push/booking-push.d.ts +108 -0
  16. package/dist/channel-push/booking-push.d.ts.map +1 -0
  17. package/dist/channel-push/booking-push.js +335 -0
  18. package/dist/channel-push/boundary-sql.d.ts +23 -0
  19. package/dist/channel-push/boundary-sql.d.ts.map +1 -0
  20. package/dist/channel-push/boundary-sql.js +75 -0
  21. package/dist/channel-push/content-push.d.ts +60 -0
  22. package/dist/channel-push/content-push.d.ts.map +1 -0
  23. package/dist/channel-push/content-push.js +252 -0
  24. package/dist/channel-push/index.d.ts +15 -0
  25. package/dist/channel-push/index.d.ts.map +1 -0
  26. package/dist/channel-push/index.js +18 -0
  27. package/dist/channel-push/plugin.d.ts +18 -0
  28. package/dist/channel-push/plugin.d.ts.map +1 -0
  29. package/dist/channel-push/plugin.js +21 -0
  30. package/dist/channel-push/reconciler.d.ts +85 -0
  31. package/dist/channel-push/reconciler.d.ts.map +1 -0
  32. package/dist/channel-push/reconciler.js +179 -0
  33. package/dist/channel-push/subscriber.d.ts +40 -0
  34. package/dist/channel-push/subscriber.d.ts.map +1 -0
  35. package/dist/channel-push/subscriber.js +199 -0
  36. package/dist/channel-push/types.d.ts +43 -0
  37. package/dist/channel-push/types.d.ts.map +1 -0
  38. package/dist/channel-push/types.js +32 -0
  39. package/dist/channel-push/workflows.d.ts +56 -0
  40. package/dist/channel-push/workflows.d.ts.map +1 -0
  41. package/dist/channel-push/workflows.js +100 -0
  42. package/dist/external-refs/index.d.ts +11 -0
  43. package/dist/external-refs/index.d.ts.map +1 -0
  44. package/dist/external-refs/index.js +12 -0
  45. package/dist/external-refs/routes.d.ts +253 -0
  46. package/dist/external-refs/routes.d.ts.map +1 -0
  47. package/dist/external-refs/routes.js +52 -0
  48. package/dist/external-refs/schema.d.ts +251 -0
  49. package/dist/external-refs/schema.d.ts.map +1 -0
  50. package/dist/external-refs/schema.js +32 -0
  51. package/dist/external-refs/service.d.ts +82 -0
  52. package/dist/external-refs/service.d.ts.map +1 -0
  53. package/dist/external-refs/service.js +112 -0
  54. package/dist/external-refs/validation.d.ts +91 -0
  55. package/dist/external-refs/validation.d.ts.map +1 -0
  56. package/dist/external-refs/validation.js +40 -0
  57. package/dist/index.d.ts +21 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +20 -0
  60. package/dist/interface-types.d.ts +128 -0
  61. package/dist/interface-types.d.ts.map +1 -0
  62. package/dist/interface-types.js +1 -0
  63. package/dist/interface.d.ts +10 -0
  64. package/dist/interface.d.ts.map +1 -0
  65. package/dist/interface.js +286 -0
  66. package/dist/rate-limit.d.ts +69 -0
  67. package/dist/rate-limit.d.ts.map +1 -0
  68. package/dist/rate-limit.js +135 -0
  69. package/dist/routes/batch.d.ts +200 -0
  70. package/dist/routes/batch.d.ts.map +1 -0
  71. package/dist/routes/batch.js +52 -0
  72. package/dist/routes/env.d.ts +8 -0
  73. package/dist/routes/env.d.ts.map +1 -0
  74. package/dist/routes/env.js +1 -0
  75. package/dist/routes/inventory.d.ts +604 -0
  76. package/dist/routes/inventory.d.ts.map +1 -0
  77. package/dist/routes/inventory.js +138 -0
  78. package/dist/routes/settlements.d.ts +1649 -0
  79. package/dist/routes/settlements.d.ts.map +1 -0
  80. package/dist/routes/settlements.js +265 -0
  81. package/dist/routes.d.ts +3909 -0
  82. package/dist/routes.d.ts.map +1 -0
  83. package/dist/routes.js +323 -0
  84. package/dist/schema-automation.d.ts +680 -0
  85. package/dist/schema-automation.d.ts.map +1 -0
  86. package/dist/schema-automation.js +76 -0
  87. package/dist/schema-core.d.ts +1674 -0
  88. package/dist/schema-core.d.ts.map +1 -0
  89. package/dist/schema-core.js +227 -0
  90. package/dist/schema-finance.d.ts +1372 -0
  91. package/dist/schema-finance.d.ts.map +1 -0
  92. package/dist/schema-finance.js +153 -0
  93. package/dist/schema-inventory.d.ts +855 -0
  94. package/dist/schema-inventory.d.ts.map +1 -0
  95. package/dist/schema-inventory.js +102 -0
  96. package/dist/schema-push-intents.d.ts +387 -0
  97. package/dist/schema-push-intents.d.ts.map +1 -0
  98. package/dist/schema-push-intents.js +77 -0
  99. package/dist/schema-relations.d.ts +95 -0
  100. package/dist/schema-relations.d.ts.map +1 -0
  101. package/dist/schema-relations.js +196 -0
  102. package/dist/schema-shared.d.ts +24 -0
  103. package/dist/schema-shared.d.ts.map +1 -0
  104. package/dist/schema-shared.js +123 -0
  105. package/dist/schema.d.ts +9 -0
  106. package/dist/schema.d.ts.map +1 -0
  107. package/dist/schema.js +8 -0
  108. package/dist/service/channels.d.ts +167 -0
  109. package/dist/service/channels.d.ts.map +1 -0
  110. package/dist/service/channels.js +305 -0
  111. package/dist/service/commercial.d.ts +385 -0
  112. package/dist/service/commercial.d.ts.map +1 -0
  113. package/dist/service/commercial.js +248 -0
  114. package/dist/service/helpers.d.ts +10 -0
  115. package/dist/service/helpers.d.ts.map +1 -0
  116. package/dist/service/helpers.js +7 -0
  117. package/dist/service/inventory.d.ts +193 -0
  118. package/dist/service/inventory.d.ts.map +1 -0
  119. package/dist/service/inventory.js +154 -0
  120. package/dist/service/settlement-policies.d.ts +325 -0
  121. package/dist/service/settlement-policies.d.ts.map +1 -0
  122. package/dist/service/settlement-policies.js +272 -0
  123. package/dist/service/settlements.d.ts +357 -0
  124. package/dist/service/settlements.d.ts.map +1 -0
  125. package/dist/service/settlements.js +319 -0
  126. package/dist/service/types.d.ts +60 -0
  127. package/dist/service/types.d.ts.map +1 -0
  128. package/dist/service/types.js +1 -0
  129. package/dist/service.d.ts +1418 -0
  130. package/dist/service.d.ts.map +1 -0
  131. package/dist/service.js +17 -0
  132. package/dist/suppliers/index.d.ts +15 -0
  133. package/dist/suppliers/index.d.ts.map +1 -0
  134. package/dist/suppliers/index.js +23 -0
  135. package/dist/suppliers/routes.d.ts +1202 -0
  136. package/dist/suppliers/routes.d.ts.map +1 -0
  137. package/dist/suppliers/routes.js +290 -0
  138. package/dist/suppliers/schema.d.ts +1272 -0
  139. package/dist/suppliers/schema.d.ts.map +1 -0
  140. package/dist/suppliers/schema.js +219 -0
  141. package/dist/suppliers/service-aggregates.d.ts +23 -0
  142. package/dist/suppliers/service-aggregates.d.ts.map +1 -0
  143. package/dist/suppliers/service-aggregates.js +51 -0
  144. package/dist/suppliers/service-core.d.ts +89 -0
  145. package/dist/suppliers/service-core.d.ts.map +1 -0
  146. package/dist/suppliers/service-core.js +164 -0
  147. package/dist/suppliers/service-identity.d.ts +162 -0
  148. package/dist/suppliers/service-identity.d.ts.map +1 -0
  149. package/dist/suppliers/service-identity.js +101 -0
  150. package/dist/suppliers/service-operations.d.ts +1500 -0
  151. package/dist/suppliers/service-operations.d.ts.map +1 -0
  152. package/dist/suppliers/service-operations.js +157 -0
  153. package/dist/suppliers/service-shared.d.ts +45 -0
  154. package/dist/suppliers/service-shared.d.ts.map +1 -0
  155. package/dist/suppliers/service-shared.js +294 -0
  156. package/dist/suppliers/service.d.ts +41 -0
  157. package/dist/suppliers/service.d.ts.map +1 -0
  158. package/dist/suppliers/service.js +40 -0
  159. package/dist/suppliers/validation.d.ts +2 -0
  160. package/dist/suppliers/validation.d.ts.map +1 -0
  161. package/dist/suppliers/validation.js +1 -0
  162. package/dist/validation.d.ts +1371 -0
  163. package/dist/validation.d.ts.map +1 -0
  164. package/dist/validation.js +445 -0
  165. package/dist/webhook-deliveries.d.ts +86 -0
  166. package/dist/webhook-deliveries.d.ts.map +1 -0
  167. package/dist/webhook-deliveries.js +296 -0
  168. package/package.json +71 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settlements.d.ts","sourceRoot":"","sources":["../../src/routes/settlements.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAuVzB,CAAA"}
@@ -0,0 +1,265 @@
1
+ import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
2
+ import { Hono } from "hono";
3
+ import { distributionService } from "../service.js";
4
+ import { channelInventoryReleaseExecutionListQuerySchema, channelReconciliationItemListQuerySchema, channelReconciliationPolicyListQuerySchema, channelReconciliationRunListQuerySchema, channelReleaseScheduleListQuerySchema, channelRemittanceExceptionListQuerySchema, channelSettlementApprovalListQuerySchema, channelSettlementItemListQuerySchema, channelSettlementPolicyListQuerySchema, channelSettlementRunListQuerySchema, insertChannelInventoryReleaseExecutionSchema, insertChannelReconciliationItemSchema, insertChannelReconciliationPolicySchema, insertChannelReconciliationRunSchema, insertChannelReleaseScheduleSchema, insertChannelRemittanceExceptionSchema, insertChannelSettlementApprovalSchema, insertChannelSettlementItemSchema, insertChannelSettlementPolicySchema, insertChannelSettlementRunSchema, updateChannelInventoryReleaseExecutionSchema, updateChannelReconciliationItemSchema, updateChannelReconciliationPolicySchema, updateChannelReconciliationRunSchema, updateChannelReleaseScheduleSchema, updateChannelRemittanceExceptionSchema, updateChannelSettlementApprovalSchema, updateChannelSettlementItemSchema, updateChannelSettlementPolicySchema, updateChannelSettlementRunSchema, } from "../validation.js";
5
+ export const settlementRoutes = new Hono()
6
+ .get("/settlement-runs", async (c) => {
7
+ const query = await parseQuery(c, channelSettlementRunListQuerySchema);
8
+ return c.json(await distributionService.listSettlementRuns(c.get("db"), query));
9
+ })
10
+ .post("/settlement-runs", async (c) => {
11
+ return c.json({
12
+ data: await distributionService.createSettlementRun(c.get("db"), await parseJsonBody(c, insertChannelSettlementRunSchema)),
13
+ }, 201);
14
+ })
15
+ .get("/settlement-runs/:id", async (c) => {
16
+ const row = await distributionService.getSettlementRunById(c.get("db"), c.req.param("id"));
17
+ if (!row)
18
+ return c.json({ error: "Channel settlement run not found" }, 404);
19
+ return c.json({ data: row });
20
+ })
21
+ .patch("/settlement-runs/:id", async (c) => {
22
+ const row = await distributionService.updateSettlementRun(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelSettlementRunSchema));
23
+ if (!row)
24
+ return c.json({ error: "Channel settlement run not found" }, 404);
25
+ return c.json({ data: row });
26
+ })
27
+ .delete("/settlement-runs/:id", async (c) => {
28
+ const row = await distributionService.deleteSettlementRun(c.get("db"), c.req.param("id"));
29
+ if (!row)
30
+ return c.json({ error: "Channel settlement run not found" }, 404);
31
+ return c.json({ success: true });
32
+ })
33
+ .get("/settlement-items", async (c) => {
34
+ const query = await parseQuery(c, channelSettlementItemListQuerySchema);
35
+ return c.json(await distributionService.listSettlementItems(c.get("db"), query));
36
+ })
37
+ .post("/settlement-items", async (c) => {
38
+ return c.json({
39
+ data: await distributionService.createSettlementItem(c.get("db"), await parseJsonBody(c, insertChannelSettlementItemSchema)),
40
+ }, 201);
41
+ })
42
+ .get("/settlement-items/:id", async (c) => {
43
+ const row = await distributionService.getSettlementItemById(c.get("db"), c.req.param("id"));
44
+ if (!row)
45
+ return c.json({ error: "Channel settlement item not found" }, 404);
46
+ return c.json({ data: row });
47
+ })
48
+ .patch("/settlement-items/:id", async (c) => {
49
+ const row = await distributionService.updateSettlementItem(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelSettlementItemSchema));
50
+ if (!row)
51
+ return c.json({ error: "Channel settlement item not found" }, 404);
52
+ return c.json({ data: row });
53
+ })
54
+ .delete("/settlement-items/:id", async (c) => {
55
+ const row = await distributionService.deleteSettlementItem(c.get("db"), c.req.param("id"));
56
+ if (!row)
57
+ return c.json({ error: "Channel settlement item not found" }, 404);
58
+ return c.json({ success: true });
59
+ })
60
+ .get("/reconciliation-runs", async (c) => {
61
+ const query = await parseQuery(c, channelReconciliationRunListQuerySchema);
62
+ return c.json(await distributionService.listReconciliationRuns(c.get("db"), query));
63
+ })
64
+ .post("/reconciliation-runs", async (c) => {
65
+ return c.json({
66
+ data: await distributionService.createReconciliationRun(c.get("db"), await parseJsonBody(c, insertChannelReconciliationRunSchema)),
67
+ }, 201);
68
+ })
69
+ .get("/reconciliation-runs/:id", async (c) => {
70
+ const row = await distributionService.getReconciliationRunById(c.get("db"), c.req.param("id"));
71
+ if (!row)
72
+ return c.json({ error: "Channel reconciliation run not found" }, 404);
73
+ return c.json({ data: row });
74
+ })
75
+ .patch("/reconciliation-runs/:id", async (c) => {
76
+ const row = await distributionService.updateReconciliationRun(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelReconciliationRunSchema));
77
+ if (!row)
78
+ return c.json({ error: "Channel reconciliation run not found" }, 404);
79
+ return c.json({ data: row });
80
+ })
81
+ .delete("/reconciliation-runs/:id", async (c) => {
82
+ const row = await distributionService.deleteReconciliationRun(c.get("db"), c.req.param("id"));
83
+ if (!row)
84
+ return c.json({ error: "Channel reconciliation run not found" }, 404);
85
+ return c.json({ success: true });
86
+ })
87
+ .get("/reconciliation-items", async (c) => {
88
+ const query = await parseQuery(c, channelReconciliationItemListQuerySchema);
89
+ return c.json(await distributionService.listReconciliationItems(c.get("db"), query));
90
+ })
91
+ .post("/reconciliation-items", async (c) => {
92
+ return c.json({
93
+ data: await distributionService.createReconciliationItem(c.get("db"), await parseJsonBody(c, insertChannelReconciliationItemSchema)),
94
+ }, 201);
95
+ })
96
+ .get("/reconciliation-items/:id", async (c) => {
97
+ const row = await distributionService.getReconciliationItemById(c.get("db"), c.req.param("id"));
98
+ if (!row)
99
+ return c.json({ error: "Channel reconciliation item not found" }, 404);
100
+ return c.json({ data: row });
101
+ })
102
+ .patch("/reconciliation-items/:id", async (c) => {
103
+ const row = await distributionService.updateReconciliationItem(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelReconciliationItemSchema));
104
+ if (!row)
105
+ return c.json({ error: "Channel reconciliation item not found" }, 404);
106
+ return c.json({ data: row });
107
+ })
108
+ .delete("/reconciliation-items/:id", async (c) => {
109
+ const row = await distributionService.deleteReconciliationItem(c.get("db"), c.req.param("id"));
110
+ if (!row)
111
+ return c.json({ error: "Channel reconciliation item not found" }, 404);
112
+ return c.json({ success: true });
113
+ })
114
+ .get("/inventory-release-executions", async (c) => {
115
+ const query = await parseQuery(c, channelInventoryReleaseExecutionListQuerySchema);
116
+ return c.json(await distributionService.listReleaseExecutions(c.get("db"), query));
117
+ })
118
+ .post("/inventory-release-executions", async (c) => {
119
+ return c.json({
120
+ data: await distributionService.createReleaseExecution(c.get("db"), await parseJsonBody(c, insertChannelInventoryReleaseExecutionSchema)),
121
+ }, 201);
122
+ })
123
+ .get("/inventory-release-executions/:id", async (c) => {
124
+ const row = await distributionService.getReleaseExecutionById(c.get("db"), c.req.param("id"));
125
+ if (!row)
126
+ return c.json({ error: "Channel inventory release execution not found" }, 404);
127
+ return c.json({ data: row });
128
+ })
129
+ .patch("/inventory-release-executions/:id", async (c) => {
130
+ const row = await distributionService.updateReleaseExecution(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelInventoryReleaseExecutionSchema));
131
+ if (!row)
132
+ return c.json({ error: "Channel inventory release execution not found" }, 404);
133
+ return c.json({ data: row });
134
+ })
135
+ .delete("/inventory-release-executions/:id", async (c) => {
136
+ const row = await distributionService.deleteReleaseExecution(c.get("db"), c.req.param("id"));
137
+ if (!row)
138
+ return c.json({ error: "Channel inventory release execution not found" }, 404);
139
+ return c.json({ success: true });
140
+ })
141
+ .get("/settlement-policies", async (c) => {
142
+ const query = await parseQuery(c, channelSettlementPolicyListQuerySchema);
143
+ return c.json(await distributionService.listSettlementPolicies(c.get("db"), query));
144
+ })
145
+ .post("/settlement-policies", async (c) => c.json({
146
+ data: await distributionService.createSettlementPolicy(c.get("db"), await parseJsonBody(c, insertChannelSettlementPolicySchema)),
147
+ }, 201))
148
+ .get("/settlement-policies/:id", async (c) => {
149
+ const row = await distributionService.getSettlementPolicyById(c.get("db"), c.req.param("id"));
150
+ if (!row)
151
+ return c.json({ error: "Channel settlement policy not found" }, 404);
152
+ return c.json({ data: row });
153
+ })
154
+ .patch("/settlement-policies/:id", async (c) => {
155
+ const row = await distributionService.updateSettlementPolicy(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelSettlementPolicySchema));
156
+ if (!row)
157
+ return c.json({ error: "Channel settlement policy not found" }, 404);
158
+ return c.json({ data: row });
159
+ })
160
+ .delete("/settlement-policies/:id", async (c) => {
161
+ const row = await distributionService.deleteSettlementPolicy(c.get("db"), c.req.param("id"));
162
+ if (!row)
163
+ return c.json({ error: "Channel settlement policy not found" }, 404);
164
+ return c.json({ success: true });
165
+ })
166
+ .get("/reconciliation-policies", async (c) => {
167
+ const query = await parseQuery(c, channelReconciliationPolicyListQuerySchema);
168
+ return c.json(await distributionService.listReconciliationPolicies(c.get("db"), query));
169
+ })
170
+ .post("/reconciliation-policies", async (c) => c.json({
171
+ data: await distributionService.createReconciliationPolicy(c.get("db"), await parseJsonBody(c, insertChannelReconciliationPolicySchema)),
172
+ }, 201))
173
+ .get("/reconciliation-policies/:id", async (c) => {
174
+ const row = await distributionService.getReconciliationPolicyById(c.get("db"), c.req.param("id"));
175
+ if (!row)
176
+ return c.json({ error: "Channel reconciliation policy not found" }, 404);
177
+ return c.json({ data: row });
178
+ })
179
+ .patch("/reconciliation-policies/:id", async (c) => {
180
+ const row = await distributionService.updateReconciliationPolicy(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelReconciliationPolicySchema));
181
+ if (!row)
182
+ return c.json({ error: "Channel reconciliation policy not found" }, 404);
183
+ return c.json({ data: row });
184
+ })
185
+ .delete("/reconciliation-policies/:id", async (c) => {
186
+ const row = await distributionService.deleteReconciliationPolicy(c.get("db"), c.req.param("id"));
187
+ if (!row)
188
+ return c.json({ error: "Channel reconciliation policy not found" }, 404);
189
+ return c.json({ success: true });
190
+ })
191
+ .get("/release-schedules", async (c) => {
192
+ const query = await parseQuery(c, channelReleaseScheduleListQuerySchema);
193
+ return c.json(await distributionService.listReleaseSchedules(c.get("db"), query));
194
+ })
195
+ .post("/release-schedules", async (c) => c.json({
196
+ data: await distributionService.createReleaseSchedule(c.get("db"), await parseJsonBody(c, insertChannelReleaseScheduleSchema)),
197
+ }, 201))
198
+ .get("/release-schedules/:id", async (c) => {
199
+ const row = await distributionService.getReleaseScheduleById(c.get("db"), c.req.param("id"));
200
+ if (!row)
201
+ return c.json({ error: "Channel release schedule not found" }, 404);
202
+ return c.json({ data: row });
203
+ })
204
+ .patch("/release-schedules/:id", async (c) => {
205
+ const row = await distributionService.updateReleaseSchedule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelReleaseScheduleSchema));
206
+ if (!row)
207
+ return c.json({ error: "Channel release schedule not found" }, 404);
208
+ return c.json({ data: row });
209
+ })
210
+ .delete("/release-schedules/:id", async (c) => {
211
+ const row = await distributionService.deleteReleaseSchedule(c.get("db"), c.req.param("id"));
212
+ if (!row)
213
+ return c.json({ error: "Channel release schedule not found" }, 404);
214
+ return c.json({ success: true });
215
+ })
216
+ .get("/remittance-exceptions", async (c) => {
217
+ const query = await parseQuery(c, channelRemittanceExceptionListQuerySchema);
218
+ return c.json(await distributionService.listRemittanceExceptions(c.get("db"), query));
219
+ })
220
+ .post("/remittance-exceptions", async (c) => c.json({
221
+ data: await distributionService.createRemittanceException(c.get("db"), await parseJsonBody(c, insertChannelRemittanceExceptionSchema)),
222
+ }, 201))
223
+ .get("/remittance-exceptions/:id", async (c) => {
224
+ const row = await distributionService.getRemittanceExceptionById(c.get("db"), c.req.param("id"));
225
+ if (!row)
226
+ return c.json({ error: "Channel remittance exception not found" }, 404);
227
+ return c.json({ data: row });
228
+ })
229
+ .patch("/remittance-exceptions/:id", async (c) => {
230
+ const row = await distributionService.updateRemittanceException(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelRemittanceExceptionSchema));
231
+ if (!row)
232
+ return c.json({ error: "Channel remittance exception not found" }, 404);
233
+ return c.json({ data: row });
234
+ })
235
+ .delete("/remittance-exceptions/:id", async (c) => {
236
+ const row = await distributionService.deleteRemittanceException(c.get("db"), c.req.param("id"));
237
+ if (!row)
238
+ return c.json({ error: "Channel remittance exception not found" }, 404);
239
+ return c.json({ success: true });
240
+ })
241
+ .get("/settlement-approvals", async (c) => {
242
+ const query = await parseQuery(c, channelSettlementApprovalListQuerySchema);
243
+ return c.json(await distributionService.listSettlementApprovals(c.get("db"), query));
244
+ })
245
+ .post("/settlement-approvals", async (c) => c.json({
246
+ data: await distributionService.createSettlementApproval(c.get("db"), await parseJsonBody(c, insertChannelSettlementApprovalSchema)),
247
+ }, 201))
248
+ .get("/settlement-approvals/:id", async (c) => {
249
+ const row = await distributionService.getSettlementApprovalById(c.get("db"), c.req.param("id"));
250
+ if (!row)
251
+ return c.json({ error: "Channel settlement approval not found" }, 404);
252
+ return c.json({ data: row });
253
+ })
254
+ .patch("/settlement-approvals/:id", async (c) => {
255
+ const row = await distributionService.updateSettlementApproval(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateChannelSettlementApprovalSchema));
256
+ if (!row)
257
+ return c.json({ error: "Channel settlement approval not found" }, 404);
258
+ return c.json({ data: row });
259
+ })
260
+ .delete("/settlement-approvals/:id", async (c) => {
261
+ const row = await distributionService.deleteSettlementApproval(c.get("db"), c.req.param("id"));
262
+ if (!row)
263
+ return c.json({ error: "Channel settlement approval not found" }, 404);
264
+ return c.json({ success: true });
265
+ });