Skip to content

Commit

Permalink
Merge pull request #62 from kakao-tech-campus-2nd-step3/refactor/#49-…
Browse files Browse the repository at this point in the history
…VideoIntegrationRefactor

[Refactor] #49 통합 과정에서 발생하는 사항을 리펙터링 했어요
  • Loading branch information
sanghee0820 authored Oct 14, 2024
2 parents f0404b4 + 5ea8741 commit ff70a78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package team7.inplace.video.application;

import java.util.List;
import java.util.Objects;

import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import team7.inplace.global.annotation.Facade;
import team7.inplace.global.exception.InplaceException;
import team7.inplace.global.exception.code.AuthorizationErrorCode;
Expand Down Expand Up @@ -34,7 +35,7 @@ public Page<VideoInfo> getVideosByMyInfluencer(Pageable pageable){
// User 정보를 쿠키에서 추출
Long userId = AuthorizationUtil.getUserId();
// 토큰 정보에 대한 검증
if (ObjectUtils.isEmpty(userId)) {
if (Objects.isNull(userId)) {
throw InplaceException.of(AuthorizationErrorCode.TOKEN_IS_EMPTY);
}
// 유저 정보를 이용하여 유저가 좋아요를 누른 인플루언서 id 리스트를 조회
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/team7/inplace/video/application/VideoService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
Expand Down Expand Up @@ -70,6 +72,14 @@ public Page<VideoInfo> getVideosByMyInfluencer(List<Long> influencerIds, Pageabl

private VideoInfo videoToInfo(Video savedVideo) {
Place place = savedVideo.getPlace();
if(Objects.isNull(place)){
return new VideoInfo(
savedVideo.getId(),
"장소 정보 없음",
savedVideo.getVideoUrl(),
PlaceForVideo.of(-1L, "장소 정보 없음")
);
}
String alias = AliasUtil.makeAlias(
savedVideo.getInfluencer().getName(),
place.getCategory()
Expand Down

0 comments on commit ff70a78

Please sign in to comment.