Skip to content

Commit

Permalink
feat: lecture, timetableLecture API v3 (#1156)
Browse files Browse the repository at this point in the history
* feat: 정규 강의 생성 API

* chore: 컨트롤러 네이밍 변경

* chore: 스웨거 설명 변경

* chore: 스웨거 에러 코드 추가

* chore: 서비스 네이밍 변경

* chore: 서비스 네이밍 변경

* feat: 커스텀 강의 생성 API

* chore: 미사용 import 삭제

* fix: 조회 버그 수정

* chore: api implements

* docs: TODO 작성

* feat: 커스텀 강의 수정 API 기본 틀 추가

* feat: 정규 강의 수정 API 기본 틀 추가

* feat: 커스텀 강의 수정 API dto 수정

* feat: timetableLectureV3 조회 API 기본 틀

* chore: 미사용 import 삭제

* chore: 미사용 import 삭제

* feat: Lecture V3

* feat: lecture 정규화

* chore: lecture - LectureInformation 연간관계 설정

* chore: 메소드 명 변경 및 미사용 import 삭제

* feat: 커스텀 강의 업데이트 로직 구현

* feat: 정규 강의 수정 임시 커밋

* feat: 정규 강의 수정 기능 구현

* fix: 응답 버그 수정

* docs: TODO 작성

* feat: 시간표 조회 API 구현

* feat: timetableV3 스웨거 그룹화

* feat: TimetableLectureInformation 추가 및 flyway 수정

* fix: TimetableLEctureInformation으로 코드 변경

* chore: 이전 코드 삭제

* chore: 이전 코드 삭제 및 flyway 수정

* feat: 강의 중복 체크 추가

* feat: 프로시저 추가

* chore: 정규 강의 API 정규화 롤백

* chore: 커스텀 강의 API 정규화 롤백

* chore: 응답값 설정

* chore: 패키지 이동

* chore: 코드 위치 변경

* feat: 롤백 API

* chore: 미사용 import 삭제

* test: 테스트 코드 작성

* test: 테스트 코드 작성

* chore: 주석 작성

* chore: flyway 삭제

* chore: 주석 수정

* chore: 주석 수정

* fix: dto 의존성 끊기

* test: 테스트 실패 수정

* fix: 정규 강의 수정기능 버그 수정

* docs: 스웨거 응답 코드 변경

* chore: lecture API 파라미터 변경

* test: 테스트 수정

* chore: 리뷰 반영

* chore: 커스텀 정규화 메소드 수정

* chore: 리뷰 반영

* chore: lecture v3 파라미터 변경

* chore: frame 복구 api 삭제

* Revert "chore: frame 복구 api 삭제"

This reverts commit 7f293c7.

* chore: 리뷰 반영

* chore: 리뷰 반영
  • Loading branch information
Soundbar91 authored Jan 5, 2025
1 parent 7f08427 commit 8c9cba9
Show file tree
Hide file tree
Showing 29 changed files with 1,833 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,18 @@ public void delete() {
public void undelete() {
this.isDeleted = false;
}

public void updateCustomLecture(String classTitle, String professor, String classTime, String classPlace) {
this.classTitle = classTitle;
this.professor = professor;
this.classTime = classTime;
this.classPlace = classPlace;
}

public void updateRegularLecture(String classTitle, String classPlace) {
if (!lecture.getName().equals(classTitle)) {
this.classTitle = classTitle;
}
this.classPlace = classPlace;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package in.koreatech.koin.domain.timetableV3.controller;

import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import in.koreatech.koin.domain.timetableV3.dto.response.LectureResponseV3;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "(Normal) Lecture: V3-정규 강의", description = "정규 강의 정보를 관리한다")
public interface LectureApiV3 {

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true))),
}
)
@Operation(summary = "정규 강의 목록 조회")
@GetMapping("/v3/lectures")
ResponseEntity<List<LectureResponseV3>> getLectures(
@RequestParam(name = "year") Integer year,
@RequestParam(name = "term") String term
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package in.koreatech.koin.domain.timetableV3.controller;

import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import in.koreatech.koin.domain.timetableV3.dto.response.LectureResponseV3;
import in.koreatech.koin.domain.timetableV3.service.LectureServiceV3;
import lombok.RequiredArgsConstructor;

@RestController
@RequiredArgsConstructor
public class LectureControllerV3 implements LectureApiV3 {

private final LectureServiceV3 lectureServiceV3;

@GetMapping("/v3/lectures")
public ResponseEntity<List<LectureResponseV3>> getLectures(
@RequestParam(name = "year") Integer year,
@RequestParam(name = "term") String term
) {
List<LectureResponseV3> response = lectureServiceV3.getLectures(year, term);
return ResponseEntity.ok(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package in.koreatech.koin.domain.timetableV3.controller;

import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import in.koreatech.koin.domain.timetableV3.dto.request.TimetableCustomLectureCreateRequest;
import in.koreatech.koin.domain.timetableV3.dto.request.TimetableCustomLectureUpdateRequest;
import in.koreatech.koin.domain.timetableV3.dto.response.TimetableLectureResponseV3;
import in.koreatech.koin.global.auth.Auth;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;

@Tag(name = "(Normal) Timetable: V3-시간표", description = "시간표 커스텀 강의 정보를 관리한다")
public interface TimetableCustomLectureApiV3 {

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true)))
}
)
@Operation(summary = "커스텀 강의 생성")
@SecurityRequirement(name = "Jwt Authentication")
@PostMapping("/v3/timetables/lecture/custom")
ResponseEntity<TimetableLectureResponseV3> createTimetablesCustomLecture(
@Valid @RequestBody TimetableCustomLectureCreateRequest request,
@Auth(permit = {STUDENT}) Integer userId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true)))
}
)
@Operation(summary = "커스텀 강의 수정")
@SecurityRequirement(name = "Jwt Authentication")
@PutMapping("/v3/timetables/lecture/custom")
ResponseEntity<TimetableLectureResponseV3> updateTimetablesCustomLecture(
@Valid @RequestBody TimetableCustomLectureUpdateRequest request,
@Auth(permit = {STUDENT}) Integer userId
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package in.koreatech.koin.domain.timetableV3.controller;

import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import in.koreatech.koin.domain.timetableV3.dto.request.TimetableCustomLectureCreateRequest;
import in.koreatech.koin.domain.timetableV3.dto.request.TimetableCustomLectureUpdateRequest;
import in.koreatech.koin.domain.timetableV3.dto.response.TimetableLectureResponseV3;
import in.koreatech.koin.domain.timetableV3.service.TimetableCustomLectureServiceV3;
import in.koreatech.koin.global.auth.Auth;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

@RestController
@RequiredArgsConstructor
public class TimetableCustomLectureControllerV3 implements TimetableCustomLectureApiV3 {

private final TimetableCustomLectureServiceV3 customLectureServiceV3;

@PostMapping("/v3/timetables/lecture/custom")
public ResponseEntity<TimetableLectureResponseV3> createTimetablesCustomLecture(
@Valid @RequestBody TimetableCustomLectureCreateRequest request,
@Auth(permit = {STUDENT}) Integer userId
) {
TimetableLectureResponseV3 response = customLectureServiceV3.createTimetablesCustomLecture(request, userId);
return ResponseEntity.ok(response);
}

@PutMapping("/v3/timetables/lecture/custom")
public ResponseEntity<TimetableLectureResponseV3> updateTimetablesCustomLecture(
@Valid @RequestBody TimetableCustomLectureUpdateRequest request,
@Auth(permit = {STUDENT}) Integer userId
) {
TimetableLectureResponseV3 response = customLectureServiceV3.updateTimetablesCustomLecture(request, userId);
return ResponseEntity.ok(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package in.koreatech.koin.domain.timetableV3.controller;

import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import in.koreatech.koin.domain.timetableV3.dto.response.TimetableLectureResponseV3;
import in.koreatech.koin.global.auth.Auth;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "(Normal) Timetable: V3-시간표", description = "시간표를 관리한다")
public interface TimetableLectureApiV3 {

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true)))
}
)
@Operation(summary = "시간표 강의 정보 조회")
@SecurityRequirement(name = "Jwt Authentication")
@GetMapping("/v3/timetables/lecture")
ResponseEntity<TimetableLectureResponseV3> getTimetableLecture(
@RequestParam(value = "timetable_frame_id") Integer timetableFrameId,
@Auth(permit = {STUDENT}) Integer userId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true)))
}
)
@Operation(summary = "삭제한 시간표 강의 복구")
@SecurityRequirement(name = "Jwt Authentication")
@PostMapping("/v3/timetables/lecture/rollback")
ResponseEntity<TimetableLectureResponseV3> rollbackTimetableLecture(
@RequestParam(name = "timetable_lectures_id") List<Integer> timetableLecturesId,
@Auth(permit = {STUDENT}) Integer userId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true)))
}
)
@Operation(summary = "삭제한 시간표 프레임과 강의 복구",
description = """
1. 삭제된 시간표 프레임: 삭제된 시간표 프레임과 그에 속한 강의 정보를 복구합니다. \n
2. 삭제되지 않은 시간표 프레임: 시간표 프레임에 속한 강의 정보를 복구합니다.
""")
@SecurityRequirement(name = "Jwt Authentication")
@PostMapping("/v3/timetables/frame/rollback")
ResponseEntity<TimetableLectureResponseV3> rollbackTimetableFrame(
@RequestParam(name = "timetable_frame_id") Integer timetableFrameId,
@Auth(permit = {STUDENT}) Integer userId
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package in.koreatech.koin.domain.timetableV3.controller;

import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import in.koreatech.koin.domain.timetableV3.dto.response.TimetableLectureResponseV3;
import in.koreatech.koin.domain.timetableV3.service.TimetableLectureServiceV3;
import in.koreatech.koin.global.auth.Auth;
import lombok.RequiredArgsConstructor;

@RestController
@RequiredArgsConstructor
public class TimetableLectureControllerV3 implements TimetableLectureApiV3 {

private final TimetableLectureServiceV3 lectureServiceV3;

@GetMapping("/v3/timetables/lecture")
public ResponseEntity<TimetableLectureResponseV3> getTimetableLecture(
@RequestParam(value = "timetable_frame_id") Integer timetableFrameId,
@Auth(permit = {STUDENT}) Integer userId
) {
TimetableLectureResponseV3 response = lectureServiceV3.getTimetableLecture(timetableFrameId, userId);
return ResponseEntity.ok(response);
}

@PostMapping("/v3/timetables/lecture/rollback")
public ResponseEntity<TimetableLectureResponseV3> rollbackTimetableLecture(
@RequestParam(name = "timetable_lectures_id") List<Integer> timetableLecturesId,
@Auth(permit = {STUDENT}) Integer userId
) {
TimetableLectureResponseV3 response = lectureServiceV3.rollbackTimetableLecture(timetableLecturesId, userId);
return ResponseEntity.ok(response);
}

@PostMapping("/v3/timetables/frame/rollback")
public ResponseEntity<TimetableLectureResponseV3> rollbackTimetableFrame(
@RequestParam(name = "timetable_frame_id") Integer timetableFrameId,
@Auth(permit = {STUDENT}) Integer userId
) {
TimetableLectureResponseV3 response = lectureServiceV3.rollbackTimetableFrame(timetableFrameId, userId);
return ResponseEntity.ok(response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package in.koreatech.koin.domain.timetableV3.controller;

import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import in.koreatech.koin.domain.timetableV3.dto.request.TimetableRegularLectureCreateRequest;
import in.koreatech.koin.domain.timetableV3.dto.request.TimetableRegularLectureUpdateRequest;
import in.koreatech.koin.domain.timetableV3.dto.response.TimetableLectureResponseV3;
import in.koreatech.koin.global.auth.Auth;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;

@Tag(name = "(Normal) Timetable: V3-시간표", description = "시간표 정규 강의 정보를 관리한다")
public interface TimetableRegularLectureApiV3 {

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true)))
}
)
@Operation(summary = "정규 강의 생성")
@SecurityRequirement(name = "Jwt Authentication")
@PostMapping("/v3/timetables/lecture/regular")
ResponseEntity<TimetableLectureResponseV3> createTimetablesRegularLecture(
@Valid @RequestBody TimetableRegularLectureCreateRequest request,
@Auth(permit = {STUDENT}) Integer userId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true)))
}
)
@Operation(summary = "정규 강의 수정")
@SecurityRequirement(name = "Jwt Authentication")
@PutMapping("/v3/timetables/lecture/regular")
ResponseEntity<TimetableLectureResponseV3> updateTimetablesRegularLecture(
@Valid @RequestBody TimetableRegularLectureUpdateRequest request,
@Auth(permit = {STUDENT}) Integer userId
);
}
Loading

0 comments on commit 8c9cba9

Please sign in to comment.