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 IAdvertiserMapper
private 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:
ResponseEntity
containing theAdvertiserResponseDTO
with 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
- theAdvertiserRequestDTO
containing the advertiser's details; must not benull
- Returns:
ResponseEntity
containing the createdAdvertiserResponseDTO
with statusHttpStatus.CREATED
- Throws:
BadRequestException
- if therequest
isnull
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
- theAdvertiserRequestDTO
containing the updated advertiser's details; must not benull
id
- the unique identifier of the advertiser to update; must not benull
- Returns:
ResponseEntity
containing the updatedAdvertiserResponseDTO
with statusHttpStatus.OK
- Throws:
NotFoundException
- if no advertiser 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 an advertiser identified by its unique identifier.- Parameters:
id
- the unique identifier of the advertiser to delete; must not benull
- Returns:
ResponseEntity
with statusHttpStatus.NO_CONTENT
- Throws:
NotFoundException
- if no advertiser is found with the givenid
-
findAll
Retrieves all advertisers.- Returns:
ResponseEntity
containing a list ofAdvertiserResponseDTO
with 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:
ResponseEntity
containing aPagedModel
ofAdvertiserResponseDTO
with statusHttpStatus.OK
-