Package com.alpaca.controller
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final IAdvertiserMapperprivate final IAdvertiserService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Void> Deletes an advertiser identified by its unique identifier.org.springframework.http.ResponseEntity<List<AdvertiserResponseDTO>> findAll()Retrieves all advertisers.org.springframework.http.ResponseEntity<org.springframework.data.web.PagedModel<AdvertiserResponseDTO>> findAllPage(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list of advertisers.org.springframework.http.ResponseEntity<AdvertiserResponseDTO> Retrieves an advertiser by its unique identifier.org.springframework.http.ResponseEntity<AdvertiserResponseDTO> save(@Valid AdvertiserRequestDTO request) Creates a new advertiser.org.springframework.http.ResponseEntity<AdvertiserResponseDTO> updateById(@Valid AdvertiserRequestDTO request, UUID id) Updates an existing advertiser identified by its unique identifier.
-
Field Details
-
service
-
mapper
-
-
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 benull- Returns:
ResponseEntitycontaining theAdvertiserResponseDTOwith statusHttpStatus.OK- Throws:
NotFoundException- if no advertiser is found with the givenid
-
save
@PostMapping public org.springframework.http.ResponseEntity<AdvertiserResponseDTO> save(@Valid @RequestBody @Valid AdvertiserRequestDTO request) Creates a new advertiser.- Parameters:
request- theAdvertiserRequestDTOcontaining the advertiser's details; must not benull- Returns:
ResponseEntitycontaining the createdAdvertiserResponseDTOwith statusHttpStatus.CREATED- Throws:
BadRequestException- if therequestisnullor 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- theAdvertiserRequestDTOcontaining the updated advertiser's details; must not benullid- the unique identifier of the advertiser to update; must not benull- Returns:
ResponseEntitycontaining the updatedAdvertiserResponseDTOwith statusHttpStatus.OK- Throws:
NotFoundException- if no advertiser is found with the givenidBadRequestException- if therequestisnullor 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 benull- Returns:
ResponseEntitywith statusHttpStatus.NO_CONTENT- Throws:
NotFoundException- if no advertiser is found with the givenid
-
findAll
Retrieves all advertisers.- Returns:
ResponseEntitycontaining a list ofAdvertiserResponseDTOwith statusHttpStatus.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 benull- Returns:
ResponseEntitycontaining aPagedModelofAdvertiserResponseDTOwith statusHttpStatus.OK
-