1 package fr.tiogars.domaintemplate.domains.auth.role.controllers;
2
3 import org.springframework.http.ResponseEntity;
4 import org.springframework.web.bind.annotation.DeleteMapping;
5 import org.springframework.web.bind.annotation.PathVariable;
6 import org.springframework.web.bind.annotation.RestController;
7
8 import fr.tiogars.domaintemplate.domains.auth.role.services.RoleService;
9 import io.swagger.v3.oas.annotations.Operation;
10 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
11 import io.swagger.v3.oas.annotations.tags.Tag;
12
13
14 @Tag(name = "Roles", description = "Role management operations.")
15 @RestController
16 public class RoleDeleteController {
17
18 private final RoleService service;
19
20 RoleDeleteController(RoleService service) {
21 this.service = service;
22 }
23
24 @Operation(summary = "Delete a role")
25 @SecurityRequirement(name = "bearerAuth")
26 @DeleteMapping("/api/v1/auth/roles/{id}")
27 ResponseEntity<Void> deleteRole(@PathVariable Long id) {
28 return service.delete(id) ? ResponseEntity.noContent().build() : ResponseEntity.notFound().build();
29 }
30 }