From 56df7684c1adb3fd8873dc8d85b99fd0d37eaaa0 Mon Sep 17 00:00:00 2001 From: BadLuckZ Date: Thu, 17 Jul 2025 22:40:46 +0700 Subject: [PATCH 1/3] fix: GET -> POST --- src/router/groupRouter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router/groupRouter.ts b/src/router/groupRouter.ts index 3479bb5..8512dbf 100644 --- a/src/router/groupRouter.ts +++ b/src/router/groupRouter.ts @@ -62,7 +62,7 @@ export class GroupRouter extends BaseRouter { this.groupController.setHousePreferences.bind(this.groupController) ); - this.router.get( + this.router.post( "/groupByInviteCode", this.groupController.getGroupByInviteCode.bind(this.groupController) ); From 67afbe188eda326757a7cb54ccd4abac5e34a5f6 Mon Sep 17 00:00:00 2001 From: Borworntat Dendumrongkul Date: Thu, 17 Jul 2025 23:32:55 +0700 Subject: [PATCH 2/3] fix: auth --- src/repository/user/userRepository.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/repository/user/userRepository.ts b/src/repository/user/userRepository.ts index 43d245a..3ed1d55 100644 --- a/src/repository/user/userRepository.ts +++ b/src/repository/user/userRepository.ts @@ -86,20 +86,12 @@ export class UserRepository { } async findExists(studentId: string, citizenId: string): Promise { - const userFromStudentId = await prisma.user.findFirst({ - where: { - studentId: studentId, - }, - }); - if (userFromStudentId) { - return true; - } - const userFromCitizenId = await prisma.user.findFirst({ + const user = await prisma.user.findFirst({ where: { - citizenId: citizenId, + AND: [{ studentId: studentId }, { citizenId: citizenId }], }, }); - if (userFromCitizenId) { + if (user) { return true; } return false; From fc7b60adbba758c12543b59719b93da9fc5e12d6 Mon Sep 17 00:00:00 2001 From: Borworntat Dendumrongkul Date: Thu, 17 Jul 2025 23:36:13 +0700 Subject: [PATCH 3/3] fix: checking --- src/usecase/auth/authUsecase.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usecase/auth/authUsecase.ts b/src/usecase/auth/authUsecase.ts index 79dcea7..9d7895d 100644 --- a/src/usecase/auth/authUsecase.ts +++ b/src/usecase/auth/authUsecase.ts @@ -29,7 +29,7 @@ export class AuthUsecase { ); if (existingUser) { throw new AppError( - "User with this student ID or citizen ID already exists", + "User with this student ID and citizen ID already exists", 400 ); }