View Javadoc
1   package fr.tiogars.chat.domains.task.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.chat.domains.task.models.Task;
9   import fr.tiogars.chat.domains.task.services.TaskFindAllService;
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 = "Tasks", description = "CRUD operations for the Task business object.")
21  @RestController
22  public class TasksListController {
23  
24      private final TaskFindAllService service;
25  
26      /**
27       * Creates the domain query endpoint.
28       *
29       * @param service domain record listing service
30       */
31      public TasksListController(TaskFindAllService 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 tasks", description = "Returns active tasks ordered by immutable code.")
41      @ApiResponses(value = {
42              @ApiResponse(responseCode = "200", description = "Records in the domain were returned.")
43      })
44      @GetMapping("/api/v1/task")
45      public List<Task> listTask() {
46          return service.findAll();
47      }
48  }