diff --git a/mashup-member/src/main/java/kr/mashup/branding/facade/mashong/MashongFacadeService.java b/mashup-member/src/main/java/kr/mashup/branding/facade/mashong/MashongFacadeService.java index 1798cd8b..345ea3e1 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/facade/mashong/MashongFacadeService.java +++ b/mashup-member/src/main/java/kr/mashup/branding/facade/mashong/MashongFacadeService.java @@ -14,6 +14,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; + @Service @RequiredArgsConstructor public class MashongFacadeService { @@ -149,4 +152,12 @@ public PlatformMashongStatusResponse readCurrentStatus(Long memberGenerationId) return PlatformMashongStatusResponse.of(platformMashong, mashongPopcorn); } + + @Transactional(readOnly = true) + public Long withMashongDaysCount(Long memberGenerationId) { + LocalDate now = LocalDate.now(); + MemberGeneration memberGeneration = memberService.findByMemberGenerationId(memberGenerationId); + LocalDate generationStartedAt = memberGeneration.getGeneration().getStartedAt(); + return ChronoUnit.DAYS.between(generationStartedAt, now); + } } diff --git a/mashup-member/src/main/java/kr/mashup/branding/ui/mashong/MashongController.java b/mashup-member/src/main/java/kr/mashup/branding/ui/mashong/MashongController.java index c264a1f7..475fb77f 100644 --- a/mashup-member/src/main/java/kr/mashup/branding/ui/mashong/MashongController.java +++ b/mashup-member/src/main/java/kr/mashup/branding/ui/mashong/MashongController.java @@ -89,4 +89,11 @@ public ApiResponse readStatus(@ApiIgnore MemberAu PlatformMashongStatusResponse result = mashongFacadeService.readCurrentStatus(memberAuth.getMemberGenerationId()); return ApiResponse.success(result); } + + @ApiOperation(value = "매숑이와 함께한 날 Days count") + @GetMapping("/with-mashong-days") + public ApiResponse withMashongDays(@ApiIgnore MemberAuth memberAuth) { + Long withMashongDays = mashongFacadeService.withMashongDaysCount(memberAuth.getMemberGenerationId()); + return ApiResponse.success(withMashongDays); + } }