TA 역할 Spring 경계 smoke #6
1 changed files with 50 additions and 0 deletions
|
|
@ -0,0 +1,50 @@
|
|||
package com.klaroworks.runtime.rolematrix.controller;
|
||||
|
||||
import com.klaroworks.runtime.rolematrix.dto.CreateRoleMatrixCommand;
|
||||
import com.klaroworks.runtime.rolematrix.dto.RoleMatrixResponse;
|
||||
import com.klaroworks.runtime.rolematrix.dto.UpdateRoleMatrixCommand;
|
||||
import com.klaroworks.runtime.rolematrix.service.RoleMatrixService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 역할 매트릭스 REST 컨트롤러 - HTTP 요청/응답 변환, 입력 검증 */
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/role-matrices")
|
||||
public class RoleMatrixController {
|
||||
|
||||
private final RoleMatrixService roleMatrixService;
|
||||
|
||||
public RoleMatrixController(RoleMatrixService roleMatrixService) {
|
||||
this.roleMatrixService = roleMatrixService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<List<RoleMatrixResponse>> findAll() {
|
||||
return ResponseEntity.ok(roleMatrixService.findAll());
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public ResponseEntity<RoleMatrixResponse> findById(@PathVariable Long id) {
|
||||
return ResponseEntity.ok(roleMatrixService.findById(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<RoleMatrixResponse> create(@Valid @RequestBody CreateRoleMatrixCommand command) {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(roleMatrixService.create(command));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public ResponseEntity<RoleMatrixResponse> update(@PathVariable Long id, @Valid @RequestBody UpdateRoleMatrixCommand command) {
|
||||
return ResponseEntity.ok(roleMatrixService.update(id, command));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<Void> delete(@PathVariable Long id) {
|
||||
roleMatrixService.delete(id);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue