-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCamStateController.java
More file actions
29 lines (24 loc) · 921 Bytes
/
CamStateController.java
File metadata and controls
29 lines (24 loc) · 921 Bytes
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
package com.example.api.controller;
import com.example.api.DTO.CamStateDTOs;
import com.example.api.Service.CamStateService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/cam")
public class CamStateController {
private final CamStateService camStateService;
// 현재 관찰 상태 조회
@GetMapping("/state")
public ResponseEntity<CamStateDTOs.StateResponse> getState() {
return ResponseEntity.ok(camStateService.getState());
}
// 관찰 상태 갱신
@PutMapping("/state")
public ResponseEntity<CamStateDTOs.StateResponse> updateState(
@Valid @RequestBody CamStateDTOs.UpdateRequest req) {
return ResponseEntity.ok(camStateService.updateState(req.state()));
}
}