Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 시간표 POST, PUT 예시 #373

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
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
53 changes: 48 additions & 5 deletions src/main/java/koreatech/in/controller/TimeTableController.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,59 @@ ResponseEntity getTimetabless(@ApiParam(value = "학기 (예시:20191)", require
@ApiOperation(value = "", authorizations = {@Authorization(value="Authorization")})
@RequestMapping(value = "/timetables", method = RequestMethod.POST)
public @ResponseBody
ResponseEntity createTimeTables(@ApiParam(value = "json value (예시: {\"timetable\":[...], \"semester\":\"20191\"}" +
" Timetable REQUIRED class_time, class_title, grades", required = true) @RequestBody String timetable_log) throws Exception {
ResponseEntity createTimeTables(@ApiParam(value = "json value (예시:\n" +
"{\n" +
" \"timetable\": [\n" +
" {\n" +
" \"code\": \"CPC490\",\n" +
" \"class_title\": null,\n" +
" \"class_time\": [\n" +
" 210,\n" +
" 211\n" +
" ],\n" +
" \"class_place\": null,\n" +
" \"professor\": null,\n" +
" \"grades\": null,\n" +
" \"lecture_class\": \"01\",\n" +
" \"target\": \"디자 1 건축\",\n" +
" \"regular_number\": \"25\",\n" +
" \"design_score\": \"0\",\n" +
" \"department\": \"디자인ㆍ건축공학부\",\n" +
" \"memo\": null\n" +
" }\n" +
" ],\n" +
" \"semester\": \"20192\"\n" +
"}", required = true) @RequestBody String timetable_log) throws Exception {
return new ResponseEntity<Map<String, Object>>(timeTableService.createTimeTables(timetable_log), HttpStatus.CREATED);
}
Comment on lines 52 to 79
Copy link
Contributor

Choose a reason for hiding this comment

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

C

코드 보기가 너무 안 좋은데 timetable_log를 DTO로 바꿔서 그 안에 넣는건 어려울까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

알겠습니다...!

Copy link

Choose a reason for hiding this comment

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

A

예시에 대한 클라이언트 요청 잘 받아주신 거 같네요!!


@ApiOperation(value = "", authorizations = {@Authorization(value="Authorization")})
@RequestMapping(value = "/timetables", method = RequestMethod.PUT)
public @ResponseBody
ResponseEntity updateTimeTable(@ApiParam(value = "json value (예시: {\"timetable\":[...], \"semester\":\"20191\"}" +
" Timetable REQUIRED id, class_time, class_title, grades", required = true) @RequestBody String timetable_log) throws Exception {
ResponseEntity updateTimeTable(@ApiParam(value = "json value (예시:\n" +
"{\n" +
" \"timetable\": [\n" +
" {\n" +
" \"id\": 1,\n" +
" \"code\": \"CPC490\",\n" +
" \"class_title\": null,\n" +
" \"class_time\": [\n" +
" 210,\n" +
" 211\n" +
" ],\n" +
" \"class_place\": null,\n" +
" \"professor\": null,\n" +
" \"grades\": null,\n" +
" \"lecture_class\": \"01\",\n" +
" \"target\": \"디자 1 건축\",\n" +
" \"regular_number\": \"25\",\n" +
" \"design_score\": \"0\",\n" +
" \"department\": \"디자인ㆍ건축공학부\",\n" +
" \"memo\": null\n" +
" }\n" +
" ],\n" +
" \"semester\": \"20192\"\n" +
"}", required = true) @RequestBody String timetable_log) throws Exception {
return new ResponseEntity<Map<String, Object>>(timeTableService.updateTimeTable(timetable_log), HttpStatus.CREATED);
}

Expand All @@ -79,4 +122,4 @@ ResponseEntity deleteTimeTableAll(@ApiParam(value = "학기 (예시:20191)", req
ResponseEntity deleteTimeTableById(@ApiParam(value = "스케줄의 uid", required = true) @RequestParam(value = "id") int id) throws Exception {
return new ResponseEntity<Map<String, Object>>(timeTableService.deleteTimeTableById(id), HttpStatus.OK);
}
}
}