Skip to content

Commit

Permalink
Feat: 과릿 1.0.2 (#246)
Browse files Browse the repository at this point in the history
* Fix: Refresh Token 에러 반환 시 2000 반환하는 오류 수정 (#235)

* Fix: 리프레쉬 토큰 유효성 검증 로직 추가 #234

* Fix: OutofBound 발생 가능성 제거 #234

* Fix: 클라이언트 재발급로직 테스트를 위한 토큰 유효기간 최소화 #227

* Refactor: API 버전 관리 도입 (#236)

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Fix: API 버전 관리를 위한 URI 업데이트 #226

* Refactor: Subject URI 수정 (#236)

* Fix: 클래스 생성 제한 수 8개로 변경 (#238)

* Fix: 토큰 유효시간 원상복구 (#227)

* Fix: 학생이 이름, 색상 변경 시 적용 오류 수정 (#240)

* Fix: 학생이 이름, 색상 변경 시 적용 오류 수정 (#241)

* Fix: 학생이 업데이트한 이후에도 선생님 값이 반영되는 오류 수정 #239

* Fix: 메인페이지, 일정페이지용 Lecture 데이터 반환 시, 해당 멤버에 대한 정보를 가져오도록 수정 #239

* Style: 불필요 주석 삭제 #239

* Fix: 학생이 이름, 색상 변경 시 적용 오류 수정 (#242)

* Fix: 학생이 업데이트한 이후에도 선생님 값이 반영되는 오류 수정 #239

* Fix: 메인페이지, 일정페이지용 Lecture 데이터 반환 시, 해당 멤버에 대한 정보를 가져오도록 수정 #239

* Style: 불필요 주석 삭제 #239

* Fix: 메인페이지, 일정페이지용 쿼리 오류 수정 #239

* Refactor: Post/Put 요청 시, ResponseBody에 결과값 반환 (#243)

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148

* Refactor: Post/Put 요청 결과 ResponseBody로 반환하도록 리팩토링 #148
  • Loading branch information
dl-00-e8 authored Nov 2, 2023
1 parent 4448b1a commit c3ca5d5
Show file tree
Hide file tree
Showing 34 changed files with 423 additions and 369 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@

@RestController
@RequiredArgsConstructor
@RequestMapping("/banner")
@RequestMapping("")
@Tag(name = "Banner", description = "메인 페이지 배너 관련")
public class BannerController {

private final BannerService bannerService;

@PostMapping("")
public ApplicationResponse<BannerRes> register(@Valid @RequestPart(value = "data") BannerReq bannerReq, @RequestPart(value = "file") MultipartFile multipartFile) {
@PostMapping({"/banner", "/api/v{version}/banner"})
public ApplicationResponse<BannerRes> register(@PathVariable(name = "version", required = false) Long version, @Valid @RequestPart(value = "data") BannerReq bannerReq, @RequestPart(value = "file") MultipartFile multipartFile) {
return ApplicationResponse.create(ErrorCode.SUCCESS, bannerService.register(bannerReq, multipartFile));
}

@PutMapping("/{banner_id}")
public ApplicationResponse<BannerRes> update(@PathVariable("banner_id") Long bannerId, @Valid @RequestPart(value = "data") BannerReq bannerReq, @RequestPart(value = "file", required = false) MultipartFile multipartFile) {
@PutMapping({"/banner/{banner_id}", "/api/v{version}/banner/{banner_id}"})
public ApplicationResponse<BannerRes> update(@PathVariable(name = "version", required = false) Long version, @PathVariable("banner_id") Long bannerId, @Valid @RequestPart(value = "data") BannerReq bannerReq, @RequestPart(value = "file", required = false) MultipartFile multipartFile) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, bannerService.update(bannerId, bannerReq, multipartFile));
}

@GetMapping("")
public ApplicationResponse<List<BannerRes>> getAll() {
@GetMapping({"/banner", "/api/v{version}/banner"})
public ApplicationResponse<List<BannerRes>> getAll(@PathVariable(name = "version", required = false) Long version) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, bannerService.getAll());
}

@GetMapping("/content")
public ApplicationResponse<List<BannerRes>> getContent() {
@GetMapping({"/banner/content", "/api/v{version}/banner/content"})
public ApplicationResponse<List<BannerRes>> getContent(@PathVariable(name = "version", required = false) Long version) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, bannerService.getContent());
}

@DeleteMapping("/{banner_id}")
public ApplicationResponse<Void> delete(@PathVariable("banner_id") Long bannerId) {
@DeleteMapping({"/banner/{banner_id}", "/api/v{version}/banner/{banner_id}"})
public ApplicationResponse<Void> delete(@PathVariable(name = "version", required = false) Long version, @PathVariable("banner_id") Long bannerId) {
bannerService.delete(bannerId);
return ApplicationResponse.ok(ErrorCode.SUCCESS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public List<BannerRes> getContent() {
}

@Transactional
public Void delete(Long bannerId) {
public void delete(Long bannerId) {
// Validation
Banner banner = bannerRepository.findById(bannerId).orElseThrow(() -> new ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION));
if(banner.getDeletedAt() != null) {
Expand All @@ -109,6 +109,5 @@ public Void delete(Long bannerId) {
s3Client.delete(banner.getImageUrl());

// Response
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,36 @@

@RestController
@RequiredArgsConstructor
@RequestMapping("/content")
@RequestMapping("")
@Tag(name = "Content", description = "교육 콘텐츠 관련")
public class ContentController {

private final ContentService contentService;

@PostMapping("")
public ApplicationResponse<ContentRes> register(@Auth Member member, @Valid @RequestPart(value = "data") ContentReq contentReq, @RequestPart(value = "thumbnail", required = false) MultipartFile thumbnailImage) {
@PostMapping({"/content", "/api/v{version}/content"})
public ApplicationResponse<ContentRes> register(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @Valid @RequestPart(value = "data") ContentReq contentReq, @RequestPart(value = "thumbnail", required = false) MultipartFile thumbnailImage) {
return ApplicationResponse.create(ErrorCode.SUCCESS, contentService.register(member, contentReq, thumbnailImage));
}

@PutMapping("/{content_id}")
public ApplicationResponse<ContentRes> update(@Auth Member member, @PathVariable("content_id") Long contentId, @Valid @RequestPart(value = "data") ContentReq contentReq, @RequestPart(value = "thumbnail", required = false) MultipartFile thumbnailImage) {
@PutMapping({"/content/{content_id}", "/api/v{version}/content/{content_id}"})
public ApplicationResponse<ContentRes> update(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @PathVariable("content_id") Long contentId, @Valid @RequestPart(value = "data") ContentReq contentReq, @RequestPart(value = "thumbnail", required = false) MultipartFile thumbnailImage) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, contentService.update(member, contentId, contentReq, thumbnailImage));
}

@PatchMapping("/{content_id}")
public ApplicationResponse<ContentRes> updateIsPinned(@Auth Member member, @PathVariable("content_id") Long contentId) {
@PatchMapping({"/content/{content_id}", "/api/v{version}/content/{content_id}"})
public ApplicationResponse<ContentRes> updateIsPinned(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @PathVariable("content_id") Long contentId) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, contentService.updateIsPinned(member, contentId));
}

@DeleteMapping("/{content_id}")
public ApplicationResponse<Void> delete(@Auth Member member, @PathVariable("content_id") Long contentId) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, contentService.delete(member, contentId));
@DeleteMapping({"/content/{content_id}", "/api/v{version}/content/{content_id}"})
public ApplicationResponse<Void> delete(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @PathVariable("content_id") Long contentId) {
contentService.delete(member, contentId);
return ApplicationResponse.ok(ErrorCode.SUCCESS);
}

@Operation(description = "고정 설정이 된 칼럼만 반환")
@GetMapping("")
public ApplicationResponse<List<ContentRes>> getAll() {
@GetMapping({"/content", "/api/v{version}/content"})
public ApplicationResponse<List<ContentRes>> getAll(@PathVariable(name = "version", required = false) Long version) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, contentService.getAll());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public ContentRes update(Member member, Long contentId, ContentReq contentReq, M
}

@Transactional
public Void delete(Member member, Long contentId) {
public void delete(Member member, Long contentId) {
// Validation
/**
* TODO: 관리자 권한 확인 조건 추가 필요
Expand All @@ -120,7 +120,6 @@ public Void delete(Member member, Long contentId) {
contentRepository.delete(content);

// Response
return null;
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,58 @@

@RestController
@RequiredArgsConstructor
@RequestMapping("/homework")
@RequestMapping("")
@Tag(name = "Homework", description = "숙제 관련")
public class HomeworkController {

private final HomeworkService homeworkService;

@Operation(summary = "숙제 생성")
@PostMapping("")
public ApplicationResponse<Void> register(@Auth Member member, @RequestParam(value = "lesson_id", required = false) Long lessonId, @Valid @RequestBody HomeworkReq homeworkReq) {
homeworkService.register(member, lessonId, homeworkReq);
return ApplicationResponse.create(ErrorCode.SUCCESS);
@PostMapping({"/homework", "/api/v{version}/homework"})
public ApplicationResponse<HomeworkRes> register(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @RequestParam(value = "lesson_id", required = false) Long lessonId, @Valid @RequestBody HomeworkReq homeworkReq) {
return ApplicationResponse.create(ErrorCode.SUCCESS, homeworkService.register(member, lessonId, homeworkReq));
}

@Operation(summary = "숙제 정보 수정")
@PutMapping("/{homework_id}")
public ApplicationResponse<HomeworkMainRes> update(@Auth Member member, @PathVariable("homework_id") Long homeworkId, @Valid @RequestBody HomeworkReq homeworkReq) {
@PutMapping({"/homework/{homework_id}", "/api/v{version}/homework/{homework_id}"})
public ApplicationResponse<HomeworkMainRes> update(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @PathVariable("homework_id") Long homeworkId, @Valid @RequestBody HomeworkReq homeworkReq) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, homeworkService.update(member, homeworkId, homeworkReq));
}

@Operation(summary = "숙제 삭제")
@DeleteMapping("/{homework_id}")
public ApplicationResponse<Void> delete(@Auth Member member, @PathVariable("homework_id") Long homeworkId) {
@DeleteMapping({"/homework/{homework_id}", "/api/v{version}/homework/{homework_id}"})
public ApplicationResponse<Void> delete(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @PathVariable("homework_id") Long homeworkId) {
homeworkService.delete(member, homeworkId);
return ApplicationResponse.ok(ErrorCode.SUCCESS);
}

@Operation(summary = "숙제 정보 반환")
@GetMapping("/{homework_id}")
public ApplicationResponse<HomeworkRes> get(@Auth Member member, @PathVariable("homework_id") Long homeworkId) {
@GetMapping({"/homework/{homework_id}", "/api/v{version}/homework/{homework_id}"})
public ApplicationResponse<HomeworkRes> get(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @PathVariable("homework_id") Long homeworkId) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, homeworkService.get(member, homeworkId));
}

@Operation(summary = "해당 학생이 가지고 있는 숙제 정보 모두 반환")
@GetMapping("")
public ApplicationResponse<List<HomeworkRes>> getAll(@Auth Member member) {
@GetMapping({"/homework", "/api/v{version}/homework"})
public ApplicationResponse<List<HomeworkRes>> getAll(@PathVariable(name = "version", required = false) Long version, @Auth Member member) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, homeworkService.getAll(member));
}

@Operation(summary = "메인 페이지용 학생이 가지고 있는 숙제 정보 반환")
@GetMapping("/main")
public ApplicationResponse<List<HomeworkMainRes>> getMain(@Auth Member member) {
@GetMapping({"/homework/main", "/api/v{version}/homework/main"})
public ApplicationResponse<List<HomeworkMainRes>> getMain(@PathVariable(name = "version", required = false) Long version, @Auth Member member) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, homeworkService.getMain(member));
}

@Operation(summary = "클래스 페이지용 가장 최근 수업에 해당하는 숙제 정보 반환")
@GetMapping("/lecture/{lecture_id}")
public ApplicationResponse<List<HomeworkMainRes>> getLecture(@Auth Member member, @PathVariable("lecture_id") Long lectureId) {
@GetMapping({"/homework/lecture/{lecture_id}", "/api/v{version}/homework/lecture/{lecture_id}"})
public ApplicationResponse<List<HomeworkMainRes>> getLecture(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @PathVariable("lecture_id") Long lectureId) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, homeworkService.getLecture(member, lectureId));
}

@Operation(summary = "학생이 가지고 있는 모든 숙제 리스트 반환")
@GetMapping("/list")
public ApplicationResponse<List<HomeworkMainRes>> getList(@Auth Member member, @RequestParam(value = "lectureId", required = false) Long lectureId, @RequestParam("type") String type) {
@GetMapping({"/homework/list", "/api/v{version}/homework/list"})
public ApplicationResponse<List<HomeworkMainRes>> getList(@PathVariable(name = "version", required = false) Long version, @Auth Member member, @RequestParam(value = "lectureId", required = false) Long lectureId, @RequestParam("type") String type) {
return ApplicationResponse.ok(ErrorCode.SUCCESS, homeworkService.getList(member, lectureId, type));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class HomeworkService {
private final MemberAndLectureRepository memberAndLectureRepository;

@Transactional
public Void register(Member member, Long lessonId, HomeworkReq homeworkReq) {
public HomeworkRes register(Member member, Long lessonId, HomeworkReq homeworkReq) {
// Validation
if(lessonId != null) {
Lesson lesson = lessonRepository.findById(Long.valueOf(lessonId)).orElseThrow(() -> new LessonException(ErrorCode.NOT_EXIST_LESSON)); // 해당 수업이 미존재 시, 에러 반환
Expand All @@ -47,7 +47,7 @@ public Void register(Member member, Long lessonId, HomeworkReq homeworkReq) {
homeworkRepository.save(homework);

// Response
return null;
return new HomeworkRes(homework);
}

@Transactional
Expand All @@ -67,15 +67,14 @@ public HomeworkMainRes update(Member member, Long homeworkId, HomeworkReq homewo
}

@Transactional
public Void delete(Member member, Long homeworkId) {
public void delete(Member member, Long homeworkId) {
// Validation
Homework homework = homeworkRepository.findById(homeworkId).orElseThrow(() -> new HomeworkException(ErrorCode.NOT_FOUND_EXCEPTION));

// Business Logic
homeworkRepository.delete(homework);

// Response
return null;
}

public HomeworkRes get(Member member, Long homeworkId) {
Expand Down
Loading

0 comments on commit c3ca5d5

Please sign in to comment.