From 90c316976dbd5be7bfd42f1f1636d01b4265ec75 Mon Sep 17 00:00:00 2001 From: enbraining Date: Fri, 28 Jun 2024 10:40:28 +0900 Subject: [PATCH] :recycle: ktlint format --- .../underlive/domain/auth/service/AuthService.kt | 16 ++++++++-------- .../domain/user/repository/UserRepository.kt | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/team/underlive/underlive/domain/auth/service/AuthService.kt b/src/main/kotlin/team/underlive/underlive/domain/auth/service/AuthService.kt index 19bcb3b..87d3ebf 100644 --- a/src/main/kotlin/team/underlive/underlive/domain/auth/service/AuthService.kt +++ b/src/main/kotlin/team/underlive/underlive/domain/auth/service/AuthService.kt @@ -16,7 +16,7 @@ import team.underlive.underlive.global.exception.error.HttpException @Service class AuthService( private val userRepository: UserRepository, - private val passwordEncoder: PasswordEncoder + private val passwordEncoder: PasswordEncoder, ) { fun createUser(userJoinRequest: UserJoinRequest) { if (userRepository.existsByEmail(userJoinRequest.email)) { @@ -36,14 +36,14 @@ class AuthService( } fun loginUser(userLoginRequest: UserLoginRequest): UserLoginResponse { - val user = userRepository.findByEmail(userLoginRequest.email) - .orElseThrow { HttpException(HttpStatus.NOT_FOUND, "해당 이메일을 사용하는 유저를 찾을 수 없습니다.") } - - if(!passwordEncoder.matches(userLoginRequest.password, user.password)){ - throw HttpException(HttpStatus.BAD_REQUEST, "비밀번호가 일치하지 않습니다.") - } - + val user = + userRepository.findByEmail(userLoginRequest.email) + .orElseThrow { HttpException(HttpStatus.NOT_FOUND, "해당 이메일을 사용하는 유저를 찾을 수 없습니다.") } + if (!passwordEncoder.matches(userLoginRequest.password, user.password)) + { + throw HttpException(HttpStatus.BAD_REQUEST, "비밀번호가 일치하지 않습니다.") + } return UserLoginResponse("test", "test") } diff --git a/src/main/kotlin/team/underlive/underlive/domain/user/repository/UserRepository.kt b/src/main/kotlin/team/underlive/underlive/domain/user/repository/UserRepository.kt index fb375c2..bd71ec4 100644 --- a/src/main/kotlin/team/underlive/underlive/domain/user/repository/UserRepository.kt +++ b/src/main/kotlin/team/underlive/underlive/domain/user/repository/UserRepository.kt @@ -7,5 +7,6 @@ import java.util.UUID interface UserRepository : JpaRepository { fun existsByEmail(email: String): Boolean + fun findByEmail(email: String): Optional }