Skip to content

Commit

Permalink
feat: Lecture Controller 시간표 생성시 강의 검색 API
Browse files Browse the repository at this point in the history
  • Loading branch information
wonslee committed Jan 7, 2024
1 parent 4abfac9 commit 077956d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
package usw.suwiki.domain.lecture.controller;

import static usw.suwiki.global.exception.ExceptionType.USER_RESTRICTED;

import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import usw.suwiki.domain.lecture.controller.dto.LectureAndCountResponseForm;
import usw.suwiki.domain.lecture.controller.dto.LectureDetailResponseDto;
import usw.suwiki.domain.lecture.controller.dto.LectureFindOption;
import usw.suwiki.domain.lecture.controller.dto.LectureWithScheduleResponse;
import usw.suwiki.domain.lecture.service.LectureService;
import usw.suwiki.global.ResponseForm;
import usw.suwiki.global.annotation.ApiLogger;
import usw.suwiki.global.annotation.CacheStatics;
import usw.suwiki.global.dto.ApiResponse;
import usw.suwiki.global.dto.NoOffsetPaginationResponse;
import usw.suwiki.global.exception.errortype.AccountException;
import usw.suwiki.global.jwt.JwtAgent;
import usw.suwiki.global.util.CacheStaticsLogger;

import static usw.suwiki.global.exception.ExceptionType.USER_RESTRICTED;


@RestController
@RequiredArgsConstructor
Expand All @@ -43,6 +51,20 @@ public ResponseEntity<LectureAndCountResponseForm> searchLectureApi(
return ResponseEntity.ok(response);
}

@GetMapping("/current/cells/search")
public ResponseEntity<ApiResponse<NoOffsetPaginationResponse<LectureWithScheduleResponse>>> searchLectureCells(
@RequestParam(required = false) Long cursorId,
@RequestParam(required = false, defaultValue = "20") Integer size,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) String major,
@RequestParam(required = false) Integer grade
) {
NoOffsetPaginationResponse<LectureWithScheduleResponse> response =
lectureService.findPagedLecturesWithSchedule(cursorId, size, keyword, major, grade);

return ResponseEntity.ok(ApiResponse.success(response));
}

@Cacheable(cacheNames = "lecture")
@ApiLogger(option = "lecture")
@CacheStatics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public LectureDetailResponseDto readLectureDetail(Long id) {
return new LectureDetailResponseDto(lecture);
}

// 강의 검색 - 시간표 생성시 조회
public NoOffsetPaginationResponse<LectureWithScheduleResponse> findPagedLecturesWithSchedule(
Long cursorId,
int limit,
Expand Down

0 comments on commit 077956d

Please sign in to comment.