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
Expand Up @@ -5,13 +5,18 @@

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import team3.kummit.domain.EmotionBandArchive;

public interface EmotionBandArchiveRepository extends JpaRepository<EmotionBandArchive, Long> {
Optional<EmotionBandArchive> findByCreatorIdAndEmotionBandId(Long memberId, Long emotionBandId);
boolean existsByCreatorIdAndEmotionBandId(Long memberId, Long emotionBandId);

// 사용자가 보관한 밴드 ID 목록 조회
@Query("SELECT eba.emotionBand.id FROM EmotionBandArchive eba WHERE eba.creator.id = :memberId")
List<Long> findEmotionBandIdListByMemberId(@Param("memberId") Long memberId);

@Query("SELECT eb.id FROM EmotionBand eb where eb.creator.id =:memberId")
List<Long> findEmotionBandIdListByCreator(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import team3.kummit.domain.EmotionBandLike;

public interface EmotionBandLikeRepository extends JpaRepository<EmotionBandLike, Long> {
Optional<EmotionBandLike> findByCreatorIdAndEmotionBandId(Long memberId, Long emotionBandId);
Long countByEmotionBandId(Long emotionBandId);

// 사용자가 공감한 밴드 ID 목록 조회
@Query("SELECT ebl.emotionBand.id FROM EmotionBandLike ebl WHERE ebl.creator.id = :memberId")
List<Long> findEmotionBandIdListByMemberId(@Param("memberId") Long memberId);

@Query("SELECT eb.id FROM EmotionBand eb where eb.creator.id =:memberId")
List<Long> findEmotionBandIdListByCreator(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ public boolean isArchived(Long emotionBandId, Long memberId) {
}

public List<Long> findEmotionBandIdListByCreator(Long memberId){
return archiveRepository.findEmotionBandIdListByCreator(memberId);
return archiveRepository.findEmotionBandIdListByMemberId(memberId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ public boolean isLiked(Long emotionBandId, Long memberId) {
}

public List<Long> findEmotionBandListByMemberId(Long memberId) {
return bandRepository.findEmotionBandIdListByCreator(memberId);
return likeRepository.findEmotionBandIdListByMemberId(memberId);
}
}