-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStudyController.java
More file actions
39 lines (31 loc) · 1.46 KB
/
StudyController.java
File metadata and controls
39 lines (31 loc) · 1.46 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
29
30
31
32
33
34
35
36
37
38
39
package com.example.be.web.controller;
import com.example.be.apiPayload.ApiResponse;
import com.example.be.service.StudyServiceImpl;
import com.example.be.service.UserServiceImpl;
import com.example.be.web.dto.CommonDTO;
import com.example.be.web.dto.UserDTO;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/study")
@RequiredArgsConstructor
public class StudyController {
private final StudyServiceImpl studyService;
@PostMapping("/{time}")
@Operation(summary = "오늘, 누적 공부 시간 추가 API")
public ApiResponse<CommonDTO.IsSuccessDTO> addStudyTime(HttpServletRequest request, @PathVariable("time")int time) {
return ApiResponse.onSuccess(studyService.addStudyTime(request, time));
}
@PostMapping("/goal/{time}")
@Operation(summary = "목표 공부 시간 수정 API")
public ApiResponse<CommonDTO.IsSuccessDTO> addStudyGoalTime(HttpServletRequest request, @PathVariable("time")int time) {
return ApiResponse.onSuccess(studyService.addStudyGoalTime(request, time));
}
@GetMapping("/time")
@Operation(summary = "오늘, 누적, 목표 공부 시간 조회 API")
public ApiResponse<UserDTO.studyTimeResponseDto> getStudyTime(HttpServletRequest request) {
return ApiResponse.onSuccess(studyService.getStudyTime(request));
}
}