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:
ResponseEntitycontaining theProfileResponseDTOwith 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- theProfileRequestDTOcontaining the profile's details; must not benull- Returns:
ResponseEntitycontaining the createdProfileResponseDTOwith statusHttpStatus.CREATED- Throws:
BadRequestException- if therequestisnullor 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- theProfileRequestDTOcontaining the updated profile's details; must not benullid- the unique identifier of the profile to update; must not benull- Returns:
ResponseEntitycontaining the updatedProfileResponseDTOwith statusHttpStatus.OK- Throws:
NotFoundException- if no profile is found with the givenidBadRequestException- if therequestisnullor 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:
ResponseEntitywith statusHttpStatus.NO_CONTENT- Throws:
NotFoundException- if no profile is found with the givenid
-
findAll
Retrieves all profiles.- Returns:
ResponseEntitycontaining a list ofProfileResponseDTOwith 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:
ResponseEntitycontaining aPagedModelofProfileResponseDTOwith statusHttpStatus.OK
-