Implement put route for updating existing assessments

This commit is contained in:
Dominic Ferrando
2026-08-22 13:01:10 -04:00
parent ce363d3b51
commit 564a18cfcb
2 changed files with 39 additions and 9 deletions
+11
View File
@@ -23,6 +23,7 @@ import { EventsService, EventStatusSchema } from "./services/events";
import { AccountsService, type AccountRole } from "./services/accounts";
import { Value } from "@sinclair/typebox/value";
import { AssessmentsService } from "./services/assessments";
import { Not } from "@sinclair/typebox";
// CONSTANTS
// -----------------------
@@ -509,6 +510,16 @@ export const app = new Elysia()
id: t.Optional(t.String()),
})
})
.put("/:id", async ({ body: { player, activityPerformances }, params: { id } }) => {
const updated = await s.Assessments.update(id, player, activityPerformances);
if (!updated) throw new NotFoundError("Assessment not found");
}, {
params: t.Object({ id: t.String() }),
body: t.Object({
player: PlayerSchema,
activityPerformances: t.Array(ActivityPerformanceSchema),
})
})
)
)