issue-23 #24
@ -5,9 +5,13 @@
 | 
				
			|||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="ChangeListManager">
 | 
					  <component name="ChangeListManager">
 | 
				
			||||||
    <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Delete Schedules">
 | 
					    <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Delete Schedules">
 | 
				
			||||||
      <change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html" afterDir="false" />
 | 
					      <change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/AbstractScheduleShortInfo.java" afterDir="false" />
 | 
				
			||||||
      <change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" afterDir="false" />
 | 
					      <change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/BasicScheduleShortInfo.java" afterDir="false" />
 | 
				
			||||||
      <change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" afterDir="false" />
 | 
					      <change afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/ScheduleInfo.java" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
 | 
				
			||||||
    </list>
 | 
					    </list>
 | 
				
			||||||
    <option name="SHOW_DIALOG" value="false" />
 | 
					    <option name="SHOW_DIALOG" value="false" />
 | 
				
			||||||
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
 | 
					    <option name="HIGHLIGHT_CONFLICTS" value="true" />
 | 
				
			||||||
@ -96,6 +100,7 @@
 | 
				
			|||||||
      <workItem from="1697969480767" duration="6407000" />
 | 
					      <workItem from="1697969480767" duration="6407000" />
 | 
				
			||||||
      <workItem from="1697989716016" duration="3814000" />
 | 
					      <workItem from="1697989716016" duration="3814000" />
 | 
				
			||||||
      <workItem from="1698067098771" duration="4770000" />
 | 
					      <workItem from="1698067098771" duration="4770000" />
 | 
				
			||||||
 | 
					      <workItem from="1698127431684" duration="1530000" />
 | 
				
			||||||
    </task>
 | 
					    </task>
 | 
				
			||||||
    <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
 | 
					    <task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
 | 
				
			||||||
      <option name="closed" value="true" />
 | 
					      <option name="closed" value="true" />
 | 
				
			||||||
@ -180,7 +185,7 @@
 | 
				
			|||||||
        </line-breakpoint>
 | 
					        </line-breakpoint>
 | 
				
			||||||
        <line-breakpoint enabled="true" type="java-line">
 | 
					        <line-breakpoint enabled="true" type="java-line">
 | 
				
			||||||
          <url>file://$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java</url>
 | 
					          <url>file://$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java</url>
 | 
				
			||||||
          <line>36</line>
 | 
					          <line>41</line>
 | 
				
			||||||
          <option name="timeStamp" value="2" />
 | 
					          <option name="timeStamp" value="2" />
 | 
				
			||||||
        </line-breakpoint>
 | 
					        </line-breakpoint>
 | 
				
			||||||
      </breakpoints>
 | 
					      </breakpoints>
 | 
				
			||||||
 | 
				
			|||||||
@ -3,9 +3,11 @@ package core.api.controller;
 | 
				
			|||||||
import core.api.models.auth.SimpleStatusResponse;
 | 
					import core.api.models.auth.SimpleStatusResponse;
 | 
				
			||||||
import core.api.models.timemanager.taskSchedule.BasicTaskScheduleEntityInfo;
 | 
					import core.api.models.timemanager.taskSchedule.BasicTaskScheduleEntityInfo;
 | 
				
			||||||
import core.api.models.timemanager.taskSchedule.BasicTaskScheduleFieldInfo;
 | 
					import core.api.models.timemanager.taskSchedule.BasicTaskScheduleFieldInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.ScheduleInfo;
 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					import core.entities.timemanager.BasicTaskSchedule;
 | 
				
			||||||
import core.entities.timemanager.ScheduleType;
 | 
					import core.entities.timemanager.ScheduleType;
 | 
				
			||||||
import core.entities.timemanager.Task;
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
 | 
					import core.repositories.timemanager.BasicTaskScheduleRepository;
 | 
				
			||||||
import core.services.*;
 | 
					import core.services.*;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.http.ResponseEntity;
 | 
					import org.springframework.http.ResponseEntity;
 | 
				
			||||||
@ -24,10 +26,13 @@ public class ScheduleController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private final TaskService taskService;
 | 
					    private final TaskService taskService;
 | 
				
			||||||
    private final TaskScheduleService taskScheduleService;
 | 
					    private final TaskScheduleService taskScheduleService;
 | 
				
			||||||
 | 
					    private final BasicTaskScheduleRepository basicTaskScheduleRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ScheduleController(@Autowired TaskService taskService, @Autowired TaskScheduleService taskScheduleService) {
 | 
					    public ScheduleController(@Autowired TaskService taskService, @Autowired TaskScheduleService taskScheduleService,
 | 
				
			||||||
 | 
					                              BasicTaskScheduleRepository basicTaskScheduleRepository) {
 | 
				
			||||||
        this.taskService = taskService;
 | 
					        this.taskService = taskService;
 | 
				
			||||||
        this.taskScheduleService = taskScheduleService;
 | 
					        this.taskScheduleService = taskScheduleService;
 | 
				
			||||||
 | 
					        this.basicTaskScheduleRepository = basicTaskScheduleRepository;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/schedules/{taskID}/{scheduleType}")
 | 
					    @GetMapping("/schedules/{taskID}/{scheduleType}")
 | 
				
			||||||
@ -96,4 +101,24 @@ public class ScheduleController {
 | 
				
			|||||||
        taskScheduleService.deleteBasicSchedule(permissionResult.getResult());
 | 
					        taskScheduleService.deleteBasicSchedule(permissionResult.getResult());
 | 
				
			||||||
        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
					        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/schedules/today")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> loadTodaysSchedules() {
 | 
				
			||||||
 | 
					        ServiceResult<List<BasicTaskSchedule>> todaysSchedules = taskScheduleService.loadTodaysSchedule(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(todaysSchedules.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return ResponseEntity.ok(todaysSchedules.getResult().stream().map(ScheduleInfo::new).toList());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/schedules")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> loadSchedules() {
 | 
				
			||||||
 | 
					        ServiceResult<List<BasicTaskSchedule>> schedules = taskScheduleService.loadSchedules(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(schedules.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return ResponseEntity.ok(schedules.getResult().stream().map(ScheduleInfo::new).toList());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public abstract class AbstractScheduleShortInfo {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.timemanager.BasicTaskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class BasicScheduleShortInfo extends AbstractScheduleShortInfo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private LocalDate scheduleDate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public BasicScheduleShortInfo(BasicTaskSchedule basicTaskSchedule) {
 | 
				
			||||||
 | 
					        this.scheduleDate = basicTaskSchedule.getScheduleDate();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDate getScheduleDate() {
 | 
				
			||||||
 | 
					        return scheduleDate;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setScheduleDate(LocalDate scheduleDate) {
 | 
				
			||||||
 | 
					        this.scheduleDate = scheduleDate;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,83 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.timemanager.BasicTaskSchedule;
 | 
				
			||||||
 | 
					import core.entities.timemanager.ScheduleType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.Duration;
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ScheduleInfo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private long scheduleID;
 | 
				
			||||||
 | 
					    private ScheduleType scheduleType;
 | 
				
			||||||
 | 
					    private LocalDateTime startTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private LocalDateTime finishTime;
 | 
				
			||||||
 | 
					    private int activeMinutes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private AbstractScheduleShortInfo schedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ScheduleInfo(BasicTaskSchedule basicTaskSchedule) {
 | 
				
			||||||
 | 
					        this.scheduleID = basicTaskSchedule.getScheduleID();
 | 
				
			||||||
 | 
					        this.scheduleType = ScheduleType.BASIC;
 | 
				
			||||||
 | 
					        this.startTime = basicTaskSchedule.getStartTime();
 | 
				
			||||||
 | 
					        this.finishTime = basicTaskSchedule.getFinishedTime();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(this.finishTime == null) {
 | 
				
			||||||
 | 
					            this.activeMinutes = (int) Duration.between(basicTaskSchedule.getStartTime(), LocalDate.now()).toMinutes();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            this.activeMinutes = (int) Duration.between(basicTaskSchedule.getStartTime(), basicTaskSchedule.getFinishedTime()).toMinutes();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.schedule = new BasicScheduleShortInfo(basicTaskSchedule);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public long getScheduleID() {
 | 
				
			||||||
 | 
					        return scheduleID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setScheduleID(long scheduleID) {
 | 
				
			||||||
 | 
					        this.scheduleID = scheduleID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ScheduleType getScheduleType() {
 | 
				
			||||||
 | 
					        return scheduleType;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setScheduleType(ScheduleType scheduleType) {
 | 
				
			||||||
 | 
					        this.scheduleType = scheduleType;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDateTime getStartTime() {
 | 
				
			||||||
 | 
					        return startTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setStartTime(LocalDateTime startTime) {
 | 
				
			||||||
 | 
					        this.startTime = startTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDateTime getFinishTime() {
 | 
				
			||||||
 | 
					        return finishTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setFinishTime(LocalDateTime finishTime) {
 | 
				
			||||||
 | 
					        this.finishTime = finishTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getActiveMinutes() {
 | 
				
			||||||
 | 
					        return activeMinutes;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setActiveMinutes(int activeMinutes) {
 | 
				
			||||||
 | 
					        this.activeMinutes = activeMinutes;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AbstractScheduleShortInfo getSchedule() {
 | 
				
			||||||
 | 
					        return schedule;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setSchedule(AbstractScheduleShortInfo schedule) {
 | 
				
			||||||
 | 
					        this.schedule = schedule;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
package core.repositories.timemanager;
 | 
					package core.repositories.timemanager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.User;
 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					import core.entities.timemanager.BasicTaskSchedule;
 | 
				
			||||||
import org.springframework.data.jpa.repository.Modifying;
 | 
					import org.springframework.data.jpa.repository.Modifying;
 | 
				
			||||||
import org.springframework.data.jpa.repository.Query;
 | 
					import org.springframework.data.jpa.repository.Query;
 | 
				
			||||||
@ -7,6 +8,8 @@ import org.springframework.data.repository.CrudRepository;
 | 
				
			|||||||
import org.springframework.stereotype.Repository;
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.transaction.Transactional;
 | 
					import javax.transaction.Transactional;
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Repository
 | 
					@Repository
 | 
				
			||||||
public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSchedule, Long> {
 | 
					public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSchedule, Long> {
 | 
				
			||||||
@ -15,4 +18,10 @@ public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSch
 | 
				
			|||||||
    @Transactional
 | 
					    @Transactional
 | 
				
			||||||
    @Query(value = "DELETE FROM BasicTaskSchedule bts WHERE bts.scheduleID = ?1")
 | 
					    @Query(value = "DELETE FROM BasicTaskSchedule bts WHERE bts.scheduleID = ?1")
 | 
				
			||||||
    void deleteBasicTaskScheduleByID(long id);
 | 
					    void deleteBasicTaskScheduleByID(long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1")
 | 
				
			||||||
 | 
					    List<BasicTaskSchedule> findAllByUser(User user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1 AND bts.scheduleDate = ?2")
 | 
				
			||||||
 | 
					    List<BasicTaskSchedule> findAllByUserAndDate(User user, LocalDate localDate);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,17 @@
 | 
				
			|||||||
package core.services;
 | 
					package core.services;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import core.api.models.timemanager.taskSchedule.BasicTaskScheduleFieldInfo;
 | 
					import core.api.models.timemanager.taskSchedule.BasicTaskScheduleFieldInfo;
 | 
				
			||||||
 | 
					import core.entities.User;
 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					import core.entities.timemanager.BasicTaskSchedule;
 | 
				
			||||||
import core.entities.timemanager.Task;
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
 | 
					import core.repositories.UserRepository;
 | 
				
			||||||
import core.repositories.timemanager.BasicTaskScheduleRepository;
 | 
					import core.repositories.timemanager.BasicTaskScheduleRepository;
 | 
				
			||||||
import core.repositories.timemanager.TaskRepository;
 | 
					import core.repositories.timemanager.TaskRepository;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Optional;
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
@ -15,11 +19,14 @@ public class TaskScheduleService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private final BasicTaskScheduleRepository basicTaskScheduleRepository;
 | 
					    private final BasicTaskScheduleRepository basicTaskScheduleRepository;
 | 
				
			||||||
    private final TaskRepository taskRepository;
 | 
					    private final TaskRepository taskRepository;
 | 
				
			||||||
 | 
					    private final UserRepository userRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public TaskScheduleService(@Autowired BasicTaskScheduleRepository basicTaskScheduleRepository,
 | 
					    public TaskScheduleService(@Autowired BasicTaskScheduleRepository basicTaskScheduleRepository,
 | 
				
			||||||
                               @Autowired TaskRepository taskRepository) {
 | 
					                               @Autowired TaskRepository taskRepository,
 | 
				
			||||||
 | 
					                               UserRepository userRepository) {
 | 
				
			||||||
        this.basicTaskScheduleRepository = basicTaskScheduleRepository;
 | 
					        this.basicTaskScheduleRepository = basicTaskScheduleRepository;
 | 
				
			||||||
        this.taskRepository = taskRepository;
 | 
					        this.taskRepository = taskRepository;
 | 
				
			||||||
 | 
					        this.userRepository = userRepository;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ServiceResult<BasicTaskSchedule> createBasicTaskSchedule(Task task, BasicTaskScheduleFieldInfo basicTaskScheduleFieldInfo) {
 | 
					    public ServiceResult<BasicTaskSchedule> createBasicTaskSchedule(Task task, BasicTaskScheduleFieldInfo basicTaskScheduleFieldInfo) {
 | 
				
			||||||
@ -44,4 +51,16 @@ public class TaskScheduleService {
 | 
				
			|||||||
    public void deleteBasicSchedule(BasicTaskSchedule basicTaskSchedule) {
 | 
					    public void deleteBasicSchedule(BasicTaskSchedule basicTaskSchedule) {
 | 
				
			||||||
        basicTaskScheduleRepository.deleteBasicTaskScheduleByID(basicTaskSchedule.getScheduleID());
 | 
					        basicTaskScheduleRepository.deleteBasicTaskScheduleByID(basicTaskSchedule.getScheduleID());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceResult<List<BasicTaskSchedule>> loadTodaysSchedule(String username) {
 | 
				
			||||||
 | 
					        Optional<User> user = userRepository.findByUsername(username);
 | 
				
			||||||
 | 
					        return user.map(value -> new ServiceResult<>(basicTaskScheduleRepository.findAllByUserAndDate(value, LocalDate.now()))).orElseGet(() ->
 | 
				
			||||||
 | 
					                new ServiceResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ServiceResult<List<BasicTaskSchedule>> loadSchedules(String username) {
 | 
				
			||||||
 | 
					        Optional<User> user = userRepository.findByUsername(username);
 | 
				
			||||||
 | 
					        return user.map(value -> new ServiceResult<>(basicTaskScheduleRepository.findAllByUser(value))).orElseGet(() ->
 | 
				
			||||||
 | 
					                new ServiceResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -409,4 +409,59 @@ export class ScheduleService {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * get today\'s schedules
 | 
				
			||||||
 | 
					     * get all schedules of today
 | 
				
			||||||
 | 
					     * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
 | 
				
			||||||
 | 
					     * @param reportProgress flag to report request and response progress.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public schedulesTodayGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
 | 
				
			||||||
 | 
					    public schedulesTodayGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
 | 
				
			||||||
 | 
					    public schedulesTodayGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
 | 
				
			||||||
 | 
					    public schedulesTodayGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHeaders = this.defaultHeaders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarCredential: string | undefined;
 | 
				
			||||||
 | 
					        // authentication (API_TOKEN) required
 | 
				
			||||||
 | 
					        localVarCredential = this.configuration.lookupCredential('API_TOKEN');
 | 
				
			||||||
 | 
					        if (localVarCredential) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected === undefined) {
 | 
				
			||||||
 | 
					            // to determine the Accept header
 | 
				
			||||||
 | 
					            const httpHeaderAccepts: string[] = [
 | 
				
			||||||
 | 
					                'application/json'
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					            localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (localVarHttpHeaderAcceptSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let localVarHttpContext: HttpContext | undefined = options && options.context;
 | 
				
			||||||
 | 
					        if (localVarHttpContext === undefined) {
 | 
				
			||||||
 | 
					            localVarHttpContext = new HttpContext();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let responseType_: 'text' | 'json' = 'json';
 | 
				
			||||||
 | 
					        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
				
			||||||
 | 
					            responseType_ = 'text';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return this.httpClient.get<Array<ScheduleInfo>>(`${this.configuration.basePath}/schedules/today`,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@
 | 
				
			|||||||
 * https://openapi-generator.tech
 | 
					 * https://openapi-generator.tech
 | 
				
			||||||
 * Do not edit the class manually.
 | 
					 * Do not edit the class manually.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
import { BasicScheduleEntityInfo } from './basicScheduleEntityInfo';
 | 
					import { BasicScheduleFieldInfo } from './basicScheduleFieldInfo';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ScheduleInfo { 
 | 
					export interface ScheduleInfo { 
 | 
				
			||||||
@ -21,7 +21,19 @@ export interface ScheduleInfo {
 | 
				
			|||||||
     * type of schedule
 | 
					     * type of schedule
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    scheduleType: ScheduleInfo.ScheduleTypeEnum;
 | 
					    scheduleType: ScheduleInfo.ScheduleTypeEnum;
 | 
				
			||||||
    schedule: BasicScheduleEntityInfo;
 | 
					    /**
 | 
				
			||||||
 | 
					     * date on which the task schedule was started
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    startTime: string;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * date on which the tasks schedule was finished
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    finishedTime?: string;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * number in minutes that the schedule was active
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    activeMinutes: number;
 | 
				
			||||||
 | 
					    schedule: BasicScheduleFieldInfo;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export namespace ScheduleInfo {
 | 
					export namespace ScheduleInfo {
 | 
				
			||||||
    export type ScheduleTypeEnum = 'BASIC' | 'MODERATE' | 'ADVANCED';
 | 
					    export type ScheduleTypeEnum = 'BASIC' | 'MODERATE' | 'ADVANCED';
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										35
									
								
								openapi.yaml
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								openapi.yaml
									
									
									
									
									
								
							@ -1355,6 +1355,24 @@ paths:
 | 
				
			|||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: object
 | 
					                type: object
 | 
				
			||||||
                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
					                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
				
			||||||
 | 
					  /schedules/today:
 | 
				
			||||||
 | 
					    get: 
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - API_TOKEN: []
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - schedule
 | 
				
			||||||
 | 
					      description: get all schedules of today
 | 
				
			||||||
 | 
					      summary: get today's schedules
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        200:
 | 
				
			||||||
 | 
					          description: Operation successfull
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                type: array
 | 
				
			||||||
 | 
					                items:
 | 
				
			||||||
 | 
					                  $ref: '#/components/schemas/ScheduleInfo'
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
components:
 | 
					components:
 | 
				
			||||||
  securitySchemes:
 | 
					  securitySchemes:
 | 
				
			||||||
   API_TOKEN:
 | 
					   API_TOKEN:
 | 
				
			||||||
@ -1712,6 +1730,9 @@ components:
 | 
				
			|||||||
      required:
 | 
					      required:
 | 
				
			||||||
        - scheduleID
 | 
					        - scheduleID
 | 
				
			||||||
        - scheduleType
 | 
					        - scheduleType
 | 
				
			||||||
 | 
					        - startTime
 | 
				
			||||||
 | 
					        - finishTime
 | 
				
			||||||
 | 
					        - activeMinutes
 | 
				
			||||||
        - schedule
 | 
					        - schedule
 | 
				
			||||||
      additionalProperties: false
 | 
					      additionalProperties: false
 | 
				
			||||||
      properties:
 | 
					      properties:
 | 
				
			||||||
@ -1727,7 +1748,19 @@ components:
 | 
				
			|||||||
            - BASIC
 | 
					            - BASIC
 | 
				
			||||||
            - MODERATE
 | 
					            - MODERATE
 | 
				
			||||||
            - ADVANCED
 | 
					            - ADVANCED
 | 
				
			||||||
 | 
					        startTime:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: date-time
 | 
				
			||||||
 | 
					          description: date on which the task schedule was started
 | 
				
			||||||
 | 
					        finishedTime:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          format: date-time
 | 
				
			||||||
 | 
					          description: date on which the tasks schedule was finished
 | 
				
			||||||
 | 
					        activeMinutes: 
 | 
				
			||||||
 | 
					          type: number
 | 
				
			||||||
 | 
					          description: number in minutes that the schedule was active
 | 
				
			||||||
 | 
					          example: 10
 | 
				
			||||||
        schedule:
 | 
					        schedule:
 | 
				
			||||||
          type: object
 | 
					          type: object
 | 
				
			||||||
          oneOf:
 | 
					          oneOf:
 | 
				
			||||||
            - $ref: '#/components/schemas/BasicScheduleEntityInfo'
 | 
					            - $ref: '#/components/schemas/BasicScheduleFieldInfo'
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user