Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.divary.domain.logbase.logbook.enums;

public enum DiveMethod {
SHORE, BOAT, ETC
SHORE, BOAT, OTHER
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,10 @@ public void updateLogDate(Long logBaseInfoId, Long userId, LocalDate date) {

}

public int getAccumulationById(Long userId){

//ν˜„μž¬κΈ°μ€€μœΌλ‘œ 총 둜그뢁 λˆ„μ νšŸμˆ˜ 계산
return logBookRepository.countByLogBaseInfoMemberIdAndSaveStatus(userId, SaveStatus.COMPLETE);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ public class MyPageProfileResponseDTO {
@Schema(description = "레벨", example = "μ˜€ν”ˆμ›Œν„° 닀이버")
private Levels level;

@Schema(description = "총 닀이빙 횟수")
private Integer accumulations;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.divary.domain.image.dto.request.ImageUploadRequest;
import com.divary.domain.image.dto.response.ImageResponse;
import com.divary.domain.image.service.ImageService;
import com.divary.domain.logbase.logbook.enums.SaveStatus;
import com.divary.domain.logbase.logbook.service.LogBookService;
import com.divary.domain.member.dto.requestDTO.MyPageGroupRequestDTO;
import com.divary.domain.member.dto.requestDTO.MyPageLevelRequestDTO;
import com.divary.domain.member.dto.response.MyPageImageResponseDTO;
Expand Down Expand Up @@ -39,6 +41,7 @@ public class MemberServiceImpl implements MemberService {
private final MemberRepository memberRepository;
private final ImageService imageService;
private final TokenBlackListService tokenBlackListService;
private final LogBookService logBookService;

@Value("${jobs.user-deletion.grace-period-days}")
private int gracePeriodDays;
Expand Down Expand Up @@ -200,13 +203,18 @@ public void updateGroup(Long userId, MyPageGroupRequestDTO requestDTO){
public MyPageProfileResponseDTO getMemberProfile(Long userId){
Member member = memberRepository.findById(userId).orElseThrow(()->new BusinessException(ErrorCode.MEMBER_NOT_FOUND));

Integer accumulation
= logBookService.getAccumulationById(userId);
//ν˜„μž¬κΈ°μ€€μœΌλ‘œ 총 둜그뢁 λˆ„μ νšŸμˆ˜ 계산

String memberIdByEmail = member.getEmail().split("@")[0];
// ν”„λ‘œν•„μ— λ‚˜μ˜€λŠ” 아이디: μ΄λ©”μΌμ—μ„œ @ μ•žλΆ€λΆ„λ§Œ μΆ”μΆœ

return MyPageProfileResponseDTO.builder()
.memberGroup(member.getMemberGroup())
.level(member.getLevel())
.id(memberIdByEmail)
.accumulations(accumulation)
.build();
}

Expand Down