Finished implementing match endpoints

This commit is contained in:
jd
2026-02-22 12:02:05 +00:00
parent 0fa00e6759
commit 872a79663b
7 changed files with 94 additions and 31 deletions

View File

@@ -30,7 +30,17 @@ async function get(request: UnwrappedRequest): Promise<Response> {
async function drop(request: UnwrappedRequest): Promise<Response> {
try {
return new OkResponse(await orm.matches.drop(UserId.fromHash(request.params.id), request.claims));
return new OkResponse(await orm.matches.drop(MatchId.fromHash(request.params.id), request.claims));
} catch (error: any) {
return new ErrorResponse(error as Error);
}
}
async function leave(request: UnwrappedRequest): Promise<Response> {
try {
return new OkResponse(
await orm.matches.removePlayer(MatchId.fromHash(request.params.id), request.claims.userId as UserId),
);
} catch (error: any) {
return new ErrorResponse(error as Error);
}
@@ -40,4 +50,5 @@ export default {
create,
get,
drop,
leave,
};