From cf6e3b3ccfe617521c63367b40b09366e0dfb5a9 Mon Sep 17 00:00:00 2001
From: Jan Tymel <410388@mail.muni.cz>
Date: Sat, 6 Feb 2021 11:38:20 +0100
Subject: [PATCH] Unify type of estimatedDuration of TrainingPhase, minor fix
 in swagger

Related to #3
---
 .../example/demo/controller/TasksController.java | 16 ++++++++--------
 .../com/example/demo/domain/TrainingPhase.java   |  6 +++---
 .../com/example/demo/dto/TrainingPhaseDto.java   |  6 +++---
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/example/demo/controller/TasksController.java b/src/main/java/com/example/demo/controller/TasksController.java
index 6700e5f4..cf839d63 100644
--- a/src/main/java/com/example/demo/controller/TasksController.java
+++ b/src/main/java/com/example/demo/controller/TasksController.java
@@ -41,7 +41,7 @@ public class TasksController {
 
     @ApiOperation(httpMethod = "POST",
             value = "Create a new task in a phase",
-            notes = "Creates a new default task in a specified game phase",
+            notes = "Creates a new default task in a specified training phase",
             response = TaskDto.class,
             nickname = "createTask",
             produces = MediaType.APPLICATION_JSON_VALUE
@@ -54,7 +54,7 @@ public class TasksController {
     public ResponseEntity<TaskDto> createTask(
             @ApiParam(value = "Training definition ID", required = true)
             @PathVariable(name = "definitionId") Long definitionId,
-            @ApiParam(value = "Game phase ID", required = true)
+            @ApiParam(value = "Training phase ID", required = true)
             @PathVariable(name = "phaseId") Long phaseId) {
 
         TaskDto createdTask = taskService.createDefaultTask(definitionId, phaseId);
@@ -63,7 +63,7 @@ public class TasksController {
     }
 
     @ApiOperation(httpMethod = "POST",
-            value = "Clone task inside of the game phase",
+            value = "Clone task inside of the training phase",
             notes = "Creates a new task with the same properties as the specified task (pattern)",
             response = TaskDto.class,
             nickname = "cloneTask",
@@ -77,7 +77,7 @@ public class TasksController {
     public ResponseEntity<TaskDto> cloneTask(
             @ApiParam(value = "Training definition ID", required = true)
             @PathVariable(name = "definitionId") Long definitionId,
-            @ApiParam(value = "Game phase ID", required = true)
+            @ApiParam(value = "Training phase ID", required = true)
             @PathVariable(name = "phaseId") Long phaseId,
             @ApiParam(value = "Task ID", required = true)
             @PathVariable(name = "taskId") Long taskId) {
@@ -89,7 +89,7 @@ public class TasksController {
 
     @ApiOperation(httpMethod = "GET",
             value = "Get tasks",
-            notes = "Get tasks detail associated with the specified game phase",
+            notes = "Get tasks detail associated with the specified training phase",
             response = TaskDto.class,
             nickname = "getTask",
             produces = MediaType.APPLICATION_JSON_VALUE
@@ -102,7 +102,7 @@ public class TasksController {
     public ResponseEntity<TaskDto> getTask(
             @ApiParam(value = "Training definition ID", required = true)
             @PathVariable(name = "definitionId") Long definitionId,
-            @ApiParam(value = "Game phase ID", required = true)
+            @ApiParam(value = "Training phase ID", required = true)
             @PathVariable(name = "phaseId") Long phaseId,
             @ApiParam(value = "Task ID", required = true)
             @PathVariable(name = "taskId") Long taskId) {
@@ -126,7 +126,7 @@ public class TasksController {
     public ResponseEntity<TaskDto> updateTask(
             @ApiParam(value = "Training definition ID", required = true)
             @PathVariable(name = "definitionId") Long definitionId,
-            @ApiParam(value = "Game phase ID", required = true)
+            @ApiParam(value = "Training phase ID", required = true)
             @PathVariable(name = "phaseId") Long phaseId,
             @ApiParam(value = "Task ID", required = true)
             @PathVariable(name = "taskId") Long taskId,
@@ -153,7 +153,7 @@ public class TasksController {
     public ResponseEntity<Void> removeTask(
             @ApiParam(value = "Training definition ID", required = true)
             @PathVariable(name = "definitionId") Long definitionId,
-            @ApiParam(value = "Game phase ID", required = true)
+            @ApiParam(value = "Training phase ID", required = true)
             @PathVariable(name = "phaseId") Long phaseId,
             @ApiParam(value = "Task ID", required = true)
             @PathVariable(name = "taskId") Long taskId) {
diff --git a/src/main/java/com/example/demo/domain/TrainingPhase.java b/src/main/java/com/example/demo/domain/TrainingPhase.java
index fa488c0d..9e91ba8c 100644
--- a/src/main/java/com/example/demo/domain/TrainingPhase.java
+++ b/src/main/java/com/example/demo/domain/TrainingPhase.java
@@ -11,7 +11,7 @@ import java.util.List;
 @Entity
 public class TrainingPhase extends AbstractPhase {
 
-    private String estimatedDuration;
+    private int estimatedDuration;
     private int allowedCommands;
     private int allowedWrongFlags;
 
@@ -27,11 +27,11 @@ public class TrainingPhase extends AbstractPhase {
     @OneToMany(mappedBy = "relatedTrainingPhase", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
     private List<QuestionPhaseRelation> questionPhaseRelations = new ArrayList<>();
 
-    public String getEstimatedDuration() {
+    public int getEstimatedDuration() {
         return estimatedDuration;
     }
 
-    public void setEstimatedDuration(String estimatedDuration) {
+    public void setEstimatedDuration(int estimatedDuration) {
         this.estimatedDuration = estimatedDuration;
     }
 
diff --git a/src/main/java/com/example/demo/dto/TrainingPhaseDto.java b/src/main/java/com/example/demo/dto/TrainingPhaseDto.java
index 1da9d511..c81bcf72 100644
--- a/src/main/java/com/example/demo/dto/TrainingPhaseDto.java
+++ b/src/main/java/com/example/demo/dto/TrainingPhaseDto.java
@@ -5,18 +5,18 @@ import java.util.List;
 
 public class TrainingPhaseDto extends AbstractPhaseDto {
 
-    private String estimatedDuration;
+    private int estimatedDuration;
     private int allowedCommands;
     private int allowedWrongFlags;
     private List<TaskDto> tasks = new ArrayList<>();
 
     private List<DecisionMatrixRowDto> decisionMatrix;
 
-    public String getEstimatedDuration() {
+    public int getEstimatedDuration() {
         return estimatedDuration;
     }
 
-    public void setEstimatedDuration(String estimatedDuration) {
+    public void setEstimatedDuration(int estimatedDuration) {
         this.estimatedDuration = estimatedDuration;
     }
 
-- 
GitLab