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

@@ -6,13 +6,12 @@ import { PlayerId, UserId } from '../utilities/secureIds';
async function create(request: UnwrappedRequest<CreateUserRequest>): Promise<Response> {
try {
const newUser = await orm.users.create(
{
return new CreatedResponse(
await orm.users.create({
...request.body,
playerId: PlayerId.fromHash(request.body.playerId),
}
}),
);
return new CreatedResponse(newUser);
} catch (error: any) {
return new ErrorResponse(error as Error);
}
@@ -28,9 +27,7 @@ async function get(request: UnwrappedRequest): Promise<Response> {
async function update(request: UnwrappedRequest<UpdateUserRequest>): Promise<Response> {
try {
return new OkResponse(
await orm.users.update(UserId.fromHash(request.params.id), request.body, request.claims),
);
return new OkResponse(await orm.users.update(UserId.fromHash(request.params.id), request.body, request.claims));
} catch (error: any) {
return new ErrorResponse(error as Error);
}