DomainTemplatesListController.java
package fr.tiogars.domaintemplate.domains.domaintemplate.controllers;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import fr.tiogars.domaintemplate.domains.domaintemplate.entities.DomainTemplate;
import fr.tiogars.domaintemplate.domains.domaintemplate.services.DomainTemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
* Exposes the endpoint that lists records in a domain.
*
* @since 0.1.0
*/
@Tag(name = "DomainTemplates", description = "CRUD operations for the DomainTemplate business object.")
@RestController
public class DomainTemplatesListController {
private final DomainTemplateService service;
/**
* Creates the domain query endpoint.
*
* @param service domain record service
*/
public DomainTemplatesListController(DomainTemplateService service) {
this.service = service;
}
/**
* Lists all records.
*
* @return matching records ordered by key and version
*/
@Operation(
summary = "List records in a domain",
description = "Returns all record versions stored in the supplied domain, ordered by key and version.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "Records in the domain were returned.")
})
@GetMapping("/api/v1/domaintemplate")
public List<DomainTemplate> listDomainTemplate() {
return service.findAll();
}
}