Skip to content

Commit

Permalink
Merge pull request #194 from kakao-tech-campus-2nd-step3/fix/#193-vid…
Browse files Browse the repository at this point in the history
…eoDomainFix

[Fix] #193 비디오 도메인의 오류를 수정했어요
  • Loading branch information
BaeJunH0 authored Nov 14, 2024
2 parents 9257675 + 4e4681c commit ecbe522
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import team7.inplace.global.exception.InplaceException;
import team7.inplace.global.exception.code.AuthorizationErrorCode;
import team7.inplace.global.exception.code.PlaceErrorCode;
import team7.inplace.global.exception.code.VideoErrorCode;
import team7.inplace.influencer.persistence.InfluencerRepository;
import team7.inplace.place.application.dto.PlaceForVideo;
import team7.inplace.place.domain.Place;
import team7.inplace.place.persistence.PlaceRepository;
import team7.inplace.security.util.AuthorizationUtil;
import team7.inplace.video.application.command.VideoCommand;
import team7.inplace.video.application.command.VideoCommand.Create;
import team7.inplace.video.application.dto.VideoInfo;
Expand All @@ -35,6 +37,10 @@ public class VideoService {

@Transactional(readOnly = true)
public List<VideoInfo> getVideosBySurround(VideoSearchParams videoSearchParams) {
// 토큰 정보에 대한 검증
if (AuthorizationUtil.isNotLoginUser()) {
throw InplaceException.of(AuthorizationErrorCode.TOKEN_IS_EMPTY);
}
// Place 엔티티 조회
Page<Place> places = placeRepository.findPlacesByDistanceAndFilters(
videoSearchParams.topLeftLongitude(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface VideoRepository extends JpaRepository<Video, Long> {
@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer ORDER BY v.viewCountIncrease DESC")
List<Video> findTop10ByOrderByViewCountIncreaseDesc(Pageable pageable);

@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer WHERE v.influencer.id IN :influencerIds")
@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer WHERE v.influencer.id IN :influencerIds ORDER BY v.id DESC")
List<Video> findTop10ByInfluencerIdIn(List<Long> influencerIds, Pageable pageable);

@Query("SELECT v FROM Video v JOIN FETCH v.place JOIN FETCH v.influencer ORDER BY v.id DESC")
Expand Down

0 comments on commit ecbe522

Please sign in to comment.