Skip to content

Commit

Permalink
fix: stuff from self-code-review
Browse files Browse the repository at this point in the history
  • Loading branch information
invertedEcho committed Dec 1, 2024
1 parent ef52848 commit 24572da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions backend/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ export class AuthController {
registerDto.inviteCode,
);
if (maybeGroup === undefined) {
// TODO: this is bad. we will create the user, but the request will fail if invalid invite code included.
// user will still be on register screen. if he registers again, he is stuck there as user already exists.
// we need a sql transaction for this.
// but we should first add message in case register fails because of invalid invite code given, otherwise user could
// be very confused if he just registers and is not really aware that a invite code was included, e.g. because he
// clicked on a join group link.
throw new HttpException(
'The given invite code is invalid',
HttpStatus.BAD_REQUEST,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ if (connectionString === undefined) {
);
}

export const client = postgres(connectionString, { onnotice: () => {} });
export const client = postgres(connectionString);

export const db = drizzle(client);

0 comments on commit 24572da

Please sign in to comment.