Class PermissionController

java.lang.Object
com.alpaca.controller.PermissionController

@RestController @RequestMapping("/api/permissions") public class PermissionController extends Object
REST controller for managing Permission entities.

Provides endpoints for CRUD operations and pagination of permissions. Utilizes IPermissionService for business logic and IPermissionMapper for DTO conversions.

See Also:
  • Field Details

  • Constructor Details

    • PermissionController

      public PermissionController()
  • Method Details

    • findById

      @GetMapping("/{id}") public org.springframework.http.ResponseEntity<PermissionResponseDTO> findById(@PathVariable UUID id)
      Retrieves a PermissionResponseDTO by its unique identifier.
      Parameters:
      id - the unique identifier of the permission; must not be null
      Returns:
      ResponseEntity containing the PermissionResponseDTO with status HttpStatus.OK
      Throws:
      NotFoundException - if no permission is found with the given id
    • save

      @PostMapping public org.springframework.http.ResponseEntity<PermissionResponseDTO> save(@Valid @RequestBody @Valid PermissionRequestDTO request)
      Creates a new Permission.
      Parameters:
      request - the PermissionRequestDTO containing the permission's details; must not be null
      Returns:
      ResponseEntity containing the created PermissionResponseDTO with status HttpStatus.CREATED
      Throws:
      BadRequestException - if the request is null or contains invalid data
    • updateById

      @PutMapping("/{id}") public org.springframework.http.ResponseEntity<PermissionResponseDTO> updateById(@Valid @RequestBody @Valid PermissionRequestDTO request, @PathVariable UUID id)
      Updates an existing Permission identified by its unique identifier.
      Parameters:
      request - the PermissionRequestDTO containing the updated permission's details; must not be null
      id - the unique identifier of the permission to update; must not be null
      Returns:
      ResponseEntity containing the updated PermissionResponseDTO with status HttpStatus.OK
      Throws:
      NotFoundException - if no permission is found with the given id
      BadRequestException - if the request is null or contains invalid data
    • delete

      @DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> delete(@PathVariable UUID id)
      Deletes a Permission identified by its unique identifier.
      Parameters:
      id - the unique identifier of the permission to delete; must not be null
      Returns:
      ResponseEntity with status HttpStatus.NO_CONTENT
      Throws:
      NotFoundException - if no permission is found with the given id
    • findAll

      @GetMapping public org.springframework.http.ResponseEntity<List<PermissionResponseDTO>> findAll()
      Retrieves all PermissionResponseDTO entities.
      Returns:
      ResponseEntity containing a list of PermissionResponseDTO with status HttpStatus.OK
    • findAllPage

      @GetMapping("/page") public org.springframework.http.ResponseEntity<org.springframework.data.web.PagedModel<PermissionResponseDTO>> findAllPage(org.springframework.data.domain.Pageable pageable)
      Retrieves a paginated list of PermissionResponseDTO entities.
      Parameters:
      pageable - the pagination information; must not be null
      Returns:
      ResponseEntity containing a PagedModel of PermissionResponseDTO with status HttpStatus.OK