Package com.alpaca.controller
Class ProfileController
java.lang.Object
com.alpaca.controller.ProfileController
REST controller for managing
Profile
entities.
Provides endpoints for CRUD operations and pagination of profiles. Utilizes IProfileService
for business logic and IProfileMapper
for DTO conversions.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<Void> Deletes a profile identified by its unique identifier.org.springframework.http.ResponseEntity
<List<ProfileResponseDTO>> findAll()
Retrieves all profiles.org.springframework.http.ResponseEntity
<org.springframework.data.web.PagedModel<ProfileResponseDTO>> findAllPage
(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list of profiles.org.springframework.http.ResponseEntity
<ProfileResponseDTO> Retrieves a profile by its unique identifier.org.springframework.http.ResponseEntity
<ProfileResponseDTO> save
(@Valid ProfileRequestDTO request) Creates a new profile.org.springframework.http.ResponseEntity
<ProfileResponseDTO> updateById
(@Valid ProfileRequestDTO request, UUID id) Updates an existing profile identified by its unique identifier.
-
Field Details
-
service
-
mapper
-
-
Constructor Details
-
ProfileController
public ProfileController()
-
-
Method Details
-
findById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<ProfileResponseDTO> findById(@PathVariable UUID id) Retrieves a profile by its unique identifier.- Parameters:
id
- the unique identifier of the profile; must not benull
- Returns:
ResponseEntity
containing theProfileResponseDTO
with statusHttpStatus.OK
- Throws:
NotFoundException
- if no profile is found with the givenid
-
save
@PostMapping public org.springframework.http.ResponseEntity<ProfileResponseDTO> save(@Valid @RequestBody @Valid ProfileRequestDTO request) Creates a new profile.- Parameters:
request
- theProfileRequestDTO
containing the profile's details; must not benull
- Returns:
ResponseEntity
containing the createdProfileResponseDTO
with statusHttpStatus.CREATED
- Throws:
BadRequestException
- if therequest
isnull
or contains invalid data
-
updateById
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<ProfileResponseDTO> updateById(@Valid @RequestBody @Valid ProfileRequestDTO request, @PathVariable UUID id) Updates an existing profile identified by its unique identifier.- Parameters:
request
- theProfileRequestDTO
containing the updated profile's details; must not benull
id
- the unique identifier of the profile to update; must not benull
- Returns:
ResponseEntity
containing the updatedProfileResponseDTO
with statusHttpStatus.OK
- Throws:
NotFoundException
- if no profile is found with the givenid
BadRequestException
- if therequest
isnull
or contains invalid data
-
delete
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> delete(@PathVariable UUID id) Deletes a profile identified by its unique identifier.- Parameters:
id
- the unique identifier of the profile to delete; must not benull
- Returns:
ResponseEntity
with statusHttpStatus.NO_CONTENT
- Throws:
NotFoundException
- if no profile is found with the givenid
-
findAll
Retrieves all profiles.- Returns:
ResponseEntity
containing a list ofProfileResponseDTO
with statusHttpStatus.OK
-
findAllPage
@GetMapping("/page") public org.springframework.http.ResponseEntity<org.springframework.data.web.PagedModel<ProfileResponseDTO>> findAllPage(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list of profiles.- Parameters:
pageable
- the pagination information; must not benull
- Returns:
ResponseEntity
containing aPagedModel
ofProfileResponseDTO
with statusHttpStatus.OK
-