From 753d704b83024fa84fe829c68690cad4afc95f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=89=ED=93=A8?= Date: Thu, 22 Jun 2023 14:13:50 +0900 Subject: [PATCH] =?UTF-8?q?[Chore]=20#268=20Master=20DTO=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EC=BB=A8=EB=B2=A4=EC=85=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/master/api/MasterController.java | 14 +++--- .../master/dto/post/PostMasterLogInReq.java | 38 ---------------- .../master/dto/post/PostMasterLogInRes.java | 43 ------------------- .../MasterCreateInDTO.java} | 4 +- .../MasterUpdateInDTO.java} | 4 +- .../MasterCreateOutDTO.java} | 8 ++-- .../MasterListOutDTO.java} | 8 ++-- .../MasterUptateOutDTO.java} | 5 +-- .../domain/master/service/MasterService.java | 24 +++++------ 9 files changed, 33 insertions(+), 115 deletions(-) delete mode 100644 src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInReq.java delete mode 100644 src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInRes.java rename src/main/java/shop/cazait/domain/master/dto/{post/PostMasterReq.java => request/MasterCreateInDTO.java} (95%) rename src/main/java/shop/cazait/domain/master/dto/{patch/PatchMasterReq.java => request/MasterUpdateInDTO.java} (93%) rename src/main/java/shop/cazait/domain/master/dto/{post/PostMasterRes.java => response/MasterCreateOutDTO.java} (78%) rename src/main/java/shop/cazait/domain/master/dto/{get/GetMasterRes.java => response/MasterListOutDTO.java} (78%) rename src/main/java/shop/cazait/domain/master/dto/{patch/PatchMasterRes.java => response/MasterUptateOutDTO.java} (82%) diff --git a/src/main/java/shop/cazait/domain/master/api/MasterController.java b/src/main/java/shop/cazait/domain/master/api/MasterController.java index 26dc67b2..1b3a475e 100644 --- a/src/main/java/shop/cazait/domain/master/api/MasterController.java +++ b/src/main/java/shop/cazait/domain/master/api/MasterController.java @@ -26,9 +26,9 @@ import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import shop.cazait.domain.master.dto.patch.PatchMasterReq; -import shop.cazait.domain.master.dto.post.PostMasterReq; -import shop.cazait.domain.master.dto.post.PostMasterRes; +import shop.cazait.domain.master.dto.request.MasterCreateInDTO; +import shop.cazait.domain.master.dto.request.MasterUpdateInDTO; +import shop.cazait.domain.master.dto.response.MasterCreateOutDTO; import shop.cazait.domain.master.error.MasterException; import shop.cazait.domain.master.service.MasterService; import shop.cazait.domain.user.exception.UserException; @@ -49,7 +49,7 @@ public class MasterController { @NoAuth @PostMapping("/sign-up") @Operation(summary = "마스터 회원가입", description = "마스터 사용자의 정보들을 이용해서 회원가입을 진행한다.") - public SuccessResponse registerMaster(@Validated @RequestBody PostMasterReq dto) throws + public SuccessResponse registerMaster(@Validated @RequestBody MasterCreateInDTO dto) throws MasterException, InvalidAlgorithmParameterException, NoSuchPaddingException, @@ -57,7 +57,7 @@ public SuccessResponse registerMaster(@Validated @RequestBody Pos NoSuchAlgorithmException, BadPaddingException, InvalidKeyException { - PostMasterRes postCreateMasterRes = masterService.registerMaster(dto); + MasterCreateOutDTO postCreateMasterRes = masterService.registerMaster(dto); return new SuccessResponse<>(CREATE_MASTER, postCreateMasterRes); } @@ -69,10 +69,10 @@ public SuccessResponse registerMaster(@Validated @RequestBody Pos ) public SuccessResponse updateMaster( @PathVariable(name = "masterId") Long masterId, - @RequestBody @Valid PatchMasterReq patchMasterReq, + @RequestBody @Valid MasterUpdateInDTO masterUpdateInDTO, @RequestHeader(value = "REFRESH-TOKEN") String refreshToken) throws UserException { jwtService.isValidAccessTokenId(masterId); - masterService.updateMaster(masterId, patchMasterReq); + masterService.updateMaster(masterId, masterUpdateInDTO); return new SuccessResponse<>(SUCCESS, "마스터 정보 수정 완료"); } diff --git a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInReq.java b/src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInReq.java deleted file mode 100644 index 4cfacd07..00000000 --- a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInReq.java +++ /dev/null @@ -1,38 +0,0 @@ -//package shop.cazait.domain.master.dto.post; -// -//import javax.validation.constraints.NotBlank; -// -//import io.swagger.v3.oas.annotations.media.Schema; -//import lombok.AccessLevel; -//import lombok.Builder; -//import lombok.Getter; -//import lombok.NoArgsConstructor; -//import shop.cazait.domain.master.entity.Master; -// -//@Schema(description = "마스터 로그인 Request : 로그인할 마스터 계정 정보") -//@Getter -//@NoArgsConstructor(access = AccessLevel.PROTECTED) -//public class PostMasterLogInReq { -// -// @Schema(description = "이메일", example = "master@gmail.com") -// @NotBlank(message = "Master 이메일을 입력해주세요.") -// private String email; -// -// @Schema(description = "비밀번호", example = "abcde!12345") -// @NotBlank(message = "Master 비밀번호를 입력해주세요.") -// private String password; -// -// @Builder -// public PostMasterLogInReq(String email, String password) { -// this.email = email; -// this.password = password; -// } -// -// public Master toEntity() { -// return Master.builder() -// .email(email) -// .password(password) -// .build(); -// } -// -//} diff --git a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInRes.java b/src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInRes.java deleted file mode 100644 index 9b756a61..00000000 --- a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterLogInRes.java +++ /dev/null @@ -1,43 +0,0 @@ -//package shop.cazait.domain.master.dto.post; -// -//import io.swagger.v3.oas.annotations.media.Schema; -//import lombok.AccessLevel; -//import lombok.Builder; -//import lombok.Getter; -//import shop.cazait.domain.master.entity.Master; -// -//@Schema(description = "마스터 로그인 Response : 로그인한 마스터 계정 정보") -//@Getter -//@Builder(access = AccessLevel.PRIVATE) -//public class PostMasterLogInRes { -// -// @Schema(description = "회원 id", example = "1") -// private Long id; -// -// @Schema(description = "이메일", example = "12345@gmail.com") -// private String email; -// -// @Schema(description = "jwt token") -// private String jwtToken; -// -// @Schema(description = "refresh token") -// private String refreshToken; -// -// @Builder -// public PostMasterLogInRes(Long id, String email, String jwtToken, String refreshToken) { -// this.id = id; -// this.email = email; -// this.jwtToken = jwtToken; -// this.refreshToken = refreshToken; -// } -// -// public static PostMasterLogInRes of(Master master, String jwtToken, String refreshToken) { -// return PostMasterLogInRes.builder() -// .id(master.getId()) -// .email(master.getEmail()) -// .jwtToken(jwtToken) -// .refreshToken(refreshToken) -// .build(); -// } -// -//} diff --git a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterReq.java b/src/main/java/shop/cazait/domain/master/dto/request/MasterCreateInDTO.java similarity index 95% rename from src/main/java/shop/cazait/domain/master/dto/post/PostMasterReq.java rename to src/main/java/shop/cazait/domain/master/dto/request/MasterCreateInDTO.java index 0cddd36f..2376c15f 100644 --- a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterReq.java +++ b/src/main/java/shop/cazait/domain/master/dto/request/MasterCreateInDTO.java @@ -1,4 +1,4 @@ -package shop.cazait.domain.master.dto.post; +package shop.cazait.domain.master.dto.request; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; @@ -20,7 +20,7 @@ @Schema(description = "마스터 정보 Request : 회원 가입에 필요한 마스터 정보") @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class PostMasterReq { +public class MasterCreateInDTO { @NotBlank(message = "Master 이메일을 입력해주세요.") @Schema(description = "이메일", example = "master@gmail.com") diff --git a/src/main/java/shop/cazait/domain/master/dto/patch/PatchMasterReq.java b/src/main/java/shop/cazait/domain/master/dto/request/MasterUpdateInDTO.java similarity index 93% rename from src/main/java/shop/cazait/domain/master/dto/patch/PatchMasterReq.java rename to src/main/java/shop/cazait/domain/master/dto/request/MasterUpdateInDTO.java index 260637af..09df956e 100644 --- a/src/main/java/shop/cazait/domain/master/dto/patch/PatchMasterReq.java +++ b/src/main/java/shop/cazait/domain/master/dto/request/MasterUpdateInDTO.java @@ -1,4 +1,4 @@ -package shop.cazait.domain.master.dto.patch; +package shop.cazait.domain.master.dto.request; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; @@ -11,7 +11,7 @@ @Schema(description = "마스터 수정 Request : 수정할 마스터 계정 정보") @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter -public class PatchMasterReq { +public class MasterUpdateInDTO { @Schema(description = "Master 이메일") @NotBlank(message = "수정하고자 하는 마스터 계정의 이메일을 입력해주세요.") diff --git a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterRes.java b/src/main/java/shop/cazait/domain/master/dto/response/MasterCreateOutDTO.java similarity index 78% rename from src/main/java/shop/cazait/domain/master/dto/post/PostMasterRes.java rename to src/main/java/shop/cazait/domain/master/dto/response/MasterCreateOutDTO.java index 703813e4..f3b81f23 100644 --- a/src/main/java/shop/cazait/domain/master/dto/post/PostMasterRes.java +++ b/src/main/java/shop/cazait/domain/master/dto/response/MasterCreateOutDTO.java @@ -1,4 +1,4 @@ -package shop.cazait.domain.master.dto.post; +package shop.cazait.domain.master.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AccessLevel; @@ -9,7 +9,7 @@ @Schema(description = "마스터 정보 Response : 회원 가입한 마스터 계정 정보") @Getter @Builder(access = AccessLevel.PRIVATE) -public class PostMasterRes { +public class MasterCreateOutDTO { @Schema(description = "마스터 계정 ID") private Long id; @@ -20,8 +20,8 @@ public class PostMasterRes { @Schema(description = "마스터 계정 이름") private String nickname; - static public PostMasterRes of(Master master) { - return PostMasterRes.builder() + static public MasterCreateOutDTO of(Master master) { + return MasterCreateOutDTO.builder() .id(master.getId()) .email(master.getEmail()) .nickname(master.getNickname()) diff --git a/src/main/java/shop/cazait/domain/master/dto/get/GetMasterRes.java b/src/main/java/shop/cazait/domain/master/dto/response/MasterListOutDTO.java similarity index 78% rename from src/main/java/shop/cazait/domain/master/dto/get/GetMasterRes.java rename to src/main/java/shop/cazait/domain/master/dto/response/MasterListOutDTO.java index 528671a2..f6270baa 100644 --- a/src/main/java/shop/cazait/domain/master/dto/get/GetMasterRes.java +++ b/src/main/java/shop/cazait/domain/master/dto/response/MasterListOutDTO.java @@ -1,4 +1,4 @@ -package shop.cazait.domain.master.dto.get; +package shop.cazait.domain.master.dto.response; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AccessLevel; @@ -9,7 +9,7 @@ @Schema(description = "마스터 조회 Response : 마스터 계정 정보") @Getter @Builder(access = AccessLevel.PRIVATE) -public class GetMasterRes { +public class MasterListOutDTO { @Schema(description = "마스터 계정 ID") private Long id; @@ -19,8 +19,8 @@ public class GetMasterRes { @Schema(description = "마스터 계정 이름") private String nickname; - public static GetMasterRes of(Master master) { - return GetMasterRes.builder() + public static MasterListOutDTO of(Master master) { + return MasterListOutDTO.builder() .id(master.getId()) .email(master.getEmail()) .nickname(master.getNickname()) diff --git a/src/main/java/shop/cazait/domain/master/dto/patch/PatchMasterRes.java b/src/main/java/shop/cazait/domain/master/dto/response/MasterUptateOutDTO.java similarity index 82% rename from src/main/java/shop/cazait/domain/master/dto/patch/PatchMasterRes.java rename to src/main/java/shop/cazait/domain/master/dto/response/MasterUptateOutDTO.java index 57af3415..c9075178 100644 --- a/src/main/java/shop/cazait/domain/master/dto/patch/PatchMasterRes.java +++ b/src/main/java/shop/cazait/domain/master/dto/response/MasterUptateOutDTO.java @@ -1,14 +1,13 @@ -package shop.cazait.domain.master.dto.patch; +package shop.cazait.domain.master.dto.response; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; @Schema(description = "마스터 수정 Response : 수정한 마스터 계정 정보") @Getter @Builder -public class PatchMasterRes { +public class MasterUptateOutDTO { @Schema(description = "마스터 계정 ID") private Long id; diff --git a/src/main/java/shop/cazait/domain/master/service/MasterService.java b/src/main/java/shop/cazait/domain/master/service/MasterService.java index 32083365..da9a972b 100644 --- a/src/main/java/shop/cazait/domain/master/service/MasterService.java +++ b/src/main/java/shop/cazait/domain/master/service/MasterService.java @@ -20,11 +20,11 @@ import lombok.extern.slf4j.Slf4j; import shop.cazait.domain.auth.dto.PostLoginReq; import shop.cazait.domain.auth.dto.PostLoginRes; -import shop.cazait.domain.master.dto.get.GetMasterRes; -import shop.cazait.domain.master.dto.patch.PatchMasterReq; -import shop.cazait.domain.master.dto.patch.PatchMasterRes; -import shop.cazait.domain.master.dto.post.PostMasterReq; -import shop.cazait.domain.master.dto.post.PostMasterRes; +import shop.cazait.domain.master.dto.request.MasterCreateInDTO; +import shop.cazait.domain.master.dto.request.MasterUpdateInDTO; +import shop.cazait.domain.master.dto.response.MasterCreateOutDTO; +import shop.cazait.domain.master.dto.response.MasterListOutDTO; +import shop.cazait.domain.master.dto.response.MasterUptateOutDTO; import shop.cazait.domain.master.entity.Master; import shop.cazait.domain.master.error.MasterException; import shop.cazait.domain.master.repository.MasterRepository; @@ -46,7 +46,7 @@ public class MasterService { /** * 마스터 회원 가입 */ - public PostMasterRes registerMaster(PostMasterReq dto) throws + public MasterCreateOutDTO registerMaster(MasterCreateInDTO dto) throws MasterException, InvalidAlgorithmParameterException, NoSuchPaddingException, @@ -68,7 +68,7 @@ public PostMasterRes registerMaster(PostMasterReq dto) throws Master master = dto.toEntity(); masterRepository.save(master); - return PostMasterRes.of(master); + return MasterCreateOutDTO.of(master); } @@ -116,11 +116,11 @@ public PostLoginRes LoginMaster(PostLoginReq dto) throws //마스터 회원 전체 조회 @Transactional(readOnly = true) - public List getMasterByStatus(BaseStatus status) throws MasterException { + public List getMasterByStatus(BaseStatus status) throws MasterException { List masterList = masterRepository.findMasterByStatus(status); - List masterResList = new ArrayList<>(); + List masterResList = new ArrayList<>(); for (Master master : masterList) { - GetMasterRes masterRes = GetMasterRes.of(master); + MasterListOutDTO masterRes = MasterListOutDTO.of(master); masterResList.add(masterRes); } if (masterResList.isEmpty()) { @@ -130,10 +130,10 @@ public List getMasterByStatus(BaseStatus status) throws MasterExce } //마스터 회원 정보 업데이트 - public PatchMasterRes updateMaster(Long id, PatchMasterReq patchMasterReq) { + public MasterUptateOutDTO updateMaster(Long id, MasterUpdateInDTO masterUpdateInDTO) { Master findMaster = masterRepository.findMasterById(id).get(); Master updateMaster = masterRepository.save(findMaster); - return PatchMasterRes.builder() + return MasterUptateOutDTO.builder() .id(updateMaster.getId()) .email(updateMaster.getEmail()) .password(updateMaster.getPassword())