Minor tidy up and refactor to improve consistency.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user