Implement Backend Components for Creating Daily Taskseries
This commit is contained in:
parent
13df4ac6fa
commit
3f58fe3600
@ -41,7 +41,7 @@ public class ScheduleController {
|
|||||||
@GetMapping("/schedules/{taskID}")
|
@GetMapping("/schedules/{taskID}")
|
||||||
public ResponseEntity<?> loadAllSchedulesOfTask(@PathVariable long taskID) {
|
public ResponseEntity<?> loadAllSchedulesOfTask(@PathVariable long taskID) {
|
||||||
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class ScheduleController {
|
|||||||
|
|
||||||
private ResponseEntity<?> createAbstractSchedule(long taskID, ScheduleFieldInfo scheduleFieldInfo) {
|
private ResponseEntity<?> createAbstractSchedule(long taskID, ScheduleFieldInfo scheduleFieldInfo) {
|
||||||
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public class ScheduleController {
|
|||||||
|
|
||||||
private ResponseEntity<?> editAbstractSchedule(long scheduleID, ScheduleFieldInfo scheduleFieldInfo) {
|
private ResponseEntity<?> editAbstractSchedule(long scheduleID, ScheduleFieldInfo scheduleFieldInfo) {
|
||||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ public class ScheduleController {
|
|||||||
@DeleteMapping("/schedules/{scheduleID}")
|
@DeleteMapping("/schedules/{scheduleID}")
|
||||||
public ResponseEntity<?> deleteSchedule(@PathVariable long scheduleID) {
|
public ResponseEntity<?> deleteSchedule(@PathVariable long scheduleID) {
|
||||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ public class ScheduleController {
|
|||||||
@PostMapping("/schedules/{taskID}/now")
|
@PostMapping("/schedules/{taskID}/now")
|
||||||
public ResponseEntity<?> scheduleNow(@PathVariable long taskID) {
|
public ResponseEntity<?> scheduleNow(@PathVariable long taskID) {
|
||||||
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ public class ScheduleController {
|
|||||||
@PostMapping("/schedules/{scheduleID}/activate")
|
@PostMapping("/schedules/{scheduleID}/activate")
|
||||||
public ResponseEntity<?> activateSchedule(@PathVariable long scheduleID) {
|
public ResponseEntity<?> activateSchedule(@PathVariable long scheduleID) {
|
||||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ public class ScheduleController {
|
|||||||
@PostMapping("/schedules/{scheduleID}/stop/{finish}")
|
@PostMapping("/schedules/{scheduleID}/stop/{finish}")
|
||||||
public ResponseEntity<?> stopSchedule(@PathVariable long scheduleID, @PathVariable boolean finish) {
|
public ResponseEntity<?> stopSchedule(@PathVariable long scheduleID, @PathVariable boolean finish) {
|
||||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ public class ScheduleController {
|
|||||||
@PostMapping("/schedules/{taskID}/forgotten")
|
@PostMapping("/schedules/{taskID}/forgotten")
|
||||||
public ResponseEntity<?> registerForgottenSchedule(@PathVariable long taskID, @RequestBody @Valid ForgottenScheduleInfo forgottenScheduleInfo) {
|
public ResponseEntity<?> registerForgottenSchedule(@PathVariable long taskID, @RequestBody @Valid ForgottenScheduleInfo forgottenScheduleInfo) {
|
||||||
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ public class ScheduleController {
|
|||||||
List<PermissionResult<AbstractSchedule>> permissionResults = new ArrayList<>();
|
List<PermissionResult<AbstractSchedule>> permissionResults = new ArrayList<>();
|
||||||
for(long scheduleID: scheduleIDs) {
|
for(long scheduleID: scheduleIDs) {
|
||||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ public class ScheduleController {
|
|||||||
@GetMapping("/schedules/{scheduleID}/details")
|
@GetMapping("/schedules/{scheduleID}/details")
|
||||||
public ResponseEntity<?> loadScheduleDetails(@PathVariable long scheduleID) {
|
public ResponseEntity<?> loadScheduleDetails(@PathVariable long scheduleID) {
|
||||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ public class ScheduleController {
|
|||||||
@PostMapping("/schedules/{scheduleID}/stopManual")
|
@PostMapping("/schedules/{scheduleID}/stopManual")
|
||||||
public ResponseEntity<?> stopManual(@PathVariable long scheduleID, @Valid @RequestBody ManualScheduleStopInfo manualScheduleStopInfo) {
|
public ResponseEntity<?> stopManual(@PathVariable long scheduleID, @Valid @RequestBody ManualScheduleStopInfo manualScheduleStopInfo) {
|
||||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!permissionResult.isHasPermissions()) {
|
if(permissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,9 +3,7 @@ package core.api.controller;
|
|||||||
import core.api.models.auth.SimpleStatusResponse;
|
import core.api.models.auth.SimpleStatusResponse;
|
||||||
import core.api.models.timemanager.history.TaskgroupActivityInfo;
|
import core.api.models.timemanager.history.TaskgroupActivityInfo;
|
||||||
import core.api.models.timemanager.history.WorkingStatus;
|
import core.api.models.timemanager.history.WorkingStatus;
|
||||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
|
||||||
import core.entities.timemanager.AbstractSchedule;
|
import core.entities.timemanager.AbstractSchedule;
|
||||||
import core.entities.timemanager.Task;
|
|
||||||
import core.entities.timemanager.Taskgroup;
|
import core.entities.timemanager.Taskgroup;
|
||||||
import core.services.PermissionResult;
|
import core.services.PermissionResult;
|
||||||
import core.services.ServiceExitCode;
|
import core.services.ServiceExitCode;
|
||||||
@ -14,12 +12,10 @@ import core.services.TaskgroupService;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.parameters.P;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.time.*;
|
import java.time.*;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.TemporalAdjusters;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||||
@ -49,7 +45,7 @@ public class StatisticController {
|
|||||||
@GetMapping("/statistics/taskgroup-activity/{taskgroupID}/{startingDate}/{endingDate}/{includeSubTaskgroups}")
|
@GetMapping("/statistics/taskgroup-activity/{taskgroupID}/{startingDate}/{endingDate}/{includeSubTaskgroups}")
|
||||||
public ResponseEntity<?> getTaskgroupActivity(@PathVariable long taskgroupID, @PathVariable String startingDate, @PathVariable String endingDate, @PathVariable boolean includeSubTaskgroups){
|
public ResponseEntity<?> getTaskgroupActivity(@PathVariable long taskgroupID, @PathVariable String startingDate, @PathVariable String endingDate, @PathVariable boolean includeSubTaskgroups){
|
||||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
} else if(taskgroupPermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
|
} else if(taskgroupPermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
|
||||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||||
|
@ -64,7 +64,7 @@ public class TaskController {
|
|||||||
@GetMapping("/tasks/{taskgroupID}/{status}")
|
@GetMapping("/tasks/{taskgroupID}/{status}")
|
||||||
public ResponseEntity<?> listTasksOfTaskgroup(@PathVariable long taskgroupID, @PathVariable String status) {
|
public ResponseEntity<?> listTasksOfTaskgroup(@PathVariable long taskgroupID, @PathVariable String status) {
|
||||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ public class TaskController {
|
|||||||
@PutMapping("/tasks/{taskgroupID}")
|
@PutMapping("/tasks/{taskgroupID}")
|
||||||
public ResponseEntity<?> createTask(@PathVariable long taskgroupID, @RequestBody @Valid TaskFieldInfo taskFieldInfo) {
|
public ResponseEntity<?> createTask(@PathVariable long taskgroupID, @RequestBody @Valid TaskFieldInfo taskFieldInfo) {
|
||||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public class TaskController {
|
|||||||
@PostMapping("/tasks/{taskID}")
|
@PostMapping("/tasks/{taskID}")
|
||||||
public ResponseEntity<?> editTask(@PathVariable long taskID, @RequestBody @Valid TaskFieldInfo taskFieldInfo) {
|
public ResponseEntity<?> editTask(@PathVariable long taskID, @RequestBody @Valid TaskFieldInfo taskFieldInfo) {
|
||||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if (!taskPermissionResult.isHasPermissions()) {
|
if (taskPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ public class TaskController {
|
|||||||
@DeleteMapping("/tasks/{taskID}")
|
@DeleteMapping("/tasks/{taskID}")
|
||||||
public ResponseEntity<?> deleteTask(@PathVariable long taskID) {
|
public ResponseEntity<?> deleteTask(@PathVariable long taskID) {
|
||||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if (!taskPermissionResult.isHasPermissions()) {
|
if (taskPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ public class TaskController {
|
|||||||
@GetMapping("/tasks/{taskID}")
|
@GetMapping("/tasks/{taskID}")
|
||||||
public ResponseEntity<?> loadTaskDetails(@PathVariable long taskID) {
|
public ResponseEntity<?> loadTaskDetails(@PathVariable long taskID) {
|
||||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if (!taskPermissionResult.isHasPermissions()) {
|
if (taskPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public class TaskController {
|
|||||||
@PostMapping("/tasks/{taskID}/finish")
|
@PostMapping("/tasks/{taskID}/finish")
|
||||||
public ResponseEntity<?> finishTask(@PathVariable long taskID) {
|
public ResponseEntity<?> finishTask(@PathVariable long taskID) {
|
||||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if (!taskPermissionResult.isHasPermissions()) {
|
if (taskPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package core.api.controller;
|
||||||
|
|
||||||
|
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatDayInfo;
|
||||||
|
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatWeekInfo;
|
||||||
|
import core.services.ServiceExitCode;
|
||||||
|
import core.services.ServiceResult;
|
||||||
|
import core.services.TaskSeriesService;
|
||||||
|
import core.services.TaskService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class TaskSeriesController {
|
||||||
|
|
||||||
|
@Autowired private TaskService taskService;
|
||||||
|
@Autowired private TaskSeriesService taskSeriesService;
|
||||||
|
|
||||||
|
@PostMapping("/tasks/{taskID}/taskseries/weekly")
|
||||||
|
public ResponseEntity<?> onCreateTaskSeries(@PathVariable long taskID, @Valid @RequestBody TaskRepeatWeekInfo taskRepeatWeekInfo) {
|
||||||
|
var taskPermission = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
|
if(taskPermission.hasIssue()) {
|
||||||
|
return taskPermission.mapToResponseEntity();
|
||||||
|
} else {
|
||||||
|
ServiceExitCode serviceExitCode = taskSeriesService.createTaskSeries(taskPermission.getResult(), taskRepeatWeekInfo);
|
||||||
|
return serviceExitCode.mapToResponseEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/tasks/{taskID}/taskseries/daily")
|
||||||
|
public ResponseEntity<?> onCreateTaskSeries(@PathVariable long taskID, @Valid @RequestBody TaskRepeatDayInfo taskRepeatDayInfo) {
|
||||||
|
var taskPermission = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
|
if(taskPermission.hasIssue()) {
|
||||||
|
return taskPermission.mapToResponseEntity();
|
||||||
|
} else {
|
||||||
|
ServiceExitCode serviceExitCode = taskSeriesService.createTaskSeries(taskPermission.getResult(), taskRepeatDayInfo);
|
||||||
|
return serviceExitCode.mapToResponseEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||||
@RestController
|
@RestController
|
||||||
@ -40,7 +39,7 @@ public class TaskgroupController {
|
|||||||
@PostMapping("/taskgroups/{taskgroupID}")
|
@PostMapping("/taskgroups/{taskgroupID}")
|
||||||
public ResponseEntity<?> editTaskgroup(@PathVariable long taskgroupID, @Valid @RequestBody TaskgroupFieldInfo taskgroupFieldInfo) {
|
public ResponseEntity<?> editTaskgroup(@PathVariable long taskgroupID, @Valid @RequestBody TaskgroupFieldInfo taskgroupFieldInfo) {
|
||||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ public class TaskgroupController {
|
|||||||
@DeleteMapping("/taskgroups/{taskgroupID}")
|
@DeleteMapping("/taskgroups/{taskgroupID}")
|
||||||
public ResponseEntity<?> deleteTaskgroup(@PathVariable long taskgroupID) {
|
public ResponseEntity<?> deleteTaskgroup(@PathVariable long taskgroupID) {
|
||||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if (!taskgroupPermissionResult.isHasPermissions()) {
|
if (taskgroupPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +87,7 @@ public class TaskgroupController {
|
|||||||
@GetMapping("/taskgroups/{taskgroupID}")
|
@GetMapping("/taskgroups/{taskgroupID}")
|
||||||
public ResponseEntity<?> getDetails(@PathVariable long taskgroupID) {
|
public ResponseEntity<?> getDetails(@PathVariable long taskgroupID) {
|
||||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +101,7 @@ public class TaskgroupController {
|
|||||||
@DeleteMapping("/taskgroups/{taskgroupID}/clear")
|
@DeleteMapping("/taskgroups/{taskgroupID}/clear")
|
||||||
public ResponseEntity<?> clearTasks(@PathVariable long taskgroupID) {
|
public ResponseEntity<?> clearTasks(@PathVariable long taskgroupID) {
|
||||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||||
if (!taskgroupPermissionResult.isHasPermissions()) {
|
if (taskgroupPermissionResult.isNoPermissions()) {
|
||||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||||
|
|
||||||
|
public enum DeadlineStrategy {
|
||||||
|
|
||||||
|
FIX_DEADLINE,
|
||||||
|
DEADLINE_EQUAL_START,
|
||||||
|
DEADLINE_FIT_START
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
public class TaskRepeatDayInfo {
|
||||||
|
|
||||||
|
private int offset;
|
||||||
|
private DeadlineStrategy deadlineStrategy;
|
||||||
|
|
||||||
|
private LocalDate endDate;
|
||||||
|
|
||||||
|
public int getOffset() {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffset(int offset) {
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeadlineStrategy getDeadlineStrategy() {
|
||||||
|
return deadlineStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeadlineStrategy(DeadlineStrategy deadlineStrategy) {
|
||||||
|
this.deadlineStrategy = deadlineStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(LocalDate endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||||
|
|
||||||
|
public class TaskRepeatWeekDayInfo {
|
||||||
|
|
||||||
|
private int weekday;
|
||||||
|
private int offset;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TaskRepeatWeekInfo {
|
||||||
|
|
||||||
|
@Length(min = 1, max = 7)
|
||||||
|
private List<TaskRepeatWeekDayInfo> weekDayInfos;
|
||||||
|
|
||||||
|
private DeadlineStrategy deadlineStrategy;
|
||||||
|
|
||||||
|
private LocalDate endDate;
|
||||||
|
|
||||||
|
public List<TaskRepeatWeekDayInfo> getWeekDayInfos() {
|
||||||
|
return weekDayInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeekDayInfos(List<TaskRepeatWeekDayInfo> weekDayInfos) {
|
||||||
|
this.weekDayInfos = weekDayInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeadlineStrategy getDeadlineStrategy() {
|
||||||
|
return deadlineStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeadlineStrategy(DeadlineStrategy deadlineStrategy) {
|
||||||
|
this.deadlineStrategy = deadlineStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(LocalDate endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
}
|
@ -22,21 +22,17 @@ public class Task {
|
|||||||
@JoinColumn(name = "taskgroup_id")
|
@JoinColumn(name = "taskgroup_id")
|
||||||
private Taskgroup taskgroup;
|
private Taskgroup taskgroup;
|
||||||
private String taskName;
|
private String taskName;
|
||||||
|
|
||||||
private LocalDate startDate;
|
private LocalDate startDate;
|
||||||
|
|
||||||
private LocalDate deadline;
|
private LocalDate deadline;
|
||||||
|
|
||||||
private int eta;
|
private int eta;
|
||||||
|
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
|
||||||
private boolean finishable;
|
private boolean finishable;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "task", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
@OneToMany(mappedBy = "task", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||||
private List<AbstractSchedule> basicTaskSchedules;
|
private List<AbstractSchedule> basicTaskSchedules;
|
||||||
|
|
||||||
private int workTime;
|
private int workTime;
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(referencedColumnName = "taskSerieID")
|
||||||
|
private TaskSerie taskSerie;
|
||||||
|
|
||||||
public Task() {
|
public Task() {
|
||||||
this.basicTaskSchedules = new ArrayList<>();
|
this.basicTaskSchedules = new ArrayList<>();
|
||||||
@ -52,6 +48,17 @@ public class Task {
|
|||||||
this.finishable = taskFieldInfo.isFinishable();
|
this.finishable = taskFieldInfo.isFinishable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Task cloneTask(Task task) {
|
||||||
|
Task clonedTask = new Task();
|
||||||
|
clonedTask.setTaskgroup(task.getTaskgroup());
|
||||||
|
clonedTask.setTaskName(task.taskName);
|
||||||
|
clonedTask.setEta(task.eta);
|
||||||
|
clonedTask.setFinished(false);
|
||||||
|
clonedTask.setFinishable(task.finishable);
|
||||||
|
return clonedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public long getTaskID() {
|
public long getTaskID() {
|
||||||
return taskID;
|
return taskID;
|
||||||
}
|
}
|
||||||
@ -124,6 +131,14 @@ public class Task {
|
|||||||
this.taskID = taskID;
|
this.taskID = taskID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TaskSerie getTaskSerie() {
|
||||||
|
return taskSerie;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskSerie(TaskSerie taskSerie) {
|
||||||
|
this.taskSerie = taskSerie;
|
||||||
|
}
|
||||||
|
|
||||||
public List<AbstractSchedule> getBasicTaskSchedules() {
|
public List<AbstractSchedule> getBasicTaskSchedules() {
|
||||||
if(basicTaskSchedules == null) {
|
if(basicTaskSchedules == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package core.entities.timemanager;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "task_series")
|
||||||
|
public class TaskSerie {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long taskSerieID;
|
||||||
|
|
||||||
|
@OneToMany(orphanRemoval = false, cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "taskSerie")
|
||||||
|
List<Task> tasks = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public long getTaskSerieID() {
|
||||||
|
return taskSerieID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Task> getTasks() {
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTasks(List<Task> tasks) {
|
||||||
|
this.tasks = tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTask(Task task) {
|
||||||
|
this.tasks.add(task);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package core.repositories.timemanager;
|
||||||
|
|
||||||
|
import core.entities.timemanager.TaskSerie;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface TaskSeriesRepository extends CrudRepository<TaskSerie, Long> {
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package core.services;
|
package core.services;
|
||||||
|
|
||||||
|
import core.api.models.auth.SimpleStatusResponse;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
public class PermissionResult <T> extends ServiceResult<T> {
|
public class PermissionResult <T> extends ServiceResult<T> {
|
||||||
|
|
||||||
private boolean hasPermissions;
|
private boolean hasPermissions;
|
||||||
@ -30,11 +33,25 @@ public class PermissionResult <T> extends ServiceResult<T> {
|
|||||||
this.hasPermissions = hasPermissions;
|
this.hasPermissions = hasPermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHasPermissions() {
|
public boolean isNoPermissions() {
|
||||||
return hasPermissions;
|
return !hasPermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasPermissions(boolean hasPermissions) {
|
public void setHasPermissions(boolean hasPermissions) {
|
||||||
this.hasPermissions = hasPermissions;
|
this.hasPermissions = hasPermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<?> mapToResponseEntity() {
|
||||||
|
if(isNoPermissions()) {
|
||||||
|
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||||
|
} else {
|
||||||
|
return super.mapToResponseEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasIssue() {
|
||||||
|
return super.hasIssue() || isNoPermissions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package core.services;
|
package core.services;
|
||||||
|
|
||||||
|
import core.api.models.auth.SimpleStatusResponse;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
public enum ServiceExitCode {
|
public enum ServiceExitCode {
|
||||||
|
|
||||||
OK,
|
OK,
|
||||||
@ -7,4 +10,13 @@ public enum ServiceExitCode {
|
|||||||
MISSING_ENTITY,
|
MISSING_ENTITY,
|
||||||
INVALID_OPERATION,
|
INVALID_OPERATION,
|
||||||
INVALID_PARAMETER;
|
INVALID_PARAMETER;
|
||||||
|
|
||||||
|
public ResponseEntity<SimpleStatusResponse> mapToResponseEntity() {
|
||||||
|
return switch (this) {
|
||||||
|
case OK -> ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||||
|
case MISSING_ENTITY -> ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||||
|
case ENTITY_ALREADY_EXIST -> ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
|
||||||
|
case INVALID_OPERATION, INVALID_PARAMETER -> ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package core.services;
|
package core.services;
|
||||||
|
|
||||||
|
import core.api.models.auth.SimpleStatusResponse;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
public class ServiceResult <T> {
|
public class ServiceResult <T> {
|
||||||
|
|
||||||
private ServiceExitCode exitCode;
|
private ServiceExitCode exitCode;
|
||||||
@ -34,4 +37,12 @@ public class ServiceResult <T> {
|
|||||||
public void setResult(T result) {
|
public void setResult(T result) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasIssue() {
|
||||||
|
return exitCode != ServiceExitCode.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<?> mapToResponseEntity() {
|
||||||
|
return exitCode.mapToResponseEntity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
59
backend/src/main/java/core/services/TaskSeriesService.java
Normal file
59
backend/src/main/java/core/services/TaskSeriesService.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package core.services;
|
||||||
|
|
||||||
|
import core.api.models.timemanager.tasks.repeatinginfo.DeadlineStrategy;
|
||||||
|
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatDayInfo;
|
||||||
|
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatWeekInfo;
|
||||||
|
import core.entities.timemanager.Task;
|
||||||
|
import core.entities.timemanager.TaskSerie;
|
||||||
|
import core.repositories.timemanager.TaskRepository;
|
||||||
|
import core.repositories.timemanager.TaskSeriesRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TaskSeriesService {
|
||||||
|
|
||||||
|
@Autowired private TaskRepository taskRepository;
|
||||||
|
@Autowired private TaskSeriesRepository taskSeriesRepository;
|
||||||
|
|
||||||
|
public ServiceExitCode createTaskSeries(Task rootTask, TaskRepeatWeekInfo taskRepeatInfo) {
|
||||||
|
return ServiceExitCode.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceExitCode createTaskSeries(Task rootTask, TaskRepeatDayInfo taskRepeatInfo) {
|
||||||
|
if(taskRepeatInfo.getDeadlineStrategy() == DeadlineStrategy.FIX_DEADLINE) {
|
||||||
|
return ServiceExitCode.INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalDate currentTaskDate = rootTask.getStartDate().plusDays(taskRepeatInfo.getOffset());
|
||||||
|
TaskSerie taskSerie = new TaskSerie();
|
||||||
|
int index = 1;
|
||||||
|
while(currentTaskDate.isBefore(taskRepeatInfo.getEndDate())) {
|
||||||
|
Task task = Task.cloneTask(rootTask);
|
||||||
|
task.setStartDate(currentTaskDate);
|
||||||
|
if(taskRepeatInfo.getDeadlineStrategy() == DeadlineStrategy.DEADLINE_EQUAL_START) {
|
||||||
|
task.setDeadline(currentTaskDate);
|
||||||
|
} else if(taskRepeatInfo.getDeadlineStrategy() == DeadlineStrategy.DEADLINE_FIT_START) {
|
||||||
|
task.setDeadline(currentTaskDate.plusDays(taskRepeatInfo.getOffset()-1));
|
||||||
|
}
|
||||||
|
taskSerie.addTask(task);
|
||||||
|
task.setTaskSerie(taskSerie);
|
||||||
|
task.setTaskName(task.getTaskName().replace("${i}", convertIndexToString(index)));
|
||||||
|
currentTaskDate = currentTaskDate.plusDays(taskRepeatInfo.getOffset());
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
taskRepository.saveAll(taskSerie.getTasks());
|
||||||
|
return ServiceExitCode.OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertIndexToString(int index) {
|
||||||
|
if(index < 10) {
|
||||||
|
return "0" + index;
|
||||||
|
} else {
|
||||||
|
return String.valueOf(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
62
openapi.yaml
62
openapi.yaml
@ -2073,6 +2073,52 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/SimpleStatusResponse'
|
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||||
|
/tasks/{taskID}/taskseries/daily:
|
||||||
|
post:
|
||||||
|
security:
|
||||||
|
- API_TOKEN: []
|
||||||
|
tags:
|
||||||
|
- taskseries
|
||||||
|
description: Creates a daily repeating task
|
||||||
|
summary: daily repeating task creation
|
||||||
|
parameters:
|
||||||
|
- name: taskID
|
||||||
|
in: path
|
||||||
|
description: internal id of taskgroup
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: number
|
||||||
|
example: 1
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TaskRepeatDayInfo'
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: Operation successfull
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||||
|
403:
|
||||||
|
description: No permission
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||||
|
404:
|
||||||
|
description: Task not found
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||||
|
400:
|
||||||
|
description: Invalid deadlineStrategy
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/SimpleStatusResponse'
|
||||||
|
|
||||||
|
|
||||||
components:
|
components:
|
||||||
@ -2780,3 +2826,19 @@ components:
|
|||||||
ntfy_token:
|
ntfy_token:
|
||||||
type: string
|
type: string
|
||||||
description: token to ntfy useraccount
|
description: token to ntfy useraccount
|
||||||
|
TaskRepeatDayInfo:
|
||||||
|
required:
|
||||||
|
- offset
|
||||||
|
- deadlineStrategy
|
||||||
|
additionalProperties: false
|
||||||
|
properties:
|
||||||
|
offset:
|
||||||
|
type: number
|
||||||
|
description: number repeating days
|
||||||
|
example: 7
|
||||||
|
minimum: 1
|
||||||
|
deadlineStrategy:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- DEADLINE_EQUAL_START
|
||||||
|
- DEADLINE_FIT_START
|
Loading…
Reference in New Issue
Block a user