From f89b2fbf59aa1694645d9b3216691807350bbb90 Mon Sep 17 00:00:00 2001 From: KangMinJun Date: Wed, 8 May 2024 21:18:06 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=EC=9E=91=EB=B3=84=EC=9D=B8=EC=82=AC?= =?UTF-8?q?=EC=99=80=20=EB=A6=AC=EB=B3=B8=20=ED=83=80=EC=9E=85=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EC=9D=98=20=EA=B5=AC=EB=B6=84=EC=9C=BC=EB=A1=9C=20Req?= =?UTF-8?q?Dto=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reborn_15/_5_reborn/controller/RebornController.java | 7 ++++--- .../reborn_15/_5_reborn/dto/RebornRequestDto.java | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/reborn/backend/reborn_15/_5_reborn/controller/RebornController.java b/src/main/java/reborn/backend/reborn_15/_5_reborn/controller/RebornController.java index b43a3a3..14b915d 100644 --- a/src/main/java/reborn/backend/reborn_15/_5_reborn/controller/RebornController.java +++ b/src/main/java/reborn/backend/reborn_15/_5_reborn/controller/RebornController.java @@ -12,7 +12,8 @@ import reborn.backend.pet.service.PetService; import reborn.backend.reborn_15._5_reborn.converter.RebornConverter; import reborn.backend.reborn_15._5_reborn.domain.Reborn; -import reborn.backend.reborn_15._5_reborn.dto.RebornRequestDto.RebornReqDto; +import reborn.backend.reborn_15._5_reborn.dto.RebornRequestDto.ContentRebornReqDto; +import reborn.backend.reborn_15._5_reborn.dto.RebornRequestDto.RebornRebornReqDto; import reborn.backend.reborn_15._5_reborn.dto.RebornResponseDto.DetailRebornDto; import reborn.backend.reborn_15._5_reborn.service.RebornService; import reborn.backend.user.domain.User; @@ -68,7 +69,7 @@ public ApiResponse getDetailReBORN( @PostMapping("/write/{id}") public ApiResponse write( @PathVariable(name = "id") Long id, - @RequestBody RebornReqDto rebornReqDto + @RequestBody ContentRebornReqDto rebornReqDto ){ rebornService.writeReborn(id, rebornReqDto); @@ -82,7 +83,7 @@ public ApiResponse write( @PostMapping("/set/{id}") public ApiResponse setReborn( @PathVariable(name = "id") Long id, - @RequestBody RebornReqDto rebornReqDto + @RequestBody RebornRebornReqDto rebornReqDto ){ rebornService.setReborn(id, rebornReqDto); diff --git a/src/main/java/reborn/backend/reborn_15/_5_reborn/dto/RebornRequestDto.java b/src/main/java/reborn/backend/reborn_15/_5_reborn/dto/RebornRequestDto.java index 187ed19..93f59a3 100644 --- a/src/main/java/reborn/backend/reborn_15/_5_reborn/dto/RebornRequestDto.java +++ b/src/main/java/reborn/backend/reborn_15/_5_reborn/dto/RebornRequestDto.java @@ -14,10 +14,17 @@ public class RebornRequestDto { @Builder @AllArgsConstructor @NoArgsConstructor - public static class RebornReqDto { + public static class ContentRebornReqDto { @Schema(description = "반려동물에게 하는 작별인사") private String rebornContent; + } + @Schema(description = "RebornRebornReqDto") + @Getter + @Builder + @AllArgsConstructor + @NoArgsConstructor + public static class RebornRebornReqDto { @Schema(description = "리본 타입(YELLOW, BLACK)") private String rebornType; } From a45c0c094a50beea9725a1742b3a90507f529439 Mon Sep 17 00:00:00 2001 From: KangMinJun Date: Wed, 8 May 2024 21:18:17 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=EC=9E=91=EB=B3=84=EC=9D=B8=EC=82=AC?= =?UTF-8?q?=EC=99=80=20=EB=A6=AC=EB=B3=B8=20=ED=83=80=EC=9E=85=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EC=9D=98=20=EA=B5=AC=EB=B6=84=EC=9C=BC=EB=A1=9C=20Req?= =?UTF-8?q?Dto=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/reborn_15/_5_reborn/service/RebornService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/reborn/backend/reborn_15/_5_reborn/service/RebornService.java b/src/main/java/reborn/backend/reborn_15/_5_reborn/service/RebornService.java index 573cb45..464ae03 100644 --- a/src/main/java/reborn/backend/reborn_15/_5_reborn/service/RebornService.java +++ b/src/main/java/reborn/backend/reborn_15/_5_reborn/service/RebornService.java @@ -10,7 +10,8 @@ import reborn.backend.reborn_15._5_reborn.converter.RebornConverter; import reborn.backend.reborn_15._5_reborn.domain.Reborn; import reborn.backend.reborn_15._5_reborn.domain.RebornType; -import reborn.backend.reborn_15._5_reborn.dto.RebornRequestDto.RebornReqDto; +import reborn.backend.reborn_15._5_reborn.dto.RebornRequestDto.ContentRebornReqDto; +import reborn.backend.reborn_15._5_reborn.dto.RebornRequestDto.RebornRebornReqDto; import reborn.backend.reborn_15._5_reborn.repository.RebornRepository; import java.util.List; @@ -100,7 +101,7 @@ public void clotheReborn(Long id) { } @Transactional - public void writeReborn(Long id, RebornReqDto rebornReqDto) { + public void writeReborn(Long id, ContentRebornReqDto rebornReqDto) { Reborn reborn = rebornRepository.findById(id) .orElseThrow(() -> GeneralException.of(ErrorCode.REBORN_NOT_FOUND)); @@ -112,7 +113,7 @@ public void writeReborn(Long id, RebornReqDto rebornReqDto) { } @Transactional - public void setReborn(Long id, RebornReqDto rebornReqDto) { + public void setReborn(Long id, RebornRebornReqDto rebornReqDto) { Reborn reborn = rebornRepository.findById(id) .orElseThrow(() -> GeneralException.of(ErrorCode.REBORN_NOT_FOUND)); From e24c863dfd8999e8d7dd75ce45b3fba9f347da59 Mon Sep 17 00:00:00 2001 From: KangMinJun Date: Wed, 8 May 2024 21:28:54 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=EB=A6=AC=EB=B3=B8=EC=9D=98=20=EB=94=94?= =?UTF-8?q?=ED=8F=B4=ED=8A=B8=20=EA=B0=92=EC=9D=84=20BLACK=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/reborn/backend/reborn_15/_5_reborn/domain/Reborn.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/reborn/backend/reborn_15/_5_reborn/domain/Reborn.java b/src/main/java/reborn/backend/reborn_15/_5_reborn/domain/Reborn.java index 13cd9ff..57280e3 100644 --- a/src/main/java/reborn/backend/reborn_15/_5_reborn/domain/Reborn.java +++ b/src/main/java/reborn/backend/reborn_15/_5_reborn/domain/Reborn.java @@ -27,7 +27,7 @@ public class Reborn { @Enumerated(EnumType.STRING) @Column - private RebornType rebornType; + private RebornType rebornType = RebornType.BLACK; @Column private Boolean pat; From 65436bb5c7efdee4d41f5236f8c7c004e8ebfe26 Mon Sep 17 00:00:00 2001 From: KangMinJun Date: Wed, 8 May 2024 21:29:11 +0900 Subject: [PATCH 4/5] =?UTF-8?q?SuccessCode=20=EC=9E=98=EB=AA=BB=20?= =?UTF-8?q?=EB=A7=A4=EC=B9=98=EB=90=98=EC=96=B4=20=EC=9E=88=EB=8A=94=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/reborn/backend/mypage/controller/MypageController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/reborn/backend/mypage/controller/MypageController.java b/src/main/java/reborn/backend/mypage/controller/MypageController.java index 85f969f..9aea158 100644 --- a/src/main/java/reborn/backend/mypage/controller/MypageController.java +++ b/src/main/java/reborn/backend/mypage/controller/MypageController.java @@ -95,7 +95,7 @@ public ApiResponse deletePet( @PathVariable(name = "pet-id") Long id ){ petService.deletePet(id); - return ApiResponse.onSuccess(SuccessCode.PET_DETAIL_VIEW_SUCCESS, true); + return ApiResponse.onSuccess(SuccessCode.PET_DELETED, true); } From c9be82c1cf197e1fdfa0369038cb31cb5e82d7cb Mon Sep 17 00:00:00 2001 From: KangMinJun Date: Wed, 8 May 2024 21:33:39 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=ED=8E=AB=EA=B3=BC=20=EC=BB=A8=ED=85=90=EC=B8=A0=EB=A5=BC=20?= =?UTF-8?q?=EC=A7=84=ED=96=89=ED=95=98=EB=8A=94=20=ED=8E=AB=EC=9D=98=20id?= =?UTF-8?q?=EA=B0=80=20=EA=B0=99=EC=9D=80=20=EA=B2=BD=EC=9A=B0=EB=A5=BC=20?= =?UTF-8?q?=EA=B3=A0=EB=A0=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reborn/backend/mypage/controller/MypageController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/reborn/backend/mypage/controller/MypageController.java b/src/main/java/reborn/backend/mypage/controller/MypageController.java index 9aea158..dc0b0ea 100644 --- a/src/main/java/reborn/backend/mypage/controller/MypageController.java +++ b/src/main/java/reborn/backend/mypage/controller/MypageController.java @@ -35,6 +35,7 @@ import reborn.backend.user.service.UserService; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; @Tag(name = "마이페이지", description = "마이페이지 관련 api 입니다.") @@ -92,8 +93,12 @@ public ApiResponse getDetailPet( }) @DeleteMapping("/delete/{pet-id}") public ApiResponse deletePet( + @AuthenticationPrincipal CustomUserDetails customUserDetails, @PathVariable(name = "pet-id") Long id ){ + User user = userService.findUserByUserName(customUserDetails.getUsername()); + if (Objects.equals(user.getContentPetId(),id) ) userService.resetContentPetId(user); + petService.deletePet(id); return ApiResponse.onSuccess(SuccessCode.PET_DELETED, true); }