-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 일정 생성, 조회, 수정, 삭제 controller 기능 구현
- Loading branch information
1 parent
06dff0d
commit f6b4b37
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
BE/error/src/main/java/com/example/demo/schedule/presentation/ScheduleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.example.demo.schedule.presentation; | ||
|
||
import com.example.demo.common.presentation.response.ApiResponse; | ||
import com.example.demo.common.presentation.response.ApiResponseBody.SuccessBody; | ||
import com.example.demo.common.presentation.response.ApiResponseGenerator; | ||
import com.example.demo.common.presentation.response.MessageCode; | ||
import com.example.demo.schedule.application.dto.CreateScheduleRequest; | ||
import com.example.demo.schedule.application.dto.UpdateScheduleRequest; | ||
import com.example.demo.schedule.application.dto.YearCalendarResponse; | ||
import com.sun.net.httpserver.Authenticator; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api") | ||
public class ScheduleController { | ||
|
||
@PostMapping("/calendar") | ||
public ApiResponse<SuccessBody<Void>> create( | ||
@RequestBody CreateScheduleRequest createScheduleRequest) { | ||
// 일정 생성하는 service logic | ||
return ApiResponseGenerator.success(HttpStatus.OK, MessageCode.CREATE); | ||
} | ||
|
||
@GetMapping("/calendar/{eventId}") | ||
public ApiResponse<SuccessBody<YearCalendarResponse>> getSpecificCalendar ( | ||
@PathVariable("eventId") Long eventId) { | ||
// specific response 담아서 리턴 logic | ||
return ApiResponseGenerator.success(response, HttpStatus.OK, MessageCode.GET); | ||
} | ||
|
||
@GetMapping("/calendar") | ||
public ApiResponse<SuccessBody<YearCalendarResponse>> getTypeCalendar ( | ||
@RequestParam("period") String type) { | ||
// type 별 response 담아서 리턴 logic | ||
return ApiResponseGenerator.success(response, HttpStatus.OK, MessageCode.GET); | ||
} | ||
|
||
@PutMapping("/calendar/{eventId}") | ||
public ApiResponse<SuccessBody<Void>> update( | ||
@RequestBody UpdateScheduleRequest updateScheduleRequest, | ||
@PathVariable("eventId") Long eventId) { | ||
// 수정하는 logic | ||
return ApiResponseGenerator.success(HttpStatus.OK, MessageCode.UPDATE); | ||
} | ||
|
||
@DeleteMapping("/calendar/{eventId}") | ||
public ApiResponse<SuccessBody<Void>> delete( | ||
@PathVariable("eventId") Long eventId) { | ||
// 일정 삭제하는 logic | ||
return return ApiResponseGenerator.success(HttpStatus.OK, MessageCode.DELETE); | ||
} | ||
|
||
} |