From dcac65507aee236350694f6b18835b612902ced1 Mon Sep 17 00:00:00 2001 From: Hong0329 Date: Wed, 20 Mar 2024 07:47:27 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[FIX]1=EC=B0=A8=20=EC=8A=A4=ED=94=84?= =?UTF-8?q?=EB=A6=B0=ED=8A=B8=20=ED=81=B4=EB=9D=BCQA=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/seed/dto/request/SeedCreateRequestDto.java | 1 - .../api/seed/dto/request/SeedUpdateRequestDto.java | 1 - .../api/seed/service/Impl/SeedServiceImpl.java | 11 ++++++++--- .../growthookserver/common/response/ErrorStatus.java | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedCreateRequestDto.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedCreateRequestDto.java index c18fee5..22878c6 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedCreateRequestDto.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedCreateRequestDto.java @@ -19,7 +19,6 @@ public class SeedCreateRequestDto { @Size(max = 300) private String memo; - @NotBlank @Size(max = 20) private String source; diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedUpdateRequestDto.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedUpdateRequestDto.java index f108651..68dba1c 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedUpdateRequestDto.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/request/SeedUpdateRequestDto.java @@ -18,7 +18,6 @@ public class SeedUpdateRequestDto { @Size(max = 300) private String memo; - @NotBlank @Size(max = 20) private String source; diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java index 9a108d2..c5d9e60 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java @@ -20,6 +20,9 @@ import java.time.Clock; import java.util.List; import java.util.stream.Collectors; + +import com.example.growthookserver.common.exception.BadRequestException; +import com.example.growthookserver.common.response.ErrorStatus; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -125,10 +128,12 @@ public SeedAlarmGetResponseDto getSeedAlarm(Long memberId) { @Transactional public void unlockSeed(Long seedId) { Seed seed = seedRepository.findSeedByIdOrThrow(seedId); - seed.unlockSeed(); + Member member = memberRepository.findMemberByIdOrThrow(seed.getMemberId()); - Long memberId = seed.getMemberId(); - Member member = memberRepository.findMemberByIdOrThrow(memberId); + if(member.getGatheredSsuk()==0) + throw new BadRequestException(ErrorStatus.USER_GATHEREDSSUK_ZERO.getMessage()); + + seed.unlockSeed(); member.useSsuck(); } diff --git a/growthookServer/src/main/java/com/example/growthookserver/common/response/ErrorStatus.java b/growthookServer/src/main/java/com/example/growthookserver/common/response/ErrorStatus.java index 8c79e44..a10f52b 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/common/response/ErrorStatus.java +++ b/growthookServer/src/main/java/com/example/growthookserver/common/response/ErrorStatus.java @@ -17,6 +17,7 @@ public enum ErrorStatus { INVALID_MEMBER("유효하지 않은 유저입니다."), ANOTHER_ACCESS_TOKEN("지원하지 않는 소셜 플랫폼입니다."), ALREADY_COMPLETE_ACTIONPLAN("이미 완료된 액션 플랜입니다."), + USER_GATHEREDSSUK_ZERO("해당 유저의 쑥이 0개입니다."), /** * 401 UNAUTHORIZED From 6967c0f3a57f73ca4f889d7c7e543f9e7e59c709 Mon Sep 17 00:00:00 2001 From: Hong0329 Date: Wed, 20 Mar 2024 07:52:43 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[FIX]=EC=9C=A0=EC=A0=80=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=20=EA=B0=80=EC=9E=85=20=EC=8B=9C=EC=97=90=20=EC=8A=AC?= =?UTF-8?q?=EB=9E=99=20=EC=95=8C=EB=A6=BC=20=EB=AC=B8=EA=B5=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../growthookserver/external/slack/service/SlackService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/growthookServer/src/main/java/com/example/growthookserver/external/slack/service/SlackService.java b/growthookServer/src/main/java/com/example/growthookserver/external/slack/service/SlackService.java index 792b6e6..a1dc43f 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/external/slack/service/SlackService.java +++ b/growthookServer/src/main/java/com/example/growthookserver/external/slack/service/SlackService.java @@ -17,7 +17,7 @@ public class SlackService { String slackToken; public void sendSlackMessage(String userName, Long totalMember, String channel) { - String message = userName +"님은 " + totalMember.toString() + "번째 쑥쑥이에어 곰이 됐어요."; + String message = userName +"님은 " + totalMember.toString() + "번째 쑥쑥이에서 곰이 됐어요."; try { MethodsClient methods = Slack.getInstance().methods(slackToken);