1.1.0 #29

Merged
Xominus merged 25 commits from discord into main 2026-08-22 18:00:22 +00:00
2 changed files with 16 additions and 4 deletions
Showing only changes of commit 951f9286aa - Show all commits
+8 -4
View File
@@ -482,7 +482,7 @@ export const app = new Elysia()
.group("/assessments", (app) => app
.guard({ auth: true }, (app) => app
.post("/me", async ({ body: { player, activityPerformances }, accountId }) => {
await s.Assessments.create(player, activityPerformances, accountId);
return await s.Assessments.create(player, activityPerformances, accountId);
}, {
body: t.Object({
player: PlayerSchema,
@@ -490,9 +490,13 @@ export const app = new Elysia()
})
})
.get("/me", async ({ accountId }) => {
const assessments = await s.Assessments.list({ filter: { accountId } });
if (!assessments) throw new NotFoundError("Assessments not found");
return assessments;
return await s.Assessments.list({ filter: { accountId } });
})
.delete("/me/:id", async ({ params: { id }, accountId }) => {
const deleted = await s.Assessments.delete(id, accountId);
if (!deleted) throw new NotFoundError("Assessment not found");
}, {
params: t.Object({ id: t.String() })
})
)
.guard({ authAdmin: true }, (app) => app
+8
View File
@@ -39,4 +39,12 @@ export class AssessmentsService {
.$if(opt.offset !== undefined, (qb) => qb.offset(opt.offset!))
.execute();
}
async delete(id: string, accountId: string): Promise<boolean> {
const result = await db.deleteFrom("assessments")
.where("id", "=", id)
.where("account_id", "=", accountId)
.executeTakeFirst();
return result.numDeletedRows > 0n;
}
}