Class AdvertiserController

java.lang.Object
com.alpaca.controller.AdvertiserController

@RestController @RequestMapping("/api/advertisers") public class AdvertiserController extends Object
REST controller for managing Advertiser entities.

Provides endpoints for CRUD operations and pagination of advertisers. Utilizes IAdvertiserService for business logic and IAdvertiserMapper for DTO conversions.

See Also:
  • Field Details

  • Constructor Details

    • AdvertiserController

      public AdvertiserController()
  • Method Details

    • findById

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

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

      @PutMapping("/{id}") public org.springframework.http.ResponseEntity<AdvertiserResponseDTO> updateById(@Valid @RequestBody @Valid AdvertiserRequestDTO request, @PathVariable UUID id)
      Updates an existing advertiser identified by its unique identifier.
      Parameters:
      request - the AdvertiserRequestDTO containing the updated advertiser's details; must not be null
      id - the unique identifier of the advertiser to update; must not be null
      Returns:
      ResponseEntity containing the updated AdvertiserResponseDTO with status HttpStatus.OK
      Throws:
      NotFoundException - if no advertiser 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 an advertiser identified by its unique identifier.
      Parameters:
      id - the unique identifier of the advertiser to delete; must not be null
      Returns:
      ResponseEntity with status HttpStatus.NO_CONTENT
      Throws:
      NotFoundException - if no advertiser is found with the given id
    • findAll

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

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