Skip to content

Commit

Permalink
[ADD] 씨앗 잠금 해제 시, 수확한 쑥을 사용하는 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yeseul106 committed Jan 4, 2024
1 parent dd676e0 commit 59e0a80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 59e0a80

Please sign in to comment.