Implement put route for updating existing assessments
This commit is contained in:
@@ -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),
|
||||
})
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user