TA 역할 Spring 경계 smoke (role-ta-live-1522-001)
This commit is contained in:
parent
bc492baab3
commit
0a7b2d9a4f
1 changed files with 50 additions and 0 deletions
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.klaroworks.runtime.controller;
|
||||||
|
|
||||||
|
import com.klaroworks.runtime.dto.ApiResponse;
|
||||||
|
import com.klaroworks.runtime.dto.RoleCreateRequest;
|
||||||
|
import com.klaroworks.runtime.dto.RoleResponse;
|
||||||
|
import com.klaroworks.runtime.service.RoleMatrixService;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/v1/roles")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RoleMatrixController {
|
||||||
|
|
||||||
|
private final RoleMatrixService roleMatrixService;
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<ApiResponse<RoleResponse>> createRole(
|
||||||
|
@Valid @RequestBody RoleCreateRequest request) {
|
||||||
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
|
.body(ApiResponse.success(roleMatrixService.createRole(request)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ResponseEntity<ApiResponse<RoleResponse>> getRoleById(@PathVariable Long id) {
|
||||||
|
return ResponseEntity.ok(ApiResponse.success(roleMatrixService.getRoleById(id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public ResponseEntity<ApiResponse<List<RoleResponse>>> getAllRoles() {
|
||||||
|
return ResponseEntity.ok(ApiResponse.success(roleMatrixService.getAllRoles()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public ResponseEntity<ApiResponse<RoleResponse>> updateRole(
|
||||||
|
@PathVariable Long id,
|
||||||
|
@Valid @RequestBody RoleCreateRequest request) {
|
||||||
|
return ResponseEntity.ok(ApiResponse.success(roleMatrixService.updateRole(id, request)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ResponseEntity<Void> deleteRole(@PathVariable Long id) {
|
||||||
|
roleMatrixService.deleteRole(id);
|
||||||
|
return ResponseEntity.noContent().build();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue