Minor tidy up and refactor to improve consistency.

This commit is contained in:
jd
2026-03-03 00:17:46 +00:00
parent c23536b3ed
commit c4a37f13be
24 changed files with 215 additions and 239 deletions

View File

@@ -7,14 +7,15 @@ import { MatchParticipant } from '../orm/matches';
async function create(request: UnwrappedRequest<CreateMatchRequest>): Promise<Response> {
try {
const newUser = await orm.matches.create({
gameId: GameId.fromHash(request.body.gameId),
ownerId: request.claims.userId as UserId,
participants: request.body.participants.map(
(x) => new MatchParticipant(PlayerId.fromHash(x.playerId), x.standing),
),
});
return new CreatedResponse(newUser);
return new CreatedResponse(
await orm.matches.create({
gameId: GameId.fromHash(request.body.gameId),
ownerId: request.claims.userId as UserId,
participants: request.body.participants.map(
(x) => new MatchParticipant(PlayerId.fromHash(x.playerId), x.standing),
),
}),
);
} catch (error: any) {
return new ErrorResponse(error as Error);
}