View Javadoc
1   package fr.tiogars.inception.domains.domaintemplate.controllers;
2   
3   import java.util.List;
4   
5   import org.springframework.web.bind.annotation.GetMapping;
6   import org.springframework.web.bind.annotation.RestController;
7   
8   import fr.tiogars.inception.domains.domaintemplate.models.DomainTemplate;
9   import fr.tiogars.inception.domains.domaintemplate.services.DomainTemplateFindAllService;
10  import io.swagger.v3.oas.annotations.Operation;
11  import io.swagger.v3.oas.annotations.responses.ApiResponse;
12  import io.swagger.v3.oas.annotations.responses.ApiResponses;
13  import io.swagger.v3.oas.annotations.tags.Tag;
14  
15  /**
16   * Exposes the endpoint that lists records in a domain.
17   *
18   * @since 0.1.0
19   */
20  @Tag(name = "DomainTemplates", description = "CRUD operations for the DomainTemplate business object.")
21  @RestController
22  public class DomainTemplatesListController {
23  
24      private final DomainTemplateFindAllService service;
25  
26      /**
27       * Creates the domain query endpoint.
28       *
29       * @param service domain record listing service
30       */
31      public DomainTemplatesListController(DomainTemplateFindAllService service) {
32          this.service = service;
33      }
34  
35      /**
36       * Lists all records.
37       *
38       * @return matching records ordered by key and version
39       */
40      @Operation(summary = "List records in a domain", description = "Returns all record versions stored in the supplied domain, ordered by key and version.")
41      @ApiResponses(value = {
42              @ApiResponse(responseCode = "200", description = "Records in the domain were returned.")
43      })
44      @GetMapping("/api/v1/domaintemplate")
45      public List<DomainTemplate> listDomainTemplate() {
46          return service.findAll();
47      }
48  }