Finished implementing match endpoints
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user