From 23031cf99b52384cfd97381b1af1a7c6585d5175 Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:25:59 +0900 Subject: [PATCH 1/8] =?UTF-8?q?add:=20(#281)=20Data=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/dto/request/CheckAuthCodeData.kt | 15 +++++++++++++++ .../domain/auth/dto/request/SendAuthCodeData.kt | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/CheckAuthCodeData.kt create mode 100644 simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/SendAuthCodeData.kt diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/CheckAuthCodeData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/CheckAuthCodeData.kt new file mode 100644 index 00000000..d97a58d6 --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/CheckAuthCodeData.kt @@ -0,0 +1,15 @@ +package team.comit.simtong.domain.auth.dto.request + +/** + * + * 인증 코드 확인 요청 정보를 전달하는 CheckAuthCodeData + * + * @author Chokyunghyeon + * @date 2023/01/14 + * @version 1.2.5 + **/ +data class CheckAuthCodeData( + val email: String, + + val code: String +) \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/SendAuthCodeData.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/SendAuthCodeData.kt new file mode 100644 index 00000000..c6e46130 --- /dev/null +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/dto/request/SendAuthCodeData.kt @@ -0,0 +1,13 @@ +package team.comit.simtong.domain.auth.dto.request + +/** + * + * 인증 코드 전송 요청 정보를 전달하는 SendAuthCodeData + * + * @author Chokyunghyeon + * @date 2023/01/14 + * @version 1.2.5 + **/ +data class SendAuthCodeData( + val email: String +) \ No newline at end of file From f10836799f44b16908c7e48617f0de489742bfce Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:26:28 +0900 Subject: [PATCH 2/8] =?UTF-8?q?refactor:=20(#281)=20Data=20=EC=9D=B8?= =?UTF-8?q?=EC=9E=90=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/usecase/CheckAuthCodeUseCase.kt | 9 +++++---- .../domain/auth/usecase/SendAuthCodeUseCase.kt | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCase.kt index af53bf70..5f9d543a 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCase.kt @@ -1,5 +1,6 @@ package team.comit.simtong.domain.auth.usecase +import team.comit.simtong.domain.auth.dto.request.CheckAuthCodeData import team.comit.simtong.domain.auth.exception.AuthExceptions import team.comit.simtong.domain.auth.model.AuthCodeLimit import team.comit.simtong.domain.auth.spi.CommandAuthCodeLimitPort @@ -21,16 +22,16 @@ class CheckAuthCodeUseCase( private val queryAuthCodePort: QueryAuthCodePort ) { - fun execute(email: String, code: String) { - val authCode = queryAuthCodePort.queryAuthCodeByEmail(email) + fun execute(request: CheckAuthCodeData) { + val authCode = queryAuthCodePort.queryAuthCodeByEmail(request.email) ?: throw AuthExceptions.RequiredNewEmailAuthentication() - if (!authCode.code.match(code)) { + if (!authCode.code.match(request.code)) { throw AuthExceptions.DifferentAuthCode() } commandAuthCodeLimitPort.save( - AuthCodeLimit.certified(email) + AuthCodeLimit.certified(request.email) ) } } \ No newline at end of file diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCase.kt index 8820da58..d83b5dd1 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCase.kt @@ -1,5 +1,6 @@ package team.comit.simtong.domain.auth.usecase +import team.comit.simtong.domain.auth.dto.request.SendAuthCodeData import team.comit.simtong.domain.auth.model.AuthCode import team.comit.simtong.domain.auth.model.AuthCodeLimit import team.comit.simtong.domain.auth.spi.CommandAuthCodeLimitPort @@ -24,18 +25,18 @@ class SendAuthCodeUseCase( private val sendEmailPort: SendEmailPort ) { - fun execute(email: String) { - val authCodeLimit = queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(email) - ?: AuthCodeLimit.issue(email) + fun execute(request: SendAuthCodeData) { + val authCodeLimit = queryAuthCodeLimitPort.queryAuthCodeLimitByEmail(request.email) + ?: AuthCodeLimit.issue(request.email) commandAuthCodeLimitPort.save( authCodeLimit.increaseCount() ) val authCode = commandAuthCodePort.save( - AuthCode.issue(email) + AuthCode.issue(request.email) ) - sendEmailPort.sendAuthCode(authCode.code.value, email) + sendEmailPort.sendAuthCode(authCode.code.value, request.email) } } \ No newline at end of file From ba4b9e01639efe7c2ec2ca9780bdf3a8c7d9cf59 Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:27:57 +0900 Subject: [PATCH 3/8] =?UTF-8?q?refactor:=20(#281)=20WebRequest=20=E2=86=92?= =?UTF-8?q?=20Request=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/admin/dto/AdminSignInRequest.kt | 30 +++++++++++++++++++ .../admin/dto/request/SignInWebRequest.kt | 24 --------------- ...eWebRequest.kt => CheckAuthCodeRequest.kt} | 17 +++++++---- .../domain/email/dto/SendAuthCodeRequest.kt | 24 +++++++++++++++ .../dto/request/SendAuthCodeWebRequest.kt | 18 ----------- 5 files changed, 66 insertions(+), 47 deletions(-) create mode 100644 simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/AdminSignInRequest.kt delete mode 100644 simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/request/SignInWebRequest.kt rename simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/{request/CheckAuthCodeWebRequest.kt => CheckAuthCodeRequest.kt} (50%) create mode 100644 simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/SendAuthCodeRequest.kt delete mode 100644 simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/request/SendAuthCodeWebRequest.kt diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/AdminSignInRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/AdminSignInRequest.kt new file mode 100644 index 00000000..1f9d59fc --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/AdminSignInRequest.kt @@ -0,0 +1,30 @@ +package team.comit.simtong.domain.admin.dto + +import org.hibernate.validator.constraints.Range +import team.comit.simtong.domain.user.dto.request.AdminSignInData +import team.comit.simtong.domain.user.model.EmployeeNumber +import javax.validation.constraints.NotBlank + +/** + * + * 관리자가 로그인을 요청하는 AdminSignInRequest + * + * @author kimbeomjin + * @author Chokyunghyeon + * @date 2023/01/01 + * @version 1.2.5 + **/ +data class AdminSignInRequest( + + @field:Range(min = EmployeeNumber.MIN_VALUE, max = EmployeeNumber.MAX_VALUE) + val employeeNumber: Int, + + @field:NotBlank + val password: String +) { + + fun toData() = AdminSignInData( + employeeNumber = employeeNumber, + password = password + ) +} \ No newline at end of file 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 deleted file mode 100644 index e5a0a699..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/request/SignInWebRequest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package team.comit.simtong.domain.admin.dto.request - -import org.hibernate.validator.constraints.Range -import team.comit.simtong.domain.user.model.EmployeeNumber -import team.comit.simtong.domain.user.model.Password -import javax.validation.constraints.NotBlank - -/** - * - * 관리자가 로그인을 요청하는 SignInWebRequest - * - * @author kimbeomjin - * @author Chokyunghyeon - * @date 2023/01/01 - * @version 1.2.3 - **/ -data class SignInWebRequest( - - @Range(min = EmployeeNumber.MIN_VALUE, max = EmployeeNumber.MAX_VALUE) - val employeeNumber: EmployeeNumber, - - @field:NotBlank - val password: Password -) \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/request/CheckAuthCodeWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/CheckAuthCodeRequest.kt similarity index 50% rename from simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/request/CheckAuthCodeWebRequest.kt rename to simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/CheckAuthCodeRequest.kt index af02f173..697efc71 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/request/CheckAuthCodeWebRequest.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/CheckAuthCodeRequest.kt @@ -1,18 +1,19 @@ -package team.comit.simtong.domain.email.dto.request +package team.comit.simtong.domain.email.dto import org.hibernate.validator.constraints.Length +import team.comit.simtong.domain.auth.dto.request.CheckAuthCodeData import javax.validation.constraints.Email import javax.validation.constraints.NotBlank /** * - * 이메일 인증 코드 확인을 요청하는 CheckAuthCodeWebRequest + * 이메일 인증 코드 확인을 요청하는 CheckAuthCodeRequest * * @author Chokyunghyeon * @date 2022/09/24 - * @version 1.0.0 + * @version 1.2.5 **/ -data class CheckAuthCodeWebRequest( +data class CheckAuthCodeRequest( @field:NotBlank @field:Email val email: String, @@ -20,4 +21,10 @@ data class CheckAuthCodeWebRequest( @field:NotBlank @field:Length(min = 6, max = 6) val code: String -) \ No newline at end of file +) { + + fun toData() = CheckAuthCodeData( + email = email, + code = code + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/SendAuthCodeRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/SendAuthCodeRequest.kt new file mode 100644 index 00000000..34a6266e --- /dev/null +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/SendAuthCodeRequest.kt @@ -0,0 +1,24 @@ +package team.comit.simtong.domain.email.dto + +import team.comit.simtong.domain.auth.dto.request.SendAuthCodeData +import javax.validation.constraints.Email +import javax.validation.constraints.NotBlank + +/** + * + * 이메일 인증 코드 전송을 요청하는 SendEmailRequest + * + * @author Chokyunghyeon + * @date 2022/09/24 + * @version 1.2.5 + **/ +data class SendAuthCodeRequest( + @field:NotBlank + @field:Email + val email: String +) { + + fun toData() = SendAuthCodeData( + email = email + ) +} \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/request/SendAuthCodeWebRequest.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/request/SendAuthCodeWebRequest.kt deleted file mode 100644 index 64c4feb0..00000000 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/request/SendAuthCodeWebRequest.kt +++ /dev/null @@ -1,18 +0,0 @@ -package team.comit.simtong.domain.email.dto.request - -import javax.validation.constraints.Email -import javax.validation.constraints.NotBlank - -/** - * - * 이메일 인증 코드 전송을 요청하는 SendEmailWebRequest - * - * @author Chokyunghyeon - * @date 2022/09/24 - * @version 1.0.0 - **/ -data class SendAuthCodeWebRequest( - @field:NotBlank - @field:Email - val email: String -) \ No newline at end of file From b053e142a632d01c78509f877daafef3cdbab7a4 Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:28:21 +0900 Subject: [PATCH 4/8] =?UTF-8?q?refactor:=20(#281)=20response=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/file/dto/response/UploadImageListResponse.kt | 6 +++--- .../simtong/domain/file/dto/response/UploadImageResponse.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListWebResponse.kt => simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListResponse.kt (72%) rename simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageWebResponse.kt => simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageResponse.kt (73%) diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListWebResponse.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListResponse.kt similarity index 72% rename from simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListWebResponse.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListResponse.kt index 052038b6..39ded664 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListWebResponse.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageListResponse.kt @@ -2,12 +2,12 @@ package team.comit.simtong.domain.file.dto.response /** * - * 다중 이미지 업로드 요청 결과를 전송하는 UploadImageListWebResponse + * 다중 이미지 업로드 요청 결과를 전송하는 UploadImageListResponse * * @author Chokyunghyeon * @date 2022/09/21 - * @version 1.0.0 + * @version 1.2.5 **/ -data class UploadImageListWebResponse( +data class UploadImageListResponse( val filePathList: List ) \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageWebResponse.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageResponse.kt similarity index 73% rename from simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageWebResponse.kt rename to simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageResponse.kt index 61a52df9..23765621 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageWebResponse.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/dto/response/UploadImageResponse.kt @@ -2,12 +2,12 @@ package team.comit.simtong.domain.file.dto.response /** * - * 단일 이미지 업로드 요청 결과를 전송하는 UploadImageWebResponse + * 단일 이미지 업로드 요청 결과를 전송하는 UploadImageResponse * * @author Chokyunghyeon * @date 2022/09/21 - * @version 1.0.0 + * @version 1.2.5 **/ -data class UploadImageWebResponse( +data class UploadImageResponse( val filePath: String ) \ No newline at end of file From d85d5aafab185cf6c81de7b412ac2140122f257d Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:32:27 +0900 Subject: [PATCH 5/8] =?UTF-8?q?refactor:=20(#281)=20application=20response?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/file/usecase/UploadImageUseCase.kt | 10 ++++++--- .../simtong/domain/file/WebFileAdapter.kt | 22 ++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt index c4ec9e7d..d1880d91 100644 --- a/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt +++ b/simtong-application/src/main/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCase.kt @@ -1,5 +1,7 @@ package team.comit.simtong.domain.file.usecase +import team.comit.simtong.domain.file.dto.response.UploadImageListResponse +import team.comit.simtong.domain.file.dto.response.UploadImageResponse import team.comit.simtong.domain.file.spi.UploadFilePort import team.comit.simtong.global.annotation.UseCase import java.io.File @@ -10,18 +12,20 @@ import java.io.File * * @author Chokyunghyeon * @date 2022/09/20 - * @version 1.0.0 + * @version 1.2.5 **/ @UseCase class UploadImageUseCase( private val uploadFilePort: UploadFilePort ) { - fun execute(file: File): String { + fun execute(file: File): UploadImageResponse { return uploadFilePort.upload(file) + .let(::UploadImageResponse) } - fun execute(files: List): List { + fun execute(files: List): UploadImageListResponse { return uploadFilePort.upload(files) + .let(::UploadImageListResponse) } } \ No newline at end of file diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt index c7871f60..69708db5 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/WebFileAdapter.kt @@ -6,10 +6,10 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestController import org.springframework.web.multipart.MultipartFile -import team.comit.simtong.domain.file.dto.response.UploadImageListWebResponse -import team.comit.simtong.domain.file.dto.response.UploadImageWebResponse import team.comit.simtong.domain.file.converter.ExcelFileConverter import team.comit.simtong.domain.file.converter.ImageFileConverter +import team.comit.simtong.domain.file.dto.response.UploadImageListResponse +import team.comit.simtong.domain.file.dto.response.UploadImageResponse import team.comit.simtong.domain.file.usecase.RegisterEmployeeCertificateUseCase import team.comit.simtong.domain.file.usecase.UploadImageUseCase @@ -19,7 +19,7 @@ import team.comit.simtong.domain.file.usecase.UploadImageUseCase * * @author Chokyunghyeon * @date 2022/09/21 - * @version 1.0.0 + * @version 1.2.5 **/ @RestController @RequestMapping("/files") @@ -30,21 +30,17 @@ class WebFileAdapter( @PostMapping @ResponseStatus(HttpStatus.CREATED) - fun uploadSingleImage(file: MultipartFile): UploadImageWebResponse { - return UploadImageWebResponse( - uploadImageUseCase.execute( - file.let(ImageFileConverter::transferTo) - ) + fun uploadSingleImage(file: MultipartFile): UploadImageResponse { + return uploadImageUseCase.execute( + file.let(ImageFileConverter::transferTo) ) } @PostMapping("/list") @ResponseStatus(HttpStatus.CREATED) - fun uploadMultipleImage(files: List): UploadImageListWebResponse { - return UploadImageListWebResponse( - uploadImageUseCase.execute( - files.let(ImageFileConverter::transferToList) - ) + fun uploadMultipleImage(files: List): UploadImageListResponse { + return uploadImageUseCase.execute( + files.let(ImageFileConverter::transferToList) ) } From 0008ab7cfce8988c1cfb967f5babc5bd28cfc889 Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:32:42 +0900 Subject: [PATCH 6/8] =?UTF-8?q?refactor:=20(#281)=20toData=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../comit/simtong/domain/admin/WebAdminAdapter.kt | 12 +++--------- .../comit/simtong/domain/email/WebEmailAdapter.kt | 12 ++++++------ 2 files changed, 9 insertions(+), 15 deletions(-) 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 f05bd2b6..7227a40c 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 @@ -5,9 +5,8 @@ import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody 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.admin.dto.AdminSignInRequest import team.comit.simtong.domain.auth.dto.TokenResponse -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 @@ -29,13 +28,8 @@ class WebAdminAdapter( ) { @PostMapping("/tokens") - fun signIn(@Valid @RequestBody request: SignInWebRequest): TokenResponse { - return adminSignInUseCase.execute( - AdminSignInData( - employeeNumber = request.employeeNumber.value, - password = request.password.value - ) - ) + fun signIn(@Valid @RequestBody request: AdminSignInRequest): TokenResponse { + return adminSignInUseCase.execute(request.toData()) } @GetMapping("/information") diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/WebEmailAdapter.kt b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/WebEmailAdapter.kt index 39b86b34..a41a0230 100644 --- a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/WebEmailAdapter.kt +++ b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/WebEmailAdapter.kt @@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController import team.comit.simtong.domain.auth.usecase.CheckAuthCodeUseCase import team.comit.simtong.domain.auth.usecase.SendAuthCodeUseCase -import team.comit.simtong.domain.email.dto.request.CheckAuthCodeWebRequest -import team.comit.simtong.domain.email.dto.request.SendAuthCodeWebRequest +import team.comit.simtong.domain.email.dto.CheckAuthCodeRequest +import team.comit.simtong.domain.email.dto.SendAuthCodeRequest import javax.validation.Valid /** @@ -27,13 +27,13 @@ class WebEmailAdapter( ) { @PostMapping("/code") - fun sendAuthCode(@Valid @RequestBody request: SendAuthCodeWebRequest) { - sendAuthCodeUseCase.execute(request.email) + fun sendAuthCode(@Valid @RequestBody request: SendAuthCodeRequest) { + sendAuthCodeUseCase.execute(request.toData()) } @GetMapping - fun checkAuthCode(@Valid request: CheckAuthCodeWebRequest) { - checkAuthCodeUseCase.execute(request.email, request.code) + fun checkAuthCode(@Valid request: CheckAuthCodeRequest) { + checkAuthCodeUseCase.execute(request.toData()) } } \ No newline at end of file From 4c0bafa2bb42ab0ae98951bdfc973eb88b89a872 Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:32:58 +0900 Subject: [PATCH 7/8] revert: (#281) gitkeep --- .../kotlin/team/comit/simtong/domain/admin/dto/response/.gitkeep | 0 .../kotlin/team/comit/simtong/domain/email/dto/response/.gitkeep | 0 .../kotlin/team/comit/simtong/domain/file/dto/request/.gitkeep | 0 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/response/.gitkeep delete mode 100644 simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/response/.gitkeep delete mode 100644 simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/request/.gitkeep diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/response/.gitkeep b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/admin/dto/response/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/response/.gitkeep b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/email/dto/response/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/request/.gitkeep b/simtong-presentation/src/main/kotlin/team/comit/simtong/domain/file/dto/request/.gitkeep deleted file mode 100644 index e69de29b..00000000 From cb875890795ae4c58c3c7fb8381358ceb56e019b Mon Sep 17 00:00:00 2001 From: Jo Kyung Hyeon Date: Sat, 14 Jan 2023 23:33:12 +0900 Subject: [PATCH 8/8] =?UTF-8?q?test:=20(#281)=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20Test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/usecase/CheckAuthCodeUseCaseTests.kt | 11 +++++++---- .../domain/auth/usecase/SendAuthCodeUseCaseTests.kt | 9 ++++++--- .../domain/file/usecase/UploadImageUseCaseTests.kt | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCaseTests.kt index 5d16429f..e8215114 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/CheckAuthCodeUseCaseTests.kt @@ -6,6 +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.auth.dto.request.CheckAuthCodeData import team.comit.simtong.domain.auth.exception.AuthExceptions import team.comit.simtong.domain.auth.model.AuthCode import team.comit.simtong.domain.auth.model.Code @@ -36,7 +37,7 @@ class CheckAuthCodeUseCaseTests { ) } - private val differentAuthCodeStub by lazy { + private val differentAuthCodeStub: AuthCode by lazy { AuthCode( key = email, code = Code.of("654321"), @@ -44,6 +45,8 @@ class CheckAuthCodeUseCaseTests { ) } + private val requestStub = CheckAuthCodeData(email, code) + @BeforeEach fun setUp() { checkAuthCodeUseCase = CheckAuthCodeUseCase( @@ -60,7 +63,7 @@ class CheckAuthCodeUseCaseTests { // when & then assertDoesNotThrow { - checkAuthCodeUseCase.execute(email, code) + checkAuthCodeUseCase.execute(requestStub) } } @@ -72,7 +75,7 @@ class CheckAuthCodeUseCaseTests { // when & then assertThrows { - checkAuthCodeUseCase.execute(email, code) + checkAuthCodeUseCase.execute(requestStub) } } @@ -84,7 +87,7 @@ class CheckAuthCodeUseCaseTests { // when & then assertThrows { - checkAuthCodeUseCase.execute(email, code) + checkAuthCodeUseCase.execute(requestStub) } } diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCaseTests.kt index 627a33ee..d1cbf967 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/auth/usecase/SendAuthCodeUseCaseTests.kt @@ -8,6 +8,7 @@ import org.mockito.BDDMockito.given import org.mockito.BDDMockito.willDoNothing import org.mockito.kotlin.any import org.springframework.boot.test.mock.mockito.MockBean +import team.comit.simtong.domain.auth.dto.request.SendAuthCodeData import team.comit.simtong.domain.auth.exception.AuthExceptions import team.comit.simtong.domain.auth.model.AuthCode import team.comit.simtong.domain.auth.model.AuthCodeLimit @@ -65,6 +66,8 @@ class SendAuthCodeUseCaseTests { ) } + private val requestStub = SendAuthCodeData(email) + @BeforeEach fun setUp() { sendAuthCodeUseCase = SendAuthCodeUseCase( @@ -88,7 +91,7 @@ class SendAuthCodeUseCaseTests { // when & then assertDoesNotThrow { - sendAuthCodeUseCase.execute(email) + sendAuthCodeUseCase.execute(requestStub) } } @@ -100,7 +103,7 @@ class SendAuthCodeUseCaseTests { // when & then assertThrows { - sendAuthCodeUseCase.execute(email) + sendAuthCodeUseCase.execute(requestStub) } } @@ -112,7 +115,7 @@ class SendAuthCodeUseCaseTests { // when & then assertThrows { - sendAuthCodeUseCase.execute(email) + sendAuthCodeUseCase.execute(requestStub) } } diff --git a/simtong-application/src/test/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCaseTests.kt b/simtong-application/src/test/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCaseTests.kt index 1642d217..35bb5fe9 100644 --- a/simtong-application/src/test/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCaseTests.kt +++ b/simtong-application/src/test/kotlin/team/comit/simtong/domain/file/usecase/UploadImageUseCaseTests.kt @@ -42,7 +42,7 @@ class UploadImageUseCaseTests { val response = uploadImageUseCase.execute(fileStub) // then - assertEquals(response, filePathStub) + assertEquals(response.filePath, filePathStub) } @@ -57,7 +57,7 @@ class UploadImageUseCaseTests { // when val response = uploadImageUseCase.execute(filesStub) - assertEquals(response, filePathListStub) + assertEquals(response.filePathList, filePathListStub) } } \ No newline at end of file