View Javadoc
1   package fr.tiogars.domaintemplate.domains.auth.role.controllers;
2   
3   import java.util.List;
4   
5   import org.springframework.web.bind.annotation.GetMapping;
6   import org.springframework.web.bind.annotation.RestController;
7   
8   import fr.tiogars.domaintemplate.domains.auth.role.entities.Role;
9   import fr.tiogars.domaintemplate.domains.auth.role.services.RoleService;
10  import io.swagger.v3.oas.annotations.Operation;
11  import io.swagger.v3.oas.annotations.security.SecurityRequirement;
12  import io.swagger.v3.oas.annotations.tags.Tag;
13  
14  /** Exposes the endpoint that lists roles. */
15  @Tag(name = "Roles", description = "Role management operations.")
16  @RestController
17  public class RolesListController {
18  
19      private final RoleService service;
20  
21      RolesListController(RoleService service) {
22          this.service = service;
23      }
24  
25      @Operation(summary = "List roles")
26      @SecurityRequirement(name = "bearerAuth")
27      @GetMapping("/api/v1/auth/roles")
28      List<Role> listRoles() {
29          return service.findAll();
30      }
31  }