Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -16,6 +16,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.converters.models.PageableAsQueryParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -27,6 +28,7 @@
import javax.swing.*;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("api/v1/concerts/")
@RequiredArgsConstructor
Expand Down Expand Up @@ -122,17 +124,17 @@ public RsData<ConcertLikeResponse> isLikeConcert(
return RsData.success(concertService.isLikeConcert(concertId, user));
}

// todo : 내용 구현 필요
@Operation(summary = "공연 검색(구현 전)", description = "공연 정보를 검색합니다.")
// todo : 제목으로 만 검색 기능 구현 -> 추후 아티스트 정보랑 연동 <- 중요 / 정렬 기준? 최신등록순 정렬
@Operation(summary = "공연 검색", description = "공연 정보를 검색합니다.")
@GetMapping("search")
public RsData<List<ConcertItem>> searchConcert(
@Schema(description = "공연 정보 검색 키워드입니다.")
@RequestParam String keyword
@RequestParam String keyword,
@Schema(description = "페이징 처리 또는 무한 스크롤 구현에 쓸 Pageable 객체입니다.")
Pageable pageable

){
return null;
return RsData.success(concertService.getConcertListByKeyword(keyword,pageable));
}




}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,33 @@ List<ConcertItem> getNoTicketTimeConcertList(
)
List<ConcertItem> getLikedConcertsList(Pageable pageable,
@Param("userId") Long userId);
@Query("""
SELECT
new com.back.web7_9_codecrete_be.domain.concerts.dto.concert.ConcertItem(
c.concertId as id,
c.name as name,
c.concertPlace.placeName as placeName,
c.ticketTime as ticketTime,
c.startDate as startDate,
c.endDate as endDate,
c.posterUrl as posterUrl,
c.maxPrice as maxPrice,
c.minPrice as minPrice,
c.viewCount as viewCount,
c.likeCount as likeCount
)
FROM
Concert c
WHERE
c.name LIKE %:keyword%
ORDER BY
c.concertId
DESC
""")
List<ConcertItem> getConcertItemsByKeyword(
@Param("keyword")
String keyword,
Pageable pageable);

@Query("""
SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ public List<ConcertItem> getNoTicketTimeConcertsList(Pageable pageable) {
return concertRepository.getNoTicketTimeConcertList(pageable);
}

public List<ConcertItem> getConcertListByKeyword(String keyword, Pageable pageable) {
if(keyword == null || keyword.isEmpty()){
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예외처리 부분 안쪽이 비어있는데 혹시 일부러 미구현 하신건가요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

하다보니 까먹은... 나중에 공연 공통 오류 처리 추가하고 예외처리 잡으면서 넣겠습니다 👀


}

return concertRepository.getConcertItemsByKeyword(keyword, pageable);
}

public ConcertDetailResponse getConcertDetail(long concertId) {
ConcertDetailResponse concertDetailResponse = concertRepository.getConcertDetailById(concertId);
List<ConcertImage> concertImages = concertImageRepository.getConcertImagesByConcert_ConcertId(concertId);
Expand Down