|
| 1 | +package com.wypl.wyplcore.calendar.controller; |
| 2 | + |
| 3 | +import java.time.LocalDate; |
| 4 | + |
| 5 | +import org.springframework.format.annotation.DateTimeFormat; |
| 6 | +import org.springframework.web.bind.annotation.GetMapping; |
| 7 | +import org.springframework.web.bind.annotation.PathVariable; |
| 8 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | +import org.springframework.web.bind.annotation.RequestParam; |
| 10 | + |
| 11 | +import com.wypl.applicationcommon.WyplResponseEntity; |
| 12 | +import com.wypl.googleoauthclient.annotation.Authenticated; |
| 13 | +import com.wypl.googleoauthclient.domain.AuthMember; |
| 14 | +import com.wypl.wyplcore.calendar.data.response.CalendarSchedulesResponse; |
| 15 | +import com.wypl.wyplcore.calendar.service.CalendarService; |
| 16 | +import com.wypl.wyplcore.schedule.data.CalendarType; |
| 17 | + |
| 18 | +import lombok.RequiredArgsConstructor; |
| 19 | + |
| 20 | +@RequiredArgsConstructor |
| 21 | +@RequestMapping("/calendar") |
| 22 | +public class CalendarController { |
| 23 | + private final CalendarService calendarService; |
| 24 | + |
| 25 | + @GetMapping |
| 26 | + public WyplResponseEntity getCalendar( |
| 27 | + @Authenticated AuthMember authMember, |
| 28 | + @PathVariable("calendarId") int calendarId, |
| 29 | + @RequestParam("type") CalendarType calendarType, |
| 30 | + @RequestParam(value = "date", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate today |
| 31 | + ) { |
| 32 | + CalendarSchedulesResponse response = calendarService.findCalendar(authMember, calendarId, calendarType, today); |
| 33 | + return WyplResponseEntity.ok(response, "달력 조회에 성공했습니다."); |
| 34 | + } |
| 35 | + |
| 36 | +} |
0 commit comments