Package com.alpaca.controller
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final IPermissionMapperprivate final IPermissionService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Void> Deletes aPermissionidentified by its unique identifier.org.springframework.http.ResponseEntity<List<PermissionResponseDTO>> findAll()Retrieves allPermissionResponseDTOentities.org.springframework.http.ResponseEntity<org.springframework.data.web.PagedModel<PermissionResponseDTO>> findAllPage(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list ofPermissionResponseDTOentities.org.springframework.http.ResponseEntity<PermissionResponseDTO> Retrieves aPermissionResponseDTOby its unique identifier.org.springframework.http.ResponseEntity<PermissionResponseDTO> save(@Valid PermissionRequestDTO request) Creates a newPermission.org.springframework.http.ResponseEntity<PermissionResponseDTO> updateById(@Valid PermissionRequestDTO request, UUID id) Updates an existingPermissionidentified by its unique identifier.
-
Field Details
-
service
-
mapper
-
-
Constructor Details
-
PermissionController
public PermissionController()
-
-
Method Details
-
findById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<PermissionResponseDTO> findById(@PathVariable UUID id) Retrieves aPermissionResponseDTOby its unique identifier.- Parameters:
id- the unique identifier of the permission; must not benull- Returns:
ResponseEntitycontaining thePermissionResponseDTOwith statusHttpStatus.OK- Throws:
NotFoundException- if no permission is found with the givenid
-
save
@PostMapping public org.springframework.http.ResponseEntity<PermissionResponseDTO> save(@Valid @RequestBody @Valid PermissionRequestDTO request) Creates a newPermission.- Parameters:
request- thePermissionRequestDTOcontaining the permission's details; must not benull- Returns:
ResponseEntitycontaining the createdPermissionResponseDTOwith statusHttpStatus.CREATED- Throws:
BadRequestException- if therequestisnullor contains invalid data
-
updateById
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<PermissionResponseDTO> updateById(@Valid @RequestBody @Valid PermissionRequestDTO request, @PathVariable UUID id) Updates an existingPermissionidentified by its unique identifier.- Parameters:
request- thePermissionRequestDTOcontaining the updated permission's details; must not benullid- the unique identifier of the permission to update; must not benull- Returns:
ResponseEntitycontaining the updatedPermissionResponseDTOwith statusHttpStatus.OK- Throws:
NotFoundException- if no permission is found with the givenidBadRequestException- if therequestisnullor contains invalid data
-
delete
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> delete(@PathVariable UUID id) Deletes aPermissionidentified by its unique identifier.- Parameters:
id- the unique identifier of the permission to delete; must not benull- Returns:
ResponseEntitywith statusHttpStatus.NO_CONTENT- Throws:
NotFoundException- if no permission is found with the givenid
-
findAll
Retrieves allPermissionResponseDTOentities.- Returns:
ResponseEntitycontaining a list ofPermissionResponseDTOwith statusHttpStatus.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 ofPermissionResponseDTOentities.- Parameters:
pageable- the pagination information; must not benull- Returns:
ResponseEntitycontaining aPagedModelofPermissionResponseDTOwith statusHttpStatus.OK
-