diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/AdminSignInRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/AdminSignInRequest.kt deleted file mode 100644 index fe39328b..00000000 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/AdminSignInRequest.kt +++ /dev/null @@ -1,15 +0,0 @@ -package team.comit.simtong.domain.user.dto - -/** - * - * 관리자의 로그인을 정보를 전달하는 AdminSignInRequest - * - * @author kimbeomjin - * @date 2023/01/01 - * @version 1.1.0 - **/ -data class AdminSignInRequest( - val employeeNumber: Int, - - val password: String -) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeEmailRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeEmailRequest.kt deleted file mode 100644 index 2d32af21..00000000 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeEmailRequest.kt +++ /dev/null @@ -1,13 +0,0 @@ -package team.comit.simtong.domain.user.dto - -/** - * - * 이메일 변경 정보를 전달하는 ChangeEmailRequest - * - * @author Chokyunghyeon - * @date 2022/10/03 - * @version 1.0.0 - **/ -data class ChangeEmailRequest( - val email: String -) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangePasswordRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangePasswordRequest.kt deleted file mode 100644 index e9605818..00000000 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangePasswordRequest.kt +++ /dev/null @@ -1,14 +0,0 @@ -package team.comit.simtong.domain.user.dto - -/** - * - * 사용자의 비밀번호 변경 요청을 하는 ChangePasswordRequest - * - * @author Chokyunghyeon - * @date 2022/10/14 - * @version 1.0.0 - **/ -data class ChangePasswordRequest( - val password: String, - val newPassword: String -) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ResetPasswordRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ResetPasswordRequest.kt deleted file mode 100644 index 93bec9a6..00000000 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ResetPasswordRequest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package team.comit.simtong.domain.user.dto - -/** - * - * 비밀번호 초기화을 하기 위한 ResetPasswordRequest - * - * @author Chokyunghyeon - * @date 2022/09/27 - * @version 1.0.0 - **/ -data class ResetPasswordRequest( - val email: String, - - val employeeNumber: Int, - - val newPassword: String -) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/UserSignInRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/UserSignInRequest.kt deleted file mode 100644 index 541b6c3b..00000000 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/UserSignInRequest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package team.comit.simtong.domain.user.dto - -/** - * - * 일반 사용자의 로그인을 정보를 전달하는 UserSignInRequest - * - * @author kimbeomjin - * @date 2022/09/08 - * @version 1.0.0 - **/ -data class UserSignInRequest( - val employeeNumber: Int, - - val password: String, - - val deviceToken: String -) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/AdminSignInData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/AdminSignInData.kt new file mode 100644 index 00000000..43c5de6f --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/AdminSignInData.kt @@ -0,0 +1,16 @@ +package team.comit.simtong.domain.user.dto.request + +/** + * + * 관리자의 로그인 정보를 전달하는 AdminSignInData + * + * @author kimbeomjin + * @author Chokyunghyeon + * @date 2023/01/01 + * @version 1.2.5 + **/ +data class AdminSignInData( + val employeeNumber: Int, + + val password: String +) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeEmailData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeEmailData.kt new file mode 100644 index 00000000..5360a379 --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeEmailData.kt @@ -0,0 +1,13 @@ +package team.comit.simtong.domain.user.dto.request + +/** + * + * 이메일 변경 정보를 전달하는 ChangeEmailData + * + * @author Chokyunghyeon + * @date 2022/10/03 + * @version 1.2.5 + **/ +data class ChangeEmailData( + val email: String +) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeNicknameRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeNicknameData.kt similarity index 61% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeNicknameRequest.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeNicknameData.kt index 65f66414..e9f50c40 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeNicknameRequest.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeNicknameData.kt @@ -1,4 +1,4 @@ -package team.comit.simtong.domain.user.dto +package team.comit.simtong.domain.user.dto.request /** * @@ -6,8 +6,8 @@ package team.comit.simtong.domain.user.dto * * @author Chokyunghyeon * @date 2022/10/03 - * @version 1.0.0 + * @version 1.2.5 **/ -data class ChangeNicknameRequest( +data class ChangeNicknameData( val nickname: String ) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangePasswordData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangePasswordData.kt new file mode 100644 index 00000000..8d34543a --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangePasswordData.kt @@ -0,0 +1,15 @@ +package team.comit.simtong.domain.user.dto.request + +/** + * + * 사용자의 비밀번호 변경 요청 정보를 전달하는 ChangePasswordData + * + * @author Chokyunghyeon + * @date 2022/10/14 + * @version 1.2.5 + **/ +data class ChangePasswordData( + val password: String, + + val newPassword: String +) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeProfileImageRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeProfileImageData.kt similarity index 56% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeProfileImageRequest.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeProfileImageData.kt index e10ab4d6..45e11517 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeProfileImageRequest.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeProfileImageData.kt @@ -1,13 +1,13 @@ -package team.comit.simtong.domain.user.dto +package team.comit.simtong.domain.user.dto.request /** * - * 프로필 사진 변경 요청 정보를 전달하는 ChangeProfileImageRequest + * 프로필 사진 변경 요청 정보를 전달하는 ChangeProfileImageData * * @author Chokyunghyeon * @date 2022/10/03 - * @version 1.0.0 + * @version 1.2.5 **/ -data class ChangeProfileImageRequest( +data class ChangeProfileImageData( val profileImagePath: String ) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeSpotData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeSpotData.kt new file mode 100644 index 00000000..2bb418c7 --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeSpotData.kt @@ -0,0 +1,15 @@ +package team.comit.simtong.domain.user.dto.request + +import java.util.UUID + +/** + * + * 지점 변경 요청 정보를 전달하는 ChangeSpotData + * + * @author Chokyunghyeon + * @date 2023/01/12 + * @version 1.2.5 + **/ +data class ChangeSpotData( + val spotId: UUID +) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/CheckMatchedAccountRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/CheckMatchedAccountData.kt similarity index 52% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/CheckMatchedAccountRequest.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/CheckMatchedAccountData.kt index 428d7e54..d1666dda 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/CheckMatchedAccountRequest.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/CheckMatchedAccountData.kt @@ -1,14 +1,15 @@ -package team.comit.simtong.domain.user.dto +package team.comit.simtong.domain.user.dto.request /** * - * 해당 사원번호와 이메일을 가진 계정 여부 확인을 요청하는 CheckMatchedAccountRequest + * 해당 사원번호와 이메일을 가진 계정 여부 확인 요청 정보를 전달하는 CheckMatchedAccountData * * @author Chokyunghyeon * @date 2022/10/15 - * @version 1.0.0 + * @version 1.2.5 **/ -data class CheckMatchedAccountRequest( +data class CheckMatchedAccountData( val employeeNumber: Int, + val email: String ) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/FindEmployeeNumberRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/FindEmployeeNumberData.kt similarity index 59% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/FindEmployeeNumberRequest.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/FindEmployeeNumberData.kt index b3c2abf5..9a8be95b 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/FindEmployeeNumberRequest.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/FindEmployeeNumberData.kt @@ -1,16 +1,16 @@ -package team.comit.simtong.domain.user.dto +package team.comit.simtong.domain.user.dto.request -import java.util.* +import java.util.UUID /** * - * 사원 번호 찾기 정보를 전달하는 FindEmployeeNumberRequest + * 사원 번호 찾기 정보를 전달하는 FindEmployeeNumberData * * @author Chokyunghyeon * @date 2022/09/11 - * @version 1.0.0 + * @version 1.2.5 **/ -data class FindEmployeeNumberRequest( +data class FindEmployeeNumberData( val name: String, val spotId: UUID, diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ResetPasswordData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ResetPasswordData.kt new file mode 100644 index 00000000..d55fc6a5 --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ResetPasswordData.kt @@ -0,0 +1,17 @@ +package team.comit.simtong.domain.user.dto.request + +/** + * + * 비밀번호 초기화 요청 정보를 전달하는 ResetPasswordData + * + * @author Chokyunghyeon + * @date 2022/09/27 + * @version 1.2.5 + **/ +data class ResetPasswordData( + val email: String, + + val employeeNumber: Int, + + val newPassword: String +) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/SignUpRequest.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignUpData.kt similarity index 66% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/SignUpRequest.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignUpData.kt index 9182b742..2f10535c 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/SignUpRequest.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignUpData.kt @@ -1,15 +1,15 @@ -package team.comit.simtong.domain.user.dto +package team.comit.simtong.domain.user.dto.request /** * - * 회원 가입 정보를 전달하는 SignUpRequest + * 회원 가입 정보를 전달하는 SignUpData * * @author Chokyunghyeon * @author kimbeomjin * @date 2022/09/04 - * @version 1.2.1 + * @version 1.2.5 **/ -data class SignUpRequest( +data class SignUpData( val name: String, val email: String, diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/UserSignInData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/UserSignInData.kt new file mode 100644 index 00000000..9ff3381e --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/request/UserSignInData.kt @@ -0,0 +1,17 @@ +package team.comit.simtong.domain.user.dto.request + +/** + * + * 일반 사용자의 로그인 정보를 전달하는 UserSignInData + * + * @author kimbeomjin + * @date 2022/09/08 + * @version 1.2.5 + **/ +data class UserSignInData( + val employeeNumber: Int, + + val password: String, + + val deviceToken: String +) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/QueryAdminInfoResponse.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/response/QueryAdminInfoResponse.kt similarity index 89% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/QueryAdminInfoResponse.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/response/QueryAdminInfoResponse.kt index 47b199a3..2ec809eb 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/QueryAdminInfoResponse.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/response/QueryAdminInfoResponse.kt @@ -1,4 +1,4 @@ -package team.comit.simtong.domain.user.dto +package team.comit.simtong.domain.user.dto.response import java.util.UUID diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/QueryUserInfoResponse.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/response/QueryUserInfoResponse.kt similarity index 85% rename from simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/QueryUserInfoResponse.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/response/QueryUserInfoResponse.kt index 651e7232..2722515d 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/QueryUserInfoResponse.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/dto/response/QueryUserInfoResponse.kt @@ -1,4 +1,4 @@ -package team.comit.simtong.domain.user.dto +package team.comit.simtong.domain.user.dto.response /** * diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCase.kt index 9dd7cd39..82dd01b3 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCase.kt @@ -1,7 +1,7 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.auth.dto.TokenResponse -import team.comit.simtong.domain.user.dto.AdminSignInRequest +import team.comit.simtong.domain.user.dto.request.AdminSignInData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.spi.QueryUserPort @@ -25,7 +25,7 @@ class AdminSignInUseCase( private val securityPort: UserSecurityPort ) { - fun execute(request: AdminSignInRequest): TokenResponse { + fun execute(request: AdminSignInData): TokenResponse { val admin = queryUserPort.queryUserByEmployeeNumber(request.employeeNumber) ?.apply { this.checkAuthority(Authority.ROLE_ADMIN) } ?: throw UserExceptions.NotFound("관리자가 존재하지 않습니다.") diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCase.kt index 51d14318..59108880 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCase.kt @@ -2,7 +2,7 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.auth.exception.AuthExceptions import team.comit.simtong.domain.auth.spi.QueryAuthCodeLimitPort -import team.comit.simtong.domain.user.dto.ChangeEmailRequest +import team.comit.simtong.domain.user.dto.request.ChangeEmailData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.CommandUserPort import team.comit.simtong.domain.user.spi.QueryUserPort @@ -25,7 +25,7 @@ class ChangeEmailUseCase( private val commandUserPort: CommandUserPort ) { - fun execute(request: ChangeEmailRequest) { + fun execute(request: ChangeEmailData) { if (queryUserPort.existsUserByEmail(request.email)) { throw AuthExceptions.AlreadyUsedEmail() } diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCase.kt index 3b58c9e7..31e96512 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCase.kt @@ -1,6 +1,6 @@ package team.comit.simtong.domain.user.usecase -import team.comit.simtong.domain.user.dto.ChangeNicknameRequest +import team.comit.simtong.domain.user.dto.request.ChangeNicknameData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.CommandUserPort import team.comit.simtong.domain.user.spi.QueryUserPort @@ -22,7 +22,7 @@ class ChangeNicknameUseCase( private val commandUserPort: CommandUserPort ) { - fun execute(request: ChangeNicknameRequest) { + fun execute(request: ChangeNicknameData) { if (queryUserPort.existsUserByNickname(request.nickname)) { throw UserExceptions.AlreadyUsedNickname() } diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCase.kt index 398faddb..c70ba082 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCase.kt @@ -1,6 +1,6 @@ package team.comit.simtong.domain.user.usecase -import team.comit.simtong.domain.user.dto.ChangePasswordRequest +import team.comit.simtong.domain.user.dto.request.ChangePasswordData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.CommandUserPort import team.comit.simtong.domain.user.spi.QueryUserPort @@ -22,8 +22,9 @@ class ChangePasswordUseCase( private val commandUserPort: CommandUserPort ) { - fun execute(request: ChangePasswordRequest) { + fun execute(request: ChangePasswordData) { val currentUserId = securityPort.getCurrentUserId() + val user = queryUserPort.queryUserById(currentUserId) ?: throw UserExceptions.NotFound() if (!securityPort.compare(request.password, user.password.value)) { diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCase.kt index c80255a8..2d25de6b 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCase.kt @@ -2,7 +2,7 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.file.exception.FileExceptions import team.comit.simtong.domain.file.spi.CheckFilePort -import team.comit.simtong.domain.user.dto.ChangeProfileImageRequest +import team.comit.simtong.domain.user.dto.request.ChangeProfileImageData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.CommandUserPort import team.comit.simtong.domain.user.spi.QueryUserPort @@ -25,7 +25,7 @@ class ChangeProfileImageUseCase( private val checkFilePort: CheckFilePort ) { - fun execute(request: ChangeProfileImageRequest) { + fun execute(request: ChangeProfileImageData) { if (!checkFilePort.existsPath(request.profileImagePath)) { throw FileExceptions.PathNotFound() } diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCase.kt index 3a7a1348..f0382485 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCase.kt @@ -1,13 +1,13 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.spot.exception.SpotExceptions +import team.comit.simtong.domain.user.dto.request.ChangeSpotData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.CommandUserPort import team.comit.simtong.domain.user.spi.QueryUserPort import team.comit.simtong.domain.user.spi.UserQuerySpotPort import team.comit.simtong.domain.user.spi.UserSecurityPort import team.comit.simtong.global.annotation.UseCase -import java.util.UUID /** * @@ -25,17 +25,17 @@ class ChangeSpotUseCase( private val securityPort: UserSecurityPort ) { - fun execute(newSpotId: UUID) { + fun execute(request: ChangeSpotData) { val user = queryUserPort.queryUserById(securityPort.getCurrentUserId()) ?: throw UserExceptions.NotFound() - if (!querySpotPort.existsSpotById(newSpotId)) { + if (!querySpotPort.existsSpotById(request.spotId)) { throw SpotExceptions.NotFound() } commandUserPort.save( user.changeSpot( - spotId = newSpotId + spotId = request.spotId ) ) } diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCase.kt index 34600ab9..fcffa946 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCase.kt @@ -1,6 +1,6 @@ package team.comit.simtong.domain.user.usecase -import team.comit.simtong.domain.user.dto.CheckMatchedAccountRequest +import team.comit.simtong.domain.user.dto.request.CheckMatchedAccountData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.QueryUserPort import team.comit.simtong.global.annotation.ReadOnlyUseCase @@ -18,7 +18,7 @@ class CheckMatchedAccountUseCase( private val queryUserPort: QueryUserPort ) { - fun execute(request: CheckMatchedAccountRequest) { + fun execute(request: CheckMatchedAccountData) { if (!queryUserPort.existsUserByEmployeeNumberAndEmail(request.employeeNumber, request.email)) { throw UserExceptions.NotFound() diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCase.kt index e1c8701e..f4f38447 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCase.kt @@ -1,6 +1,6 @@ package team.comit.simtong.domain.user.usecase -import team.comit.simtong.domain.user.dto.FindEmployeeNumberRequest +import team.comit.simtong.domain.user.dto.request.FindEmployeeNumberData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.QueryUserPort import team.comit.simtong.global.annotation.UseCase @@ -18,7 +18,7 @@ class FindEmployeeNumberUseCase( private val queryUserPort: QueryUserPort ) { - fun execute(request: FindEmployeeNumberRequest): Int { + fun execute(request: FindEmployeeNumberData): Int { val user = queryUserPort.queryUserByNameAndSpotAndEmail(request.name, request.spotId, request.email) ?: throw UserExceptions.NotFound() diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCase.kt index adc20ccb..1a721f40 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCase.kt @@ -1,7 +1,7 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.spot.exception.SpotExceptions -import team.comit.simtong.domain.user.dto.QueryAdminInfoResponse +import team.comit.simtong.domain.user.dto.response.QueryAdminInfoResponse import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.QueryUserPort import team.comit.simtong.domain.user.spi.UserQuerySpotPort diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCase.kt index 72c0aeba..9c93797a 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCase.kt @@ -1,7 +1,7 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.spot.exception.SpotExceptions -import team.comit.simtong.domain.user.dto.QueryUserInfoResponse +import team.comit.simtong.domain.user.dto.response.QueryUserInfoResponse import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.QueryUserPort import team.comit.simtong.domain.user.spi.UserQuerySpotPort diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCase.kt index a21d9444..bac24383 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCase.kt @@ -1,7 +1,7 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.auth.exception.AuthExceptions -import team.comit.simtong.domain.user.dto.ResetPasswordRequest +import team.comit.simtong.domain.user.dto.request.ResetPasswordData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.CommandUserPort import team.comit.simtong.domain.user.spi.QueryUserPort @@ -27,7 +27,7 @@ class ResetPasswordUseCase( private val securityPort: UserSecurityPort ) { - fun execute(request: ResetPasswordRequest) { + fun execute(request: ResetPasswordData) { val authCodeLimit = queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(request.email) ?: throw AuthExceptions.RequiredNewEmailAuthentication() diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCase.kt index c5e5b4ca..9cec3570 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCase.kt @@ -1,7 +1,7 @@ package team.comit.simtong.domain.user.usecase import team.comit.simtong.domain.auth.dto.TokenResponse -import team.comit.simtong.domain.user.dto.UserSignInRequest +import team.comit.simtong.domain.user.dto.request.UserSignInData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.DeviceToken @@ -27,7 +27,7 @@ class SignInUseCase( private val commandDeviceTokenPort: CommandDeviceTokenPort ) { - fun execute(request: UserSignInRequest): TokenResponse { + fun execute(request: UserSignInData): TokenResponse { val employee = queryUserPort.queryUserByEmployeeNumber(request.employeeNumber) ?.apply { checkAuthority(Authority.ROLE_COMMON) } ?: throw UserExceptions.NotFound() diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCase.kt index e5561f57..832dce3f 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCase.kt @@ -5,7 +5,7 @@ import team.comit.simtong.domain.auth.exception.AuthExceptions import team.comit.simtong.domain.file.exception.FileExceptions import team.comit.simtong.domain.spot.exception.SpotExceptions import team.comit.simtong.domain.team.exception.TeamExceptions -import team.comit.simtong.domain.user.dto.SignUpRequest +import team.comit.simtong.domain.user.dto.request.SignUpData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.DeviceToken @@ -46,7 +46,7 @@ class SignUpUseCase( private val queryEmployeeCertificatePort: UserQueryEmployeeCertificatePort ) { - fun execute(request: SignUpRequest): TokenResponse { + fun execute(request: SignUpData): TokenResponse { val authCodeLimit = queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(request.email) ?: throw AuthExceptions.RequiredNewEmailAuthentication() @@ -64,7 +64,7 @@ class SignUpUseCase( ) } - private fun create(request: SignUpRequest): User { + private fun create(request: SignUpData): User { checkAlreadyExists(request.email, request.employeeNumber, request.nickname) val employeeCertificate = queryEmployeeCertificatePort.queryEmployeeCertificateByNameAndEmployeeNumber( diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCaseTests.kt index 2fd8e6fa..96afcb20 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/AdminSignInUseCaseTests.kt @@ -7,7 +7,7 @@ import org.junit.jupiter.api.assertThrows import org.mockito.BDDMockito.given import org.springframework.boot.test.mock.mockito.MockBean import team.comit.simtong.domain.auth.dto.TokenResponse -import team.comit.simtong.domain.user.dto.AdminSignInRequest +import team.comit.simtong.domain.user.dto.request.AdminSignInData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -25,10 +25,10 @@ class AdminSignInUseCaseTests { private lateinit var queryUserPort: QueryUserPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort @MockBean - private lateinit var userJwtPort: UserJwtPort + private lateinit var jwtPort: UserJwtPort private lateinit var adminSignInUseCase: AdminSignInUseCase @@ -64,8 +64,8 @@ class AdminSignInUseCaseTests { ) } - private val requestStub: AdminSignInRequest by lazy { - AdminSignInRequest( + private val requestStub: AdminSignInData by lazy { + AdminSignInData( employeeNumber = employeeNumber, password = "test password" ) @@ -83,8 +83,8 @@ class AdminSignInUseCaseTests { fun setUp() { adminSignInUseCase = AdminSignInUseCase( queryUserPort, - userJwtPort, - userSecurityPort + jwtPort, + securityPort ) } @@ -94,10 +94,10 @@ class AdminSignInUseCaseTests { given(queryUserPort.queryUserByEmployeeNumber(employeeNumber)) .willReturn(adminStub) - given(userSecurityPort.compare(requestStub.password, adminStub.password.value)) + given(securityPort.compare(requestStub.password, adminStub.password.value)) .willReturn(true) - given(userJwtPort.receiveToken(adminStub.id, adminStub.authority)) + given(jwtPort.receiveToken(adminStub.id, adminStub.authority)) .willReturn(responseStub) // when @@ -113,7 +113,7 @@ class AdminSignInUseCaseTests { given(queryUserPort.queryUserByEmployeeNumber(employeeNumber)) .willReturn(adminStub) - given(userSecurityPort.compare(requestStub.password, adminStub.password.value)) + given(securityPort.compare(requestStub.password, adminStub.password.value)) .willReturn(false) // when & then diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCaseTests.kt index 9f230c4e..53df43f3 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeEmailUseCaseTests.kt @@ -9,7 +9,7 @@ import org.springframework.boot.test.mock.mockito.MockBean import team.comit.simtong.domain.auth.exception.AuthExceptions import team.comit.simtong.domain.auth.model.AuthCodeLimit import team.comit.simtong.domain.auth.spi.QueryAuthCodeLimitPort -import team.comit.simtong.domain.user.dto.ChangeEmailRequest +import team.comit.simtong.domain.user.dto.request.ChangeEmailData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -26,7 +26,7 @@ class ChangeEmailUseCaseTests { private lateinit var queryUserPort: QueryUserPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort @MockBean private lateinit var queryAuthCodeLimitPort: QueryAuthCodeLimitPort @@ -38,8 +38,8 @@ class ChangeEmailUseCaseTests { private val id = UUID.randomUUID() - private val requestStub: ChangeEmailRequest by lazy { - ChangeEmailRequest( + private val requestStub: ChangeEmailData by lazy { + ChangeEmailData( email = "test@test.com" ) } @@ -75,7 +75,7 @@ class ChangeEmailUseCaseTests { fun setUp() { changeEmailUseCase = ChangeEmailUseCase( queryUserPort, - userSecurityPort, + securityPort, queryAuthCodeLimitPort, commandUserPort ) @@ -90,7 +90,7 @@ class ChangeEmailUseCaseTests { given(queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(requestStub.email)) .willReturn(authCodeLimitStub) - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) @@ -153,7 +153,7 @@ class ChangeEmailUseCaseTests { given(queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(requestStub.email)) .willReturn(authCodeLimitStub) - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCaseTests.kt index 0227be8f..ed0e7227 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeNicknameUseCaseTests.kt @@ -6,7 +6,7 @@ import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import org.mockito.kotlin.given import org.springframework.boot.test.mock.mockito.MockBean -import team.comit.simtong.domain.user.dto.ChangeNicknameRequest +import team.comit.simtong.domain.user.dto.request.ChangeNicknameData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -23,7 +23,7 @@ class ChangeNicknameUseCaseTests { private lateinit var queryUserPort: QueryUserPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort @MockBean private lateinit var commandUserPort: CommandUserPort @@ -32,8 +32,8 @@ class ChangeNicknameUseCaseTests { private val id = UUID.randomUUID() - private val requestStub: ChangeNicknameRequest by lazy { - ChangeNicknameRequest( + private val requestStub: ChangeNicknameData by lazy { + ChangeNicknameData( nickname = "test nickname" ) } @@ -57,7 +57,7 @@ class ChangeNicknameUseCaseTests { fun setUp() { changeNicknameUseCase = ChangeNicknameUseCase( queryUserPort, - userSecurityPort, + securityPort, commandUserPort ) } @@ -68,7 +68,7 @@ class ChangeNicknameUseCaseTests { given(queryUserPort.existsUserByNickname(requestStub.nickname)) .willReturn(false) - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCaseTests.kt index 0c620538..47eae481 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangePasswordUseCaseTests.kt @@ -6,7 +6,7 @@ import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import org.mockito.BDDMockito.given import org.springframework.boot.test.mock.mockito.MockBean -import team.comit.simtong.domain.user.dto.ChangePasswordRequest +import team.comit.simtong.domain.user.dto.request.ChangePasswordData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -23,7 +23,7 @@ class ChangePasswordUseCaseTests { private lateinit var queryUserPort: QueryUserPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort @MockBean private lateinit var commandUserPort: CommandUserPort @@ -47,8 +47,8 @@ class ChangePasswordUseCaseTests { ) } - private val requestStub: ChangePasswordRequest by lazy { - ChangePasswordRequest( + private val requestStub: ChangePasswordData by lazy { + ChangePasswordData( password = "test password", newPassword = "test new password" ) @@ -58,7 +58,7 @@ class ChangePasswordUseCaseTests { fun setUp() { changePasswordUseCase = ChangePasswordUseCase( queryUserPort, - userSecurityPort, + securityPort, commandUserPort ) } @@ -66,16 +66,16 @@ class ChangePasswordUseCaseTests { @Test fun `비밀번호 변경 성공`() { // given - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) .willReturn(userStub) - given(userSecurityPort.compare(requestStub.password, userStub.password.value)) + given(securityPort.compare(requestStub.password, userStub.password.value)) .willReturn(true) - given(userSecurityPort.encode(requestStub.newPassword)) + given(securityPort.encode(requestStub.newPassword)) .willReturn(requestStub.newPassword) // when & then @@ -87,7 +87,7 @@ class ChangePasswordUseCaseTests { @Test fun `유저 찾기 실패`() { // given - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) @@ -102,13 +102,13 @@ class ChangePasswordUseCaseTests { @Test fun `비밀번호 불일치`() { // given - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) .willReturn(userStub) - given(userSecurityPort.compare(requestStub.password, userStub.password.value)) + given(securityPort.compare(requestStub.password, userStub.password.value)) .willReturn(false) // when & then diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCaseTests.kt index 159cd8cc..e98c43c4 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeProfileImageUseCaseTests.kt @@ -8,7 +8,7 @@ import org.mockito.BDDMockito.given import org.springframework.boot.test.mock.mockito.MockBean import team.comit.simtong.domain.file.exception.FileExceptions import team.comit.simtong.domain.file.spi.CheckFilePort -import team.comit.simtong.domain.user.dto.ChangeProfileImageRequest +import team.comit.simtong.domain.user.dto.request.ChangeProfileImageData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -25,7 +25,7 @@ class ChangeProfileImageUseCaseTests { private lateinit var queryUserPort: QueryUserPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort @MockBean private lateinit var commandUserPort: CommandUserPort @@ -37,8 +37,8 @@ class ChangeProfileImageUseCaseTests { private val id = UUID.randomUUID() - private val requestStub: ChangeProfileImageRequest by lazy { - ChangeProfileImageRequest( + private val requestStub: ChangeProfileImageData by lazy { + ChangeProfileImageData( profileImagePath = "test path" ) } @@ -62,7 +62,7 @@ class ChangeProfileImageUseCaseTests { fun setUp() { changeProfileImageUseCase = ChangeProfileImageUseCase( queryUserPort, - userSecurityPort, + securityPort, commandUserPort, checkFilePort ) @@ -74,7 +74,7 @@ class ChangeProfileImageUseCaseTests { given(checkFilePort.existsPath(requestStub.profileImagePath)) .willReturn(true) - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) @@ -104,7 +104,7 @@ class ChangeProfileImageUseCaseTests { given(checkFilePort.existsPath(requestStub.profileImagePath)) .willReturn(true) - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(id) given(queryUserPort.queryUserById(id)) diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCaseTests.kt index 55af3721..ddbe0363 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ChangeSpotUseCaseTests.kt @@ -10,6 +10,7 @@ import org.springframework.boot.test.mock.mockito.MockBean import org.springframework.context.annotation.Import import org.springframework.test.context.junit.jupiter.SpringExtension import team.comit.simtong.domain.spot.exception.SpotExceptions +import team.comit.simtong.domain.user.dto.request.ChangeSpotData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -34,7 +35,7 @@ class ChangeSpotUseCaseTests { private lateinit var querySpotPort: UserQuerySpotPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort private lateinit var changeSpotUseCase: ChangeSpotUseCase @@ -56,15 +57,19 @@ class ChangeSpotUseCaseTests { ) } + private val requestStub: ChangeSpotData by lazy { + ChangeSpotData(spotId) + } + @BeforeEach fun setUp() { - changeSpotUseCase = ChangeSpotUseCase(queryUserPort, commandUserPort, querySpotPort, userSecurityPort) + changeSpotUseCase = ChangeSpotUseCase(queryUserPort, commandUserPort, querySpotPort, securityPort) } @Test fun `지점 변경 성공`() { // given - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(userId) given(queryUserPort.queryUserById(userId)) @@ -75,14 +80,14 @@ class ChangeSpotUseCaseTests { // when & then assertDoesNotThrow { - changeSpotUseCase.execute(spotId) + changeSpotUseCase.execute(requestStub) } } @Test fun `유저를 찾을 수 없음`() { // given - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(userId) given(queryUserPort.queryUserById(userId)) @@ -90,14 +95,14 @@ class ChangeSpotUseCaseTests { // when & then assertThrows { - changeSpotUseCase.execute(spotId) + changeSpotUseCase.execute(requestStub) } } @Test fun `지점을 찾을 수 없음`() { // given - given(userSecurityPort.getCurrentUserId()) + given(securityPort.getCurrentUserId()) .willReturn(userId) given(queryUserPort.queryUserById(userId)) @@ -108,7 +113,7 @@ class ChangeSpotUseCaseTests { // when & then assertThrows { - changeSpotUseCase.execute(spotId) + changeSpotUseCase.execute(requestStub) } } diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCaseTests.kt index a960279a..ecf21eec 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/CheckMatchedAccountUseCaseTests.kt @@ -6,7 +6,7 @@ import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows import org.mockito.kotlin.given import org.springframework.boot.test.mock.mockito.MockBean -import team.comit.simtong.domain.user.dto.CheckMatchedAccountRequest +import team.comit.simtong.domain.user.dto.request.CheckMatchedAccountData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.spi.QueryUserPort import team.comit.simtong.global.annotation.SimtongTest @@ -19,8 +19,8 @@ class CheckMatchedAccountUseCaseTests { private lateinit var checkMatchedAccountUseCase: CheckMatchedAccountUseCase - private val requestStub: CheckMatchedAccountRequest by lazy { - CheckMatchedAccountRequest( + private val requestStub: CheckMatchedAccountData by lazy { + CheckMatchedAccountData( employeeNumber = 1234567890, email = "test@test.com" ) diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCaseTests.kt index a60f51bd..bea64fe5 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/FindEmployeeNumberUseCaseTests.kt @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.mockito.BDDMockito.given import org.springframework.boot.test.mock.mockito.MockBean -import team.comit.simtong.domain.user.dto.FindEmployeeNumberRequest +import team.comit.simtong.domain.user.dto.request.FindEmployeeNumberData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -44,8 +44,8 @@ class FindEmployeeNumberUseCaseTests { ) } - private val requestStub: FindEmployeeNumberRequest by lazy { - FindEmployeeNumberRequest( + private val requestStub: FindEmployeeNumberData by lazy { + FindEmployeeNumberData( name = name, spotId = spotId, email = email diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCaseTests.kt index c3c6fdad..0e1d5478 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryAdminInfoUseCaseTests.kt @@ -8,7 +8,7 @@ import org.mockito.kotlin.given import org.springframework.boot.test.mock.mockito.MockBean import team.comit.simtong.domain.spot.exception.SpotExceptions import team.comit.simtong.domain.spot.model.Spot -import team.comit.simtong.domain.user.dto.QueryAdminInfoResponse +import team.comit.simtong.domain.user.dto.response.QueryAdminInfoResponse import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCaseTests.kt index cf709890..4e30d1ca 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/QueryUserInfoUseCaseTests.kt @@ -8,7 +8,7 @@ import org.mockito.BDDMockito.given import org.springframework.boot.test.mock.mockito.MockBean import team.comit.simtong.domain.spot.exception.SpotExceptions import team.comit.simtong.domain.spot.model.Spot -import team.comit.simtong.domain.user.dto.QueryUserInfoResponse +import team.comit.simtong.domain.user.dto.response.QueryUserInfoResponse import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCaseTests.kt index 4c766fe9..943b4213 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/ResetPasswordUseCaseTests.kt @@ -8,7 +8,7 @@ import org.mockito.kotlin.given import org.springframework.boot.test.mock.mockito.MockBean import team.comit.simtong.domain.auth.exception.AuthExceptions import team.comit.simtong.domain.auth.model.AuthCodeLimit -import team.comit.simtong.domain.user.dto.ResetPasswordRequest +import team.comit.simtong.domain.user.dto.request.ResetPasswordData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -36,7 +36,7 @@ class ResetPasswordUseCaseTests { private lateinit var commandUserPort: CommandUserPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort private lateinit var resetPasswordUseCase: ResetPasswordUseCase @@ -44,8 +44,8 @@ class ResetPasswordUseCaseTests { private val id = UUID.randomUUID() - private val requestStub: ResetPasswordRequest by lazy { - ResetPasswordRequest( + private val requestStub: ResetPasswordData by lazy { + ResetPasswordData( email = email, employeeNumber = 1234567890, newPassword = "test password" @@ -84,7 +84,7 @@ class ResetPasswordUseCaseTests { userQueryAuthCodeLimitPort, commandAuthCodeLimitPort, commandUserPort, - userSecurityPort + securityPort ) } @@ -97,7 +97,7 @@ class ResetPasswordUseCaseTests { given(queryUserPort.queryUserByEmailAndEmployeeNumber(requestStub.email, requestStub.employeeNumber)) .willReturn(userStub) - given(userSecurityPort.encode(requestStub.newPassword)) + given(securityPort.encode(requestStub.newPassword)) .willReturn(requestStub.newPassword) // when & then diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCaseTests.kt index ed20d021..6859e545 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignInUseCaseTests.kt @@ -7,7 +7,7 @@ import org.junit.jupiter.api.assertThrows import org.mockito.BDDMockito.given import org.springframework.boot.test.mock.mockito.MockBean import team.comit.simtong.domain.auth.dto.TokenResponse -import team.comit.simtong.domain.user.dto.UserSignInRequest +import team.comit.simtong.domain.user.dto.request.UserSignInData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -16,8 +16,8 @@ import team.comit.simtong.domain.user.spi.QueryUserPort import team.comit.simtong.domain.user.spi.UserJwtPort import team.comit.simtong.domain.user.spi.UserSecurityPort import team.comit.simtong.global.annotation.SimtongTest -import java.util.UUID import java.util.Date +import java.util.UUID @SimtongTest class SignInUseCaseTests { @@ -26,10 +26,10 @@ class SignInUseCaseTests { private lateinit var queryUserPort: QueryUserPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort @MockBean - private lateinit var userJwtPort: UserJwtPort + private lateinit var jwtPort: UserJwtPort @MockBean private lateinit var commandDeviceTokenPort: CommandDeviceTokenPort @@ -68,8 +68,8 @@ class SignInUseCaseTests { ) } - private val requestStub: UserSignInRequest by lazy { - UserSignInRequest( + private val requestStub: UserSignInData by lazy { + UserSignInData( employeeNumber = employeeNumber, password = "test password", deviceToken = "test device token" @@ -86,7 +86,7 @@ class SignInUseCaseTests { @BeforeEach fun setUp() { - signInUseCase = SignInUseCase(queryUserPort, userSecurityPort, userJwtPort, commandDeviceTokenPort) + signInUseCase = SignInUseCase(queryUserPort, securityPort, jwtPort, commandDeviceTokenPort) } @Test @@ -95,10 +95,10 @@ class SignInUseCaseTests { given(queryUserPort.queryUserByEmployeeNumber(employeeNumber)) .willReturn(userStub) - given(userSecurityPort.compare(requestStub.password, userStub.password.value)) + given(securityPort.compare(requestStub.password, userStub.password.value)) .willReturn(true) - given(userJwtPort.receiveToken(userStub.id, userStub.authority)) + given(jwtPort.receiveToken(userStub.id, userStub.authority)) .willReturn(responseStub) // when @@ -114,7 +114,7 @@ class SignInUseCaseTests { given(queryUserPort.queryUserByEmployeeNumber(employeeNumber)) .willReturn(userStub) - given(userSecurityPort.compare(requestStub.password, userStub.password.value)) + given(securityPort.compare(requestStub.password, userStub.password.value)) .willReturn(false) // when & then diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCaseTests.kt index 1e130fb3..852959e6 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/user/usecase/SignUpUseCaseTests.kt @@ -15,7 +15,7 @@ import team.comit.simtong.domain.spot.exception.SpotExceptions import team.comit.simtong.domain.spot.model.Spot import team.comit.simtong.domain.team.exception.TeamExceptions import team.comit.simtong.domain.team.model.Team -import team.comit.simtong.domain.user.dto.SignUpRequest +import team.comit.simtong.domain.user.dto.request.SignUpData import team.comit.simtong.domain.user.exception.UserExceptions import team.comit.simtong.domain.user.model.Authority import team.comit.simtong.domain.user.model.User @@ -37,7 +37,7 @@ import java.util.UUID class SignUpUseCaseTests { @MockBean - private lateinit var userJwtPort: UserJwtPort + private lateinit var jwtPort: UserJwtPort @MockBean private lateinit var commandUserPort: CommandUserPort @@ -46,7 +46,7 @@ class SignUpUseCaseTests { private lateinit var commandDeviceTokenPort: CommandDeviceTokenPort @MockBean - private lateinit var userSecurityPort: UserSecurityPort + private lateinit var securityPort: UserSecurityPort @MockBean private lateinit var queryUserPort: QueryUserPort @@ -131,8 +131,8 @@ class SignUpUseCaseTests { ) } - private val requestStub: SignUpRequest by lazy { - SignUpRequest( + private val requestStub: SignUpData by lazy { + SignUpData( nickname = nickname, name = name, email = email, @@ -154,7 +154,7 @@ class SignUpUseCaseTests { @BeforeEach fun setUp() { signUpUseCase = SignUpUseCase( - userJwtPort, + jwtPort, commandUserPort, commandDeviceTokenPort, queryUserPort, @@ -162,7 +162,7 @@ class SignUpUseCaseTests { commandAuthCodeLimitPort, userQuerySpotPort, userQueryTeamPort, - userSecurityPort, + securityPort, queryEmployeeCertificatePort ) } @@ -203,13 +203,13 @@ class SignUpUseCaseTests { given(userQueryTeamPort.queryTeamByName(employeeCertificateStub.teamName)) .willReturn(teamStub) - given(userSecurityPort.encode(requestStub.password)) + given(securityPort.encode(requestStub.password)) .willReturn(userStub.password.value) given(commandUserPort.save(userStub)) .willReturn(saveUserStub) - given(userJwtPort.receiveToken(saveUserStub.id, saveUserStub.authority)) + given(jwtPort.receiveToken(saveUserStub.id, saveUserStub.authority)) .willReturn(responseStub) // when @@ -222,7 +222,7 @@ class SignUpUseCaseTests { @Test fun `회원가입 성공 OPTINAL`() { // given - val requestStub = SignUpRequest( + val requestStub = SignUpData( nickname = nickname, name = name, email = email, @@ -265,13 +265,13 @@ class SignUpUseCaseTests { given(userQueryTeamPort.queryTeamByName(employeeCertificateStub.teamName)) .willReturn(teamStub) - given(userSecurityPort.encode(requestStub.password)) + given(securityPort.encode(requestStub.password)) .willReturn(userStub.password.value) given(commandUserPort.save(userStub)) .willReturn(saveUserStub) - given(userJwtPort.receiveToken(saveUserStub.id, saveUserStub.authority)) + given(jwtPort.receiveToken(saveUserStub.id, saveUserStub.authority)) .willReturn(responseStub) // when diff --git a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/user/model/Password.kt b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/user/model/Password.kt index 3839fea6..e27710db 100644 --- a/simtong-domain/src/main/kotlin/team/comit/simtong/domain/user/model/Password.kt +++ b/simtong-domain/src/main/kotlin/team/comit/simtong/domain/user/model/Password.kt @@ -22,7 +22,7 @@ value class Password( * * non-space, $ , + , - , _ , a ~ z , A ~ Z , 0 ~ 9 */ - const val PATTERN = """(?=.*[a-zA-Z])(?=.*\d)(?=^[\w$+-]{$MIN_LENGTH,$MAX_LENGTH$).*""" + const val PATTERN = """(?=.*[a-zA-Z])(?=.*\d)(?=^[\w$+-]{$MIN_LENGTH,$MAX_LENGTH}$).*""" fun of(password: String) = Password(password) } diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/WebAdminAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/WebAdminAdapter.kt index 2ee4ba8f..f05bd2b6 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/WebAdminAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/WebAdminAdapter.kt @@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController import team.comit.simtong.domain.admin.dto.request.SignInWebRequest import team.comit.simtong.domain.auth.dto.TokenResponse -import team.comit.simtong.domain.user.dto.AdminSignInRequest -import team.comit.simtong.domain.user.dto.QueryAdminInfoResponse +import team.comit.simtong.domain.user.dto.request.AdminSignInData +import team.comit.simtong.domain.user.dto.response.QueryAdminInfoResponse import team.comit.simtong.domain.user.usecase.AdminSignInUseCase import team.comit.simtong.domain.user.usecase.QueryAdminInfoUseCase import javax.validation.Valid @@ -31,7 +31,7 @@ class WebAdminAdapter( @PostMapping("/tokens") fun signIn(@Valid @RequestBody request: SignInWebRequest): TokenResponse { return adminSignInUseCase.execute( - AdminSignInRequest( + AdminSignInData( employeeNumber = request.employeeNumber.value, password = request.password.value ) diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/request/SignInWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/request/SignInWebRequest.kt index 49bde3b7..e5a0a699 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/request/SignInWebRequest.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/request/SignInWebRequest.kt @@ -1,8 +1,8 @@ package team.comit.simtong.domain.admin.dto.request import org.hibernate.validator.constraints.Range -import team.comit.simtong.domain.user.value.EmployeeNumber -import team.comit.simtong.domain.user.value.Password +import team.comit.simtong.domain.user.model.EmployeeNumber +import team.comit.simtong.domain.user.model.Password import javax.validation.constraints.NotBlank /** diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt index 3814de13..e37a3e4c 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/WebCommonAdapter.kt @@ -14,18 +14,18 @@ import team.comit.simtong.domain.spot.dto.SpotResponse import team.comit.simtong.domain.spot.usecase.ShowSpotListUseCase import team.comit.simtong.domain.team.dto.QueryTeamsResponse import team.comit.simtong.domain.team.usecase.QueryTeamsUseCase -import team.comit.simtong.domain.user.dto.ChangePasswordRequest -import team.comit.simtong.domain.user.dto.CheckMatchedAccountRequest -import team.comit.simtong.domain.user.dto.FindEmployeeNumberRequest -import team.comit.simtong.domain.user.dto.ResetPasswordRequest +import team.comit.simtong.domain.user.dto.request.ChangePasswordData +import team.comit.simtong.domain.user.dto.request.CheckMatchedAccountData +import team.comit.simtong.domain.user.dto.request.FindEmployeeNumberData +import team.comit.simtong.domain.user.dto.request.ResetPasswordData +import team.comit.simtong.domain.user.model.EmployeeNumber +import team.comit.simtong.domain.user.model.Password import team.comit.simtong.domain.user.usecase.ChangePasswordUseCase import team.comit.simtong.domain.user.usecase.CheckEmailDuplicationUseCase import team.comit.simtong.domain.user.usecase.CheckMatchedAccountUseCase import team.comit.simtong.domain.user.usecase.ComparePasswordUseCase import team.comit.simtong.domain.user.usecase.FindEmployeeNumberUseCase import team.comit.simtong.domain.user.usecase.ResetPasswordUseCase -import team.comit.simtong.domain.user.value.EmployeeNumber -import team.comit.simtong.domain.user.value.Password import java.util.UUID import javax.validation.Valid import javax.validation.constraints.Email @@ -57,7 +57,7 @@ class WebCommonAdapter( @GetMapping("/employee-number") fun findEmployeeNumber(@Valid @ModelAttribute request: FindEmployeeNumberWebRequest): FindEmployeeNumberWebResponse { val result = findEmployeeNumberUseCase.execute( - FindEmployeeNumberRequest( + FindEmployeeNumberData( name = request.name, spotId = request.spotId, email = request.email @@ -76,7 +76,7 @@ class WebCommonAdapter( @ResponseStatus(HttpStatus.NO_CONTENT) fun resetPassword(@Valid @RequestBody request: ResetPasswordWebRequest) { resetPasswordUseCase.execute( - ResetPasswordRequest( + ResetPasswordData( email = request.email, employeeNumber = request.employeeNumber.value, newPassword = request.newPassword.value @@ -93,7 +93,7 @@ class WebCommonAdapter( @ResponseStatus(HttpStatus.NO_CONTENT) fun changePassword(@Valid @RequestBody request: ChangePasswordWebRequest) { changePasswordUseCase.execute( - ChangePasswordRequest( + ChangePasswordData( password = request.password.value, newPassword = request.newPassword.value ) @@ -108,7 +108,7 @@ class WebCommonAdapter( @RequestParam email: String ) { checkMatchedAccountUseCase.execute( - CheckMatchedAccountRequest( + CheckMatchedAccountData( employeeNumber = employeeNumber.value, email = email ) diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ChangePasswordWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ChangePasswordWebRequest.kt index dd2c3f0f..10776489 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ChangePasswordWebRequest.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ChangePasswordWebRequest.kt @@ -1,6 +1,6 @@ package team.comit.simtong.domain.common.dto.request -import team.comit.simtong.domain.user.value.Password +import team.comit.simtong.domain.user.model.Password import javax.validation.constraints.Pattern /** diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ResetPasswordWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ResetPasswordWebRequest.kt index 690b72bb..9379d555 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ResetPasswordWebRequest.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/common/dto/request/ResetPasswordWebRequest.kt @@ -1,8 +1,8 @@ package team.comit.simtong.domain.common.dto.request import org.hibernate.validator.constraints.Range -import team.comit.simtong.domain.user.value.EmployeeNumber -import team.comit.simtong.domain.user.value.Password +import team.comit.simtong.domain.user.model.EmployeeNumber +import team.comit.simtong.domain.user.model.Password import javax.validation.constraints.Email import javax.validation.constraints.NotBlank import javax.validation.constraints.Pattern diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/WebUserAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/WebUserAdapter.kt index e56444b6..79a9f738 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/WebUserAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/WebUserAdapter.kt @@ -16,15 +16,12 @@ import team.comit.simtong.domain.file.usecase.CheckEmployeeUseCase import team.comit.simtong.domain.user.dto.ChangeEmailRequest import team.comit.simtong.domain.user.dto.ChangeNicknameRequest import team.comit.simtong.domain.user.dto.ChangeProfileImageRequest -import team.comit.simtong.domain.user.dto.QueryUserInfoResponse +import team.comit.simtong.domain.user.dto.ChangeSpotRequest import team.comit.simtong.domain.user.dto.SignUpRequest import team.comit.simtong.domain.user.dto.UserSignInRequest -import team.comit.simtong.domain.user.dto.request.ChangeEmailWebRequest -import team.comit.simtong.domain.user.dto.request.ChangeNicknameWebRequest -import team.comit.simtong.domain.user.dto.request.ChangeProfileImageWebRequest -import team.comit.simtong.domain.user.dto.request.ChangeSpotWebRequest -import team.comit.simtong.domain.user.dto.request.SignInWebRequest -import team.comit.simtong.domain.user.dto.request.SignUpWebRequest +import team.comit.simtong.domain.user.dto.response.QueryUserInfoResponse +import team.comit.simtong.domain.user.model.EmployeeNumber +import team.comit.simtong.domain.user.model.NickName import team.comit.simtong.domain.user.usecase.ChangeEmailUseCase import team.comit.simtong.domain.user.usecase.ChangeNicknameUseCase import team.comit.simtong.domain.user.usecase.ChangeProfileImageUseCase @@ -33,8 +30,6 @@ import team.comit.simtong.domain.user.usecase.CheckNicknameDuplicationUseCase import team.comit.simtong.domain.user.usecase.QueryUserInfoUseCase import team.comit.simtong.domain.user.usecase.SignInUseCase import team.comit.simtong.domain.user.usecase.SignUpUseCase -import team.comit.simtong.domain.user.value.EmployeeNumber -import team.comit.simtong.domain.user.value.NickName import javax.validation.Valid import javax.validation.constraints.Pattern @@ -45,7 +40,7 @@ import javax.validation.constraints.Pattern * @author Chokyunghyeon * @author kimbeomjin * @date 2022/09/04 - * @version 1.2.3 + * @version 1.2.5 **/ @Validated @RestController @@ -64,29 +59,13 @@ class WebUserAdapter( @ResponseStatus(HttpStatus.CREATED) @PostMapping - fun signUp(@Valid @RequestBody request: SignUpWebRequest): TokenResponse { - return signUpUseCase.execute( - SignUpRequest( - name = request.name, - email = request.email, - password = request.password.value, - nickname = request.nickname.value, - profileImagePath = request.profileImagePath, - employeeNumber = request.employeeNumber.value, - deviceToken = request.deviceToken - ) - ) + fun signUp(@Valid @RequestBody request: SignUpRequest): TokenResponse { + return signUpUseCase.execute(request.toData()) } @PostMapping("/tokens") - fun signIn(@Valid @RequestBody request: SignInWebRequest): TokenResponse { - return signInUseCase.execute( - UserSignInRequest( - employeeNumber = request.employeeNumber.value, - password = request.password.value, - deviceToken = request.deviceToken - ) - ) + fun signIn(@Valid @RequestBody request: UserSignInRequest): TokenResponse { + return signInUseCase.execute(request.toData()) } @GetMapping("/information") @@ -96,49 +75,43 @@ class WebUserAdapter( @PutMapping("/nickname") @ResponseStatus(HttpStatus.NO_CONTENT) - fun changeNickname(@Valid @RequestBody request: ChangeNicknameWebRequest) { - changeNicknameUseCase.execute( - ChangeNicknameRequest(request.nickname.value) - ) + fun changeNickname(@Valid @RequestBody request: ChangeNicknameRequest) { + changeNicknameUseCase.execute(request.toData()) } @PutMapping("/email") @ResponseStatus(HttpStatus.NO_CONTENT) - fun changeEmail(@Valid @RequestBody request: ChangeEmailWebRequest) { - changeEmailUseCase.execute( - ChangeEmailRequest(request.email) - ) + fun changeEmail(@Valid @RequestBody request: ChangeEmailRequest) { + changeEmailUseCase.execute(request.toData()) } @PutMapping("/profile-image") @ResponseStatus(HttpStatus.NO_CONTENT) - fun changeProfileImage(@Valid @RequestBody request: ChangeProfileImageWebRequest) { - changeProfileImageUseCase.execute( - ChangeProfileImageRequest(request.profileImagePath) - ) + fun changeProfileImage(@Valid @RequestBody request: ChangeProfileImageRequest) { + changeProfileImageUseCase.execute(request.toData()) } @PutMapping("/spot") @ResponseStatus(HttpStatus.NO_CONTENT) - fun changeSpot(@Valid @RequestBody request: ChangeSpotWebRequest) { - changeSpotUseCase.execute(request.spotId) + fun changeSpot(@Valid @RequestBody request: ChangeSpotRequest) { + changeSpotUseCase.execute(request.toData()) } @GetMapping("/nickname/duplication") fun checkNicknameDuplication( @Pattern(regexp = NickName.PATTERN) - @RequestParam nickname: NickName + @RequestParam nickname: String ) { - checkNicknameDuplicationUseCase.execute(nickname.value) + checkNicknameDuplicationUseCase.execute(nickname) } @GetMapping("/verification-employee") fun checkEmployee( @RequestParam name: String, @Range(min = EmployeeNumber.MIN_VALUE, max = EmployeeNumber.MAX_VALUE) - @RequestParam("employee_number") employeeNumber: EmployeeNumber + @RequestParam("employee_number") employeeNumber: Int ) { - checkEmployeeUseCase.execute(name, employeeNumber.value) + checkEmployeeUseCase.execute(name, employeeNumber) } } \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeEmailRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeEmailRequest.kt new file mode 100644 index 00000000..9afc89bb --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeEmailRequest.kt @@ -0,0 +1,24 @@ +package team.comit.simtong.domain.user.dto + +import team.comit.simtong.domain.user.dto.request.ChangeEmailData +import javax.validation.constraints.Email +import javax.validation.constraints.NotBlank + +/** + * + * 이메일 변경을 요청하는 ChangeEmailRequest + * + * @author Chokyunghyeon + * @date 2022/10/03 + * @version 1.0.0 + **/ +data class ChangeEmailRequest( + @field:NotBlank + @field:Email + val email: String +) { + + fun toData() = ChangeEmailData( + email = email + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeNicknameRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeNicknameRequest.kt new file mode 100644 index 00000000..20bdf052 --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeNicknameRequest.kt @@ -0,0 +1,23 @@ +package team.comit.simtong.domain.user.dto + +import team.comit.simtong.domain.user.dto.request.ChangeNicknameData +import team.comit.simtong.domain.user.model.NickName +import javax.validation.constraints.Pattern + +/** + * + * 닉네임 변경을 요청하는 ChangeNicknameRequest + * + * @author Chokyunghyeon + * @date 2022/10/03 + * @version 1.2.3 + **/ +data class ChangeNicknameRequest( + @field:Pattern(regexp = NickName.PATTERN) + val nickname: String +) { + + fun toData() = ChangeNicknameData( + nickname = nickname + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeProfileImageRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeProfileImageRequest.kt new file mode 100644 index 00000000..5543167c --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeProfileImageRequest.kt @@ -0,0 +1,22 @@ +package team.comit.simtong.domain.user.dto + +import team.comit.simtong.domain.user.dto.request.ChangeProfileImageData +import javax.validation.constraints.NotBlank + +/** + * + * 프로필 사진 변경을 요청하는 ChangeProfileImageRequest + * + * @author Chokyunghyeon + * @date 2022/10/03 + * @version 1.0.0 + **/ +data class ChangeProfileImageRequest( + @field:NotBlank + val profileImagePath: String +) { + + fun toData() = ChangeProfileImageData( + profileImagePath = profileImagePath + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeSpotRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeSpotRequest.kt new file mode 100644 index 00000000..8c4f5c68 --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/ChangeSpotRequest.kt @@ -0,0 +1,23 @@ +package team.comit.simtong.domain.user.dto + +import team.comit.simtong.domain.user.dto.request.ChangeSpotData +import java.util.UUID +import javax.validation.constraints.NotNull + +/** + * + * 지점 변경을 요청하는 ChangeSpotRequest + * + * @author kimbeomjin + * @date 2022/10/15 + * @version 1.0.0 + **/ +data class ChangeSpotRequest( + @field:NotNull + val spotId: UUID +) { + + fun toData() = ChangeSpotData( + spotId = spotId + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/SignUpRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/SignUpRequest.kt new file mode 100644 index 00000000..cd02ccc4 --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/SignUpRequest.kt @@ -0,0 +1,56 @@ +package team.comit.simtong.domain.user.dto + +import org.hibernate.validator.constraints.Range +import team.comit.simtong.domain.user.dto.request.SignUpData +import team.comit.simtong.domain.user.model.EmployeeNumber +import team.comit.simtong.domain.user.model.NickName +import team.comit.simtong.domain.user.model.Password +import javax.validation.constraints.Email +import javax.validation.constraints.NotBlank +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern + +/** + * + * 회원 가입을 요청하는 SignUpRequest + * + * @author Chokyunghyeon + * @date 2022/09/04 + * @version 1.2.3 + **/ +data class SignUpRequest( + + @field:NotBlank + val name: String, + + @field:NotBlank + @field:Email + val email: String, + + @field:Range(min = EmployeeNumber.MIN_VALUE, max = EmployeeNumber.MAX_VALUE) + val employeeNumber: Int, + + @field:NotNull + @field:Pattern(regexp = Password.PATTERN) + val password: String, + + @field:NotNull + @field:Pattern(regexp = NickName.PATTERN) + val nickname: String, + + val profileImagePath: String?, + + @field:NotBlank + val deviceToken: String +) { + + fun toData() = SignUpData( + name = name, + email = email, + employeeNumber = employeeNumber, + password = password, + nickname = nickname, + profileImagePath = profileImagePath, + deviceToken = deviceToken + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/UserSignInRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/UserSignInRequest.kt new file mode 100644 index 00000000..f94952e3 --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/UserSignInRequest.kt @@ -0,0 +1,33 @@ +package team.comit.simtong.domain.user.dto + +import team.comit.simtong.domain.user.dto.request.UserSignInData +import javax.validation.constraints.NotBlank +import javax.validation.constraints.NotNull + +/** + * + * 일반 사용자가 로그인을 요청하는 UserSignInRequest + * + * @author kimbeomjin + * @author Chokyunghyeon + * @date 2022/09/08 + * @version 1.2.5 + **/ +data class UserSignInRequest( + + @field:NotNull + val employeeNumber: Int, + + @field:NotBlank + val password: String, + + @field:NotBlank + val deviceToken: String +) { + + fun toData() = UserSignInData( + employeeNumber = employeeNumber, + password = password, + deviceToken = deviceToken + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeEmailWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeEmailWebRequest.kt deleted file mode 100644 index bd080dbb..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeEmailWebRequest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package team.comit.simtong.domain.user.dto.request - -import javax.validation.constraints.Email -import javax.validation.constraints.NotBlank - -/** - * - * 이메일 변경을 요청하는 ChangeEmailWebRequest - * - * @author Chokyunghyeon - * @date 2022/10/03 - * @version 1.0.0 - **/ -data class ChangeEmailWebRequest( - @field:NotBlank - @field:Email - val email: String -) \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeNicknameWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeNicknameWebRequest.kt deleted file mode 100644 index 72097bbd..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeNicknameWebRequest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package team.comit.simtong.domain.user.dto.request - -import team.comit.simtong.domain.user.value.NickName -import javax.validation.constraints.Pattern - -/** - * - * 닉네임 변경을 요청하는 ChangeNicknameWebRequest - * - * @author Chokyunghyeon - * @date 2022/10/03 - * @version 1.2.3 - **/ -data class ChangeNicknameWebRequest( - @Pattern(regexp = NickName.PATTERN) - val nickname: NickName -) \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeProfileImageWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeProfileImageWebRequest.kt deleted file mode 100644 index 687d37d8..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeProfileImageWebRequest.kt +++ /dev/null @@ -1,16 +0,0 @@ -package team.comit.simtong.domain.user.dto.request - -import javax.validation.constraints.NotBlank - -/** - * - * 프로필 사진 변경을 요청하는 ChangeProfileImageWebRequest - * - * @author Chokyunghyeon - * @date 2022/10/03 - * @version 1.0.0 - **/ -data class ChangeProfileImageWebRequest( - @field:NotBlank - val profileImagePath: String -) \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeSpotWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeSpotWebRequest.kt deleted file mode 100644 index ec8bd142..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/ChangeSpotWebRequest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package team.comit.simtong.domain.user.dto.request - -import java.util.UUID -import javax.validation.constraints.NotNull - -/** - * - * 지점 변경을 요청하는 ChangeSpotWebRequest - * - * @author kimbeomjin - * @date 2022/10/15 - * @version 1.0.0 - **/ -data class ChangeSpotWebRequest( - @field:NotNull - val spotId: UUID -) diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignInWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignInWebRequest.kt deleted file mode 100644 index 99938463..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignInWebRequest.kt +++ /dev/null @@ -1,27 +0,0 @@ -package team.comit.simtong.domain.user.dto.request - -import team.comit.simtong.domain.user.value.EmployeeNumber -import team.comit.simtong.domain.user.value.Password -import javax.validation.constraints.NotBlank -import javax.validation.constraints.NotNull - -/** - * - * 일반 사용자가 로그인을 요청하는 SignInWebRequest - * - * @author kimbeomjin - * @author Chokyunghyeon - * @date 2022/09/08 - * @version 1.2.3 - **/ -data class SignInWebRequest( - - @field:NotNull - val employeeNumber: EmployeeNumber, - - @field:NotBlank - val password: Password, - - @field:NotBlank - val deviceToken: String -) \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignUpWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignUpWebRequest.kt deleted file mode 100644 index 74cd8990..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/request/SignUpWebRequest.kt +++ /dev/null @@ -1,41 +0,0 @@ -package team.comit.simtong.domain.user.dto.request - -import org.hibernate.validator.constraints.Range -import team.comit.simtong.domain.user.value.EmployeeNumber -import team.comit.simtong.domain.user.value.NickName -import team.comit.simtong.domain.user.value.Password -import javax.validation.constraints.Email -import javax.validation.constraints.NotBlank -import javax.validation.constraints.Pattern - -/** - * - * 회원 가입을 요청하는 SignUpWebRequest - * - * @author Chokyunghyeon - * @date 2022/09/04 - * @version 1.2.3 - **/ -data class SignUpWebRequest( - - @field:NotBlank - val name: String, - - @field:NotBlank - @field:Email - val email: String, - - @Range(min = EmployeeNumber.MIN_VALUE, max = EmployeeNumber.MAX_VALUE) - val employeeNumber: EmployeeNumber, - - @Pattern(regexp = Password.PATTERN) - val password: Password, - - @Pattern(regexp = NickName.PATTERN) - val nickname: NickName, - - val profileImagePath: String?, - - @field:NotBlank - val deviceToken: String -) diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/response/.gitkeep b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/dto/response/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/EmployeeNumber.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/EmployeeNumber.kt deleted file mode 100644 index ed2d5e60..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/EmployeeNumber.kt +++ /dev/null @@ -1,19 +0,0 @@ -package team.comit.simtong.domain.user.value - -/** - * - * 사원번호를 의미하는 EmployeeNumber - * - * @author Chokyunghyeon - * @date 2023/01/04 - * @version 1.2.3 - **/ -@JvmInline -value class EmployeeNumber( - val value: Int -) { - companion object { - const val MIN_VALUE: Long = 1200000000 - const val MAX_VALUE: Long = 1299999999 - } -} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/NickName.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/NickName.kt deleted file mode 100644 index 8b4b2ebc..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/NickName.kt +++ /dev/null @@ -1,26 +0,0 @@ -package team.comit.simtong.domain.user.value - -/** - * - * 닉네임을 의미하는 NickName - * - * @author Chokyunghyeon - * @date 2023/01/04 - * @version 1.2.3 - **/ -@JvmInline -value class NickName( - val value: String -) { - companion object { - const val MIN_LENGTH = 1 - const val MAX_LENGTH = 20 - - /** - * first word & Last word - space X - * - * space , _ , . , a ~ z , A ~ Z , 가 ~ 힣 , 0 ~ 9 - */ - const val PATTERN = """(?=^\S)(?=^[\w\s가-힣.]{$MIN_LENGTH,$MAX_LENGTH}$).*(?=\S$).""" - } -} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/Password.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/Password.kt deleted file mode 100644 index 5705ea16..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/user/value/Password.kt +++ /dev/null @@ -1,26 +0,0 @@ -package team.comit.simtong.domain.user.value - -/** - * - * 비밀번호를 의미하는 Password - * - * @author Chokyunghyeon - * @date 2023/01/04 - * @version 1.2.3 - **/ -@JvmInline -value class Password( - val value: String -) { - companion object { - const val MIN_LENGTH = 8 - const val MAX_LENGTH = 20 - - /** - * a ~ z or A ~ Z & 0 ~ 9 - must more than once - * - * non-space, $ , + , - , _ , a ~ z , A ~ Z , 0 ~ 9 - */ - const val PATTERN = """(?=.*[a-zA-Z])(?=.*\d)(?=^[\w$+-]{$MIN_LENGTH,$MAX_LENGTH$).*""" - } -} \ No newline at end of file