Class ProfileController

java.lang.Object
com.alpaca.controller.ProfileController

@RestController @RequestMapping("/api/profiles") public class ProfileController extends Object
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 Details

  • 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 be null
      Returns:
      ResponseEntity containing the ProfileResponseDTO with status HttpStatus.OK
      Throws:
      NotFoundException - if no profile is found with the given id
    • save

      @PostMapping public org.springframework.http.ResponseEntity<ProfileResponseDTO> save(@Valid @RequestBody @Valid ProfileRequestDTO request)
      Creates a new profile.
      Parameters:
      request - the ProfileRequestDTO containing the profile's details; must not be null
      Returns:
      ResponseEntity containing the created ProfileResponseDTO with status HttpStatus.CREATED
      Throws:
      BadRequestException - if the request is null 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 - the ProfileRequestDTO containing the updated profile's details; must not be null
      id - the unique identifier of the profile to update; must not be null
      Returns:
      ResponseEntity containing the updated ProfileResponseDTO with status HttpStatus.OK
      Throws:
      NotFoundException - if no profile 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 profile identified by its unique identifier.
      Parameters:
      id - the unique identifier of the profile to delete; must not be null
      Returns:
      ResponseEntity with status HttpStatus.NO_CONTENT
      Throws:
      NotFoundException - if no profile is found with the given id
    • findAll

      @GetMapping public org.springframework.http.ResponseEntity<List<ProfileResponseDTO>> findAll()
      Retrieves all profiles.
      Returns:
      ResponseEntity containing a list of ProfileResponseDTO with status HttpStatus.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 be null
      Returns:
      ResponseEntity containing a PagedModel of ProfileResponseDTO with status HttpStatus.OK