issue #39
All checks were successful
Test CI / build (push) Successful in 1m17s

- 로그인 기능 오류 보완
This commit is contained in:
2025-12-02 22:31:36 +09:00
parent e4048843e9
commit 1611026688
3 changed files with 2 additions and 8 deletions

View File

@@ -66,6 +66,7 @@ export class AccountController {
@Public() @Public()
@Post('login') @Post('login')
async login(@Body() body: DTO.LoginRequest): Promise<DTO.LoginResponse> { async login(@Body() body: DTO.LoginRequest): Promise<DTO.LoginResponse> {
console.log('a');
const result = await this.accountService.login(body); const result = await this.accountService.login(body);
return result; return result;
} }

View File

@@ -42,16 +42,13 @@ export class AccountRepo {
type: 'email' | 'accountId' type: 'email' | 'accountId'
, id: string , id: string
) { ) {
const condition = type === 'email'
? eq(schema.account.email, id)
: eq(schema.account.accountId, id);
return this return this
.db .db
.select() .select()
.from(schema.account) .from(schema.account)
.where( .where(
and( and(
condition, eq(schema.account[type], id),
eq(schema.account.isDeleted, false), eq(schema.account.isDeleted, false),
eq(schema.account.status, 'active') eq(schema.account.status, 'active')
) )

View File

@@ -78,9 +78,6 @@ export class AccountService {
const queryResult = await this.accountRepo.login(type, id); const queryResult = await this.accountRepo.login(type, id);
const typeValue = type === 'email' ? '이메일' : '아이디'; const typeValue = type === 'email' ? '이메일' : '아이디';
console.log(queryResult);
if (!queryResult || (queryResult.length < 1)) { if (!queryResult || (queryResult.length < 1)) {
return { return {
success: false, success: false,
@@ -88,7 +85,6 @@ export class AccountService {
}; };
} }
const hashedPassword = queryResult[0].password; const hashedPassword = queryResult[0].password;
const isPasswordMatch = Converter.comparePassword(password, hashedPassword); const isPasswordMatch = Converter.comparePassword(password, hashedPassword);
if (!isPasswordMatch) { if (!isPasswordMatch) {