From 59e0a8070397f77aa90d50ba4d805a827ab1cf00 Mon Sep 17 00:00:00 2001 From: yeseul106 <20191037@sungshin.ac.kr> Date: Fri, 5 Jan 2024 07:14:03 +0900 Subject: [PATCH] =?UTF-8?q?[ADD]=20=EC=94=A8=EC=95=97=20=EC=9E=A0=EA=B8=88?= =?UTF-8?q?=20=ED=95=B4=EC=A0=9C=20=EC=8B=9C,=20=EC=88=98=ED=99=95?= =?UTF-8?q?=ED=95=9C=20=EC=91=A5=EC=9D=84=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/growthookserver/api/member/domain/Member.java | 5 +++++ .../api/seed/service/Impl/SeedServiceImpl.java | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/member/domain/Member.java b/growthookServer/src/main/java/com/example/growthookserver/api/member/domain/Member.java index 7d567eb..3ce450c 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/member/domain/Member.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/member/domain/Member.java @@ -56,4 +56,9 @@ public Member(String nickname, String email, SocialPlatform socialPlatform, Bool public void incrementGatheredSsuk() { this.gatheredSsuk = (this.gatheredSsuk == null ? 0 : this.gatheredSsuk) + 1; } + + public void useSsuck() { + this.gatheredSsuk--; + this.usedSsuk++; + } } 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 2c47a74..a5b8a2e 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 @@ -4,6 +4,8 @@ import com.example.growthookserver.api.actionplan.repository.ActionPlanRepository; import com.example.growthookserver.api.cave.domain.Cave; import com.example.growthookserver.api.cave.repository.CaveRepository; +import com.example.growthookserver.api.member.domain.Member; +import com.example.growthookserver.api.member.repository.MemberRepository; import com.example.growthookserver.api.seed.domain.Seed; import com.example.growthookserver.api.seed.dto.request.SeedCreateRequestDto; import com.example.growthookserver.api.seed.dto.request.SeedMoveRequestDto; @@ -35,6 +37,7 @@ public class SeedServiceImpl implements SeedService { private final CaveRepository caveRepository; private final SeedRepository seedRepository; private final ActionPlanRepository actionPlanRepository; + private final MemberRepository memberRepository; @Override @Transactional @@ -123,6 +126,10 @@ public SeedAlarmGetResponseDto getSeedAlarm(Long memberId) { public void unlockSeed(Long seedId) { Seed seed = seedRepository.findSeedByIdOrThrow(seedId); seed.unlockSeed(); + + Long memberId = seed.getMemberId(); + Member member = memberRepository.findMemberByIdOrThrow(memberId); + member.useSsuck(); } @Override