Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
refactor: Delete email & nickname
Browse files Browse the repository at this point in the history
  • Loading branch information
rlawhddbs committed Aug 26, 2024
1 parent 65eb5b7 commit ac29d32
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kr.hs.dgsw.canbusserver.domain.auth.presentation.dto.request

import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Pattern

class SignupRequest(
Expand All @@ -17,13 +16,4 @@ class SignupRequest(
)
val password: String,

@field:Pattern(
regexp = "^[^ ]{1,15}$",
message = "닉네임이 올바르지 않아요 (1자 ~ 15자)"
)
val nickname: String,

@field:Email(message = "올바른 형식의 이메일이여야 해요")
val email: String,

)
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package kr.hs.dgsw.canbusserver.domain.auth.service

import kr.hs.dgsw.canbusserver.domain.auth.exception.EmailExistsException
import kr.hs.dgsw.canbusserver.domain.auth.exception.PasswordNotMatchedException
import kr.hs.dgsw.canbusserver.domain.auth.exception.UserIdExistsException
import kr.hs.dgsw.canbusserver.domain.auth.exception.UserNotFoundException
import kr.hs.dgsw.canbusserver.domain.auth.presentation.dto.request.LoginRequest
import kr.hs.dgsw.canbusserver.domain.auth.presentation.dto.request.SignupRequest
import kr.hs.dgsw.canbusserver.domain.auth.presentation.dto.response.TokenResponse
import kr.hs.dgsw.canbusserver.domain.user.User
import kr.hs.dgsw.canbusserver.domain.user.UserRepository
import kr.hs.dgsw.canbusserver.global.encrypt.EncryptUtil
import kr.hs.dgsw.canbusserver.global.security.jwt.JwtUtil
import kr.hs.dgsw.canbusserver.domain.auth.presentation.dto.request.SignupRequest
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

Expand Down Expand Up @@ -43,17 +42,11 @@ class AuthService(
throw UserIdExistsException()
}

if (userRepository.existsByEmail(request.email)) {
throw EmailExistsException()
}

val encryptedPassword: String = encryptUtil.encode(request.password)

val user = User(
identifier = request.identifier,
password = encryptedPassword,
nickname = request.nickname,
email = request.email,
)

userRepository.save(user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@ class User(

val password: String,

val email: String,

val nickname: String,

val profileImage: String? = null,

)
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ interface UserRepository : CrudRepository<User, Long> {

fun existsByIdentifier(userId: String): Boolean

fun existsByEmail(email: String): Boolean

fun findByIdentifier(userId: String): User?

}

0 comments on commit ac29d32

Please sign in to comment.