Skip to content

Commit

Permalink
merge: signup policy
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut authored Sep 7, 2022
2 parents 7b400c4 + 57a4feb commit f55ea24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package team.comit.simtong.domain.user.policy
import team.comit.simtong.domain.user.dto.DomainSignUpRequest
import team.comit.simtong.domain.user.model.Authority
import team.comit.simtong.domain.user.model.User
import team.comit.simtong.domain.user.spi.CheckEmailPort
import team.comit.simtong.domain.user.spi.CheckEmployeePort
import team.comit.simtong.domain.user.spi.NickNamePort
import team.comit.simtong.domain.user.spi.SecurityPort
import team.comit.simtong.global.annotation.Policy
Expand All @@ -20,25 +18,23 @@ import team.comit.simtong.global.annotation.Policy
**/
@Policy
class SignUpPolicy(
private val checkEmployeePort: CheckEmployeePort,
private val checkEmailPort: CheckEmailPort,
private val randomNamePort: NickNamePort,
// private val nickNamePort: NickNamePort,
private val securityPort: SecurityPort
) {

fun implement(request: DomainSignUpRequest): User {

checkEmailPort.checkCertifiedEmail(request.email)
checkEmailPort.checkUsedEmail(request.email)

checkEmployeePort.checkList(request.name, request.employeeNumber)
// TODO 비즈니스 로직 직접 구현
// 인증된 이메일 확인
// 이미 사용중인 이메일 확인
// 임직원 확인

return User(
id = null,
name = request.name,
email = request.email,
password = securityPort.encode(request.password),
nickname = request.nickname ?: randomNamePort.random(),
nickname = request.nickname ?: "", // nickNamePort.random()
employeeNumber = request.employeeNumber,
authority = Authority.ROLE_COMMON,
adminCode = null,
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit f55ea24

Please sign in to comment.