@voyant-travel/mice 0.3.0 → 0.5.0
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.
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -0
- package/dist/routes.d.ts +506 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +91 -0
- package/dist/schema-rfp.d.ts +790 -0
- package/dist/schema-rfp.d.ts.map +1 -0
- package/dist/schema-rfp.js +104 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -0
- package/dist/service-commercials.d.ts +42 -0
- package/dist/service-commercials.d.ts.map +1 -0
- package/dist/service-commercials.js +125 -0
- package/dist/service-rfp.d.ts +89 -0
- package/dist/service-rfp.d.ts.map +1 -0
- package/dist/service-rfp.js +198 -0
- package/dist/validation-rfp.d.ts +110 -0
- package/dist/validation-rfp.d.ts.map +1 -0
- package/dist/validation-rfp.js +61 -0
- package/migrations/0003_mice_baseline.sql +84 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +10 -4
package/dist/routes.js
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
7
|
import { createProgram, getProgram, listPrograms, updateProgram } from "./service.js";
|
|
8
|
+
import { commercialsService } from "./service-commercials.js";
|
|
8
9
|
import { createDelegate, enrollDelegate, getDelegate, listDelegates, updateDelegate, } from "./service-delegates.js";
|
|
10
|
+
import { rfpService } from "./service-rfp.js";
|
|
9
11
|
import { createRoomingAssignment, getRoomingAssignment, listRoomingAssignments, setRoomingDelegates, updateRoomingAssignment, } from "./service-rooming.js";
|
|
10
12
|
import { createSession, deleteSession, getSession, listSessions, setSessionInclusions, updateSession, } from "./service-sessions.js";
|
|
11
13
|
import { createProgramSchema, programListQuerySchema, updateProgramSchema } from "./validation.js";
|
|
12
14
|
import { createDelegateSchema, delegateListQuerySchema, enrollDelegateSchema, updateDelegateSchema, } from "./validation-delegates.js";
|
|
15
|
+
import { addBidEvaluationSchema, awardRfpSchema, createBidSchema, createRfpSchema, inviteSupplierSchema, rfpListQuerySchema, setBidLinesSchema, updateBidSchema, updateRfpSchema, } from "./validation-rfp.js";
|
|
13
16
|
import { createRoomingAssignmentSchema, roomingListQuerySchema, setRoomingDelegatesSchema, updateRoomingAssignmentSchema, } from "./validation-rooming.js";
|
|
14
17
|
import { createSessionSchema, sessionListQuerySchema, setSessionInclusionsSchema, updateSessionSchema, } from "./validation-sessions.js";
|
|
15
18
|
export const miceAdminRoutes = new Hono()
|
|
@@ -26,6 +29,14 @@ export const miceAdminRoutes = new Hono()
|
|
|
26
29
|
if (!program)
|
|
27
30
|
return c.json({ error: "Program not found" }, 404);
|
|
28
31
|
return c.json({ data: program });
|
|
32
|
+
})
|
|
33
|
+
// Consolidated commercials — program cost sheet / P&L (Phase 5).
|
|
34
|
+
.get("/programs/:id/cost-sheet", async (c) => {
|
|
35
|
+
const id = c.req.param("id");
|
|
36
|
+
const program = await getProgram(c.get("db"), id);
|
|
37
|
+
if (!program)
|
|
38
|
+
return c.json({ error: "Program not found" }, 404);
|
|
39
|
+
return c.json({ data: await commercialsService.getProgramCostSheet(c.get("db"), id) });
|
|
29
40
|
})
|
|
30
41
|
.patch("/programs/:id", async (c) => {
|
|
31
42
|
const body = await parseJsonBody(c, updateProgramSchema);
|
|
@@ -153,4 +164,84 @@ export const miceAdminRoutes = new Hono()
|
|
|
153
164
|
detail: { offending: outcome.offending },
|
|
154
165
|
}, 409);
|
|
155
166
|
}
|
|
167
|
+
})
|
|
168
|
+
// Sourcing funnel: RFP → invitations → bids → evaluation → award (Phase 4).
|
|
169
|
+
.get("/rfps", async (c) => {
|
|
170
|
+
const query = await parseQuery(c, rfpListQuerySchema);
|
|
171
|
+
return c.json(await rfpService.listRfps(c.get("db"), query));
|
|
172
|
+
})
|
|
173
|
+
.post("/rfps", async (c) => {
|
|
174
|
+
const body = await parseJsonBody(c, createRfpSchema);
|
|
175
|
+
const outcome = await rfpService.createRfp(c.get("db"), body);
|
|
176
|
+
if (outcome.status === "program_not_found")
|
|
177
|
+
return c.json({ error: "Program not found" }, 404);
|
|
178
|
+
return c.json({ data: outcome.rfp }, 201);
|
|
179
|
+
})
|
|
180
|
+
.get("/rfps/:id", async (c) => {
|
|
181
|
+
const rfp = await rfpService.getRfp(c.get("db"), c.req.param("id"));
|
|
182
|
+
if (!rfp)
|
|
183
|
+
return c.json({ error: "RFP not found" }, 404);
|
|
184
|
+
return c.json({ data: rfp });
|
|
185
|
+
})
|
|
186
|
+
.patch("/rfps/:id", async (c) => {
|
|
187
|
+
const body = await parseJsonBody(c, updateRfpSchema);
|
|
188
|
+
const rfp = await rfpService.updateRfp(c.get("db"), c.req.param("id"), body);
|
|
189
|
+
if (!rfp)
|
|
190
|
+
return c.json({ error: "RFP not found" }, 404);
|
|
191
|
+
return c.json({ data: rfp });
|
|
192
|
+
})
|
|
193
|
+
.post("/rfps/:id/invitations", async (c) => {
|
|
194
|
+
const body = await parseJsonBody(c, inviteSupplierSchema);
|
|
195
|
+
const outcome = await rfpService.inviteSupplier(c.get("db"), c.req.param("id"), body);
|
|
196
|
+
if (outcome.status === "rfp_not_found")
|
|
197
|
+
return c.json({ error: "RFP not found" }, 404);
|
|
198
|
+
return c.json({ data: outcome.invitation }, outcome.idempotent ? 200 : 201);
|
|
199
|
+
})
|
|
200
|
+
.post("/rfps/:id/bids", async (c) => {
|
|
201
|
+
const body = await parseJsonBody(c, createBidSchema);
|
|
202
|
+
const outcome = await rfpService.createBid(c.get("db"), c.req.param("id"), body);
|
|
203
|
+
if (outcome.status === "rfp_not_found")
|
|
204
|
+
return c.json({ error: "RFP not found" }, 404);
|
|
205
|
+
return c.json({ data: outcome.bid }, 201);
|
|
206
|
+
})
|
|
207
|
+
.post("/rfps/:id/award", async (c) => {
|
|
208
|
+
const { bidId } = await parseJsonBody(c, awardRfpSchema);
|
|
209
|
+
const outcome = await rfpService.awardRfp(c.get("db"), c.req.param("id"), bidId);
|
|
210
|
+
switch (outcome.status) {
|
|
211
|
+
case "ok":
|
|
212
|
+
return c.json({ data: { rfp: outcome.rfp, bid: outcome.bid } });
|
|
213
|
+
case "rfp_not_found":
|
|
214
|
+
return c.json({ error: "RFP not found" }, 404);
|
|
215
|
+
case "bid_not_found":
|
|
216
|
+
return c.json({ error: "Bid not found on this RFP" }, 404);
|
|
217
|
+
case "already_awarded":
|
|
218
|
+
return c.json({ error: "RFP is already awarded" }, 409);
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
.get("/bids/:id", async (c) => {
|
|
222
|
+
const bid = await rfpService.getBid(c.get("db"), c.req.param("id"));
|
|
223
|
+
if (!bid)
|
|
224
|
+
return c.json({ error: "Bid not found" }, 404);
|
|
225
|
+
return c.json({ data: bid });
|
|
226
|
+
})
|
|
227
|
+
.patch("/bids/:id", async (c) => {
|
|
228
|
+
const body = await parseJsonBody(c, updateBidSchema);
|
|
229
|
+
const bid = await rfpService.updateBid(c.get("db"), c.req.param("id"), body);
|
|
230
|
+
if (!bid)
|
|
231
|
+
return c.json({ error: "Bid not found" }, 404);
|
|
232
|
+
return c.json({ data: bid });
|
|
233
|
+
})
|
|
234
|
+
.put("/bids/:id/lines", async (c) => {
|
|
235
|
+
const { lines } = await parseJsonBody(c, setBidLinesSchema);
|
|
236
|
+
const outcome = await rfpService.setBidLines(c.get("db"), c.req.param("id"), lines);
|
|
237
|
+
if (outcome.status === "bid_not_found")
|
|
238
|
+
return c.json({ error: "Bid not found" }, 404);
|
|
239
|
+
return c.json({ data: outcome.lines });
|
|
240
|
+
})
|
|
241
|
+
.post("/bids/:id/evaluations", async (c) => {
|
|
242
|
+
const body = await parseJsonBody(c, addBidEvaluationSchema);
|
|
243
|
+
const outcome = await rfpService.addBidEvaluation(c.get("db"), c.req.param("id"), body);
|
|
244
|
+
if (outcome.status === "bid_not_found")
|
|
245
|
+
return c.json({ error: "Bid not found" }, 404);
|
|
246
|
+
return c.json({ data: outcome.evaluation }, 201);
|
|
156
247
|
});
|