More models organization

This commit is contained in:
Dominic Ferrando
2026-07-04 15:57:20 -04:00
parent a7b8dd0bea
commit 28c5b3df18
9 changed files with 148 additions and 134 deletions
+6 -6
View File
@@ -18,7 +18,7 @@ import { CommerceService } from "./services/commerce";
import cluster from "node:cluster";
import { randomUUIDv7 } from "bun";
import { CalculatorService } from "./services/calculator";
import { StandardsParametersSchema } from "@blade-and-brawn/calculator";
import { StandardsParamsSchema } from "@blade-and-brawn/calculator";
// SERVICES
// -----------
@@ -117,16 +117,16 @@ export const app = new Elysia()
if (!token || !token.sessionId) throw status(401, "Unauthorized");
return { sessionId: token.sessionId.toString() };
})
.put("/config/:id", async ({ params: { id }, body: { datasetId, parameters } }) => {
.put("/config/:id", async ({ params: { id }, body: { datasetId, params: parameters } }) => {
await s.Calculator.Standards.Config.update(id, datasetId, parameters);
}, {
params: t.Object({ id: t.String() }),
body: t.Object({ datasetId: t.String(), parameters: StandardsParametersSchema })
body: t.Object({ datasetId: t.String(), params: StandardsParamsSchema })
})
.post("/config", async ({ body: { datasetId, parameters } }) => {
await s.Calculator.Standards.Config.create(datasetId, parameters);
.post("/config", async ({ body: { datasetId, params } }) => {
await s.Calculator.Standards.Config.create(datasetId, params);
}, {
body: t.Object({ datasetId: t.String(), parameters: StandardsParametersSchema })
body: t.Object({ datasetId: t.String(), params: StandardsParamsSchema })
})
.post("/config/:id/switch", async ({ params: { id } }) => {
await s.Calculator.Standards.Config.switch(id);