Skip to content

Commit

Permalink
fix: 마이페이지 방문장소 응답값 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jun3327 committed Nov 18, 2024
1 parent da88d82 commit 0cdceb9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public MemberAdventureInformationResponse getMemberAdventureInformation(final Me
final PlaceCategory placeCategory = PlaceCategory.valueOf(request.category().toUpperCase());
final String motionImageUrl = getMotionImageUrl(placeCategory, findCharacterEntity, findMemberEntity);
final String baseImageUrl = findCharacterEntity.getCharacterBaseImageUrl();
final String motionCaptureImageUrl = getMotionCaptureImageUrl(placeCategory, findCharacterEntity, findMemberEntity);
final String motionCaptureImageUrl = getMotionCaptureImageUrl(placeCategory, findCharacterEntity, findMemberEntity);
return MemberAdventureInformationResponse.of(nickname, emblemName,
s3Service.getPresignUrl(baseImageUrl), s3Service.getPresignUrl(motionImageUrl), findCharacterEntity.getName(), motionCaptureImageUrl);
}
Expand Down Expand Up @@ -188,8 +188,8 @@ public UserInfoResponse getUserInfo(final Long memberId) {
memberEntity.getNickName(),
memberEntity.getCurrentEmblemName(),
elapsedDays,
visitedPlaceService.countByMember(memberEntity),
completeQuestService.countByMember(memberEntity),
visitedPlaceService.countDistinctPlacesByMemberId(memberId),
s3Service.getPresignUrl(characterEntity.getCharacterBaseImageUrl())
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ public void deleteAllByMemberId(long memberId) {
public List<VisitedPlaceEntity> findAllByMemberId(long memberId) {
return visitedPlaceRepository.findTop100ByMemberEntityId(memberId);
}

public Long countByMember(MemberEntity entity) {
return visitedPlaceRepository.countByMemberEntityId(entity.getId());
}

public Boolean existsByMemberAndPlace(MemberEntity memberEntity, PlaceEntity placeEntity) {
return visitedPlaceRepository.existsByMemberEntityIdAndPlaceEntityId(memberEntity.getId(), placeEntity.getId());
}

public Long countDistinctPlacesByMemberId(Long memberId) {
return visitedPlaceRepository.countDistinctPlacesByMemberEntityId(memberId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@


import org.springframework.data.jpa.repository.JpaRepository;
import site.offload.db.place.entity.PlaceEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import site.offload.db.place.entity.VisitedPlaceEntity;

import java.util.List;

public interface VisitedPlaceRepository extends JpaRepository<VisitedPlaceEntity, Long> {
Long countByMemberEntityIdAndPlaceEntityId(Long memberId, Long placeId);

Long countByMemberEntityId(Long memberId);

void deleteAllByMemberEntityId(long memberId);

List<VisitedPlaceEntity> findTop100ByMemberEntityId(long memberId);

Boolean existsByMemberEntityIdAndPlaceEntityId(Long memberId, Long placeId);

@Query("select count(distinct vp.placeEntity.id) " +
"from VisitedPlaceEntity vp " +
"where vp.memberEntity.id = :memberId")
long countDistinctPlacesByMemberEntityId(@Param("memberId") Long memberId);
}

0 comments on commit 0cdceb9

Please sign in to comment.