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 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);