package com.example.nto.controller; import com.example.nto.dto.entity.TerminalDTO; import com.example.nto.service.TerminalService; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequiredArgsConstructor @RequestMapping("api/v1/terminals") public class TerminalController { private final TerminalService terminalService; @GetMapping public ResponseEntity> getAll() { return ResponseEntity.ok(terminalService.getAllTerminal()); } @GetMapping("/{terminalId}") public ResponseEntity getTerminalById(@PathVariable long terminalId) { return ResponseEntity.ok(terminalService.getById(terminalId)); } @GetMapping("/check/{code}") public ResponseEntity checkCode(@PathVariable String code) { return ResponseEntity.ok(terminalService.checkCode(code)); } @PostMapping public ResponseEntity createTerminal(@RequestBody TerminalDTO terminalDTO) { return ResponseEntity.ok(terminalService.create(terminalDTO)); } @PutMapping("/{terminalId}") public ResponseEntity updateTerminal(@PathVariable long terminalId, @RequestBody TerminalDTO terminalDTO) { return ResponseEntity.ok(terminalService.update(terminalId, terminalDTO)); } @DeleteMapping("/{terminalId}") public ResponseEntity deleteTerminal(@PathVariable long terminalId) { terminalService.delete(terminalId); return ResponseEntity.noContent().build(); } }