-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduleController.java
More file actions
28 lines (24 loc) · 1.22 KB
/
ScheduleController.java
File metadata and controls
28 lines (24 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.demo.pteam.schedule.controller;
import com.demo.pteam.global.response.ApiResponse;
import com.demo.pteam.schedule.controller.dto.ReadScheduleRequest;
import com.demo.pteam.schedule.controller.dto.ScheduleResponse;
import com.demo.pteam.schedule.service.ScheduleService;
import com.demo.pteam.security.principal.UserPrincipal;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/schedules")
@RequiredArgsConstructor
public class ScheduleController {
private final ScheduleService scheduleService;
@GetMapping
public ResponseEntity<ApiResponse<List<ScheduleResponse>>> readSchedules(@AuthenticationPrincipal UserPrincipal principal,
@ModelAttribute @Valid ReadScheduleRequest requestParams) {
List<ScheduleResponse> schedules = scheduleService.findAllSchedules(principal.id(), requestParams);
return ResponseEntity.ok(ApiResponse.success("회원정보 조회 성공", schedules));
}
}