schedule-refactor #45
							
								
								
									
										57
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										57
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -27,44 +27,45 @@ replay_pid*
 | 
				
			|||||||
# ---> JetBrains
 | 
					# ---> JetBrains
 | 
				
			||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
 | 
					# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
 | 
				
			||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
 | 
					# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
 | 
				
			||||||
.idea/
 | 
					**/.idea/
 | 
				
			||||||
# User-specific stff
 | 
					# User-specific stff
 | 
				
			||||||
.idea/**/workspace.xml
 | 
					**/.idea/**/workspace.xml
 | 
				
			||||||
.idea/**/tasks.xml
 | 
					**/.idea/**/tasks.xml
 | 
				
			||||||
.idea/**/usage.statistics.xml
 | 
					**/.idea/**/usage.statistics.xml
 | 
				
			||||||
.idea/**/dictionaries
 | 
					**/.idea/**/dictionaries
 | 
				
			||||||
.idea/**/shelf
 | 
					**/.idea/**/shelf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# AWS User-specific
 | 
					# AWS User-specific
 | 
				
			||||||
.idea/**/aws.xml
 | 
					**/.idea/**/aws.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generated files
 | 
					# Generated files
 | 
				
			||||||
.idea/**/contentModel.xml
 | 
					**/.idea/**/contentModel.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Sensitive or high-churn files
 | 
					# Sensitive or high-churn files
 | 
				
			||||||
.idea/**/dataSources/
 | 
					**/.idea/**/dataSources/
 | 
				
			||||||
.idea/**/dataSources.ids
 | 
					**/.idea/**/dataSources.ids
 | 
				
			||||||
.idea/**/dataSources.local.xml
 | 
					**/.idea/**/dataSources.local.xml
 | 
				
			||||||
.idea/**/sqlDataSources.xml
 | 
					**/.idea/**/sqlDataSources.xml
 | 
				
			||||||
.idea/**/dynamic.xml
 | 
					**/.idea/**/dynamic.xml
 | 
				
			||||||
.idea/**/uiDesigner.xml
 | 
					**/.idea/**/uiDesigner.xml
 | 
				
			||||||
.idea/**/dbnavigator.xml
 | 
					**/.idea/**/dbnavigator.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Gradle
 | 
					# Gradle
 | 
				
			||||||
.idea/**/gradle.xml
 | 
					**/.idea/**/gradle.xml
 | 
				
			||||||
.idea/**/libraries
 | 
					**/.idea/**/libraries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Gradle and Maven with auto-import
 | 
					# Gradle and Maven with auto-import
 | 
				
			||||||
# When using Gradle or Maven with auto-import, you should exclude module files,
 | 
					# When using Gradle or Maven with auto-import, you should exclude module files,
 | 
				
			||||||
# since they will be recreated, and may cause churn.  Uncomment if using
 | 
					# since they will be recreated, and may cause churn.  Uncomment if using
 | 
				
			||||||
# auto-import.
 | 
					# auto-import.
 | 
				
			||||||
# .idea/artifacts
 | 
					# **/.idea/artifacts
 | 
				
			||||||
# .idea/compiler.xml
 | 
					# **/.idea/compiler.xml
 | 
				
			||||||
# .idea/jarRepositories.xml
 | 
					# **/.idea/jarRepositories.xml
 | 
				
			||||||
# .idea/modules.xml
 | 
					# **/.idea/modules.xml
 | 
				
			||||||
# .idea/*.iml
 | 
					# **/.idea/*.iml
 | 
				
			||||||
# .idea/modules
 | 
					# **/.idea/modules
 | 
				
			||||||
# *.iml
 | 
					# *.iml
 | 
				
			||||||
# *.ipr
 | 
					# *.ipr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -72,7 +73,7 @@ replay_pid*
 | 
				
			|||||||
cmake-build-*/
 | 
					cmake-build-*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Mongo Explorer plugin
 | 
					# Mongo Explorer plugin
 | 
				
			||||||
.idea/**/mongoSettings.xml
 | 
					**/.idea/**/mongoSettings.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# File-based project format
 | 
					# File-based project format
 | 
				
			||||||
*.iws
 | 
					*.iws
 | 
				
			||||||
@ -87,10 +88,10 @@ out/
 | 
				
			|||||||
atlassian-ide-plugin.xml
 | 
					atlassian-ide-plugin.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Cursive Clojure plugin
 | 
					# Cursive Clojure plugin
 | 
				
			||||||
.idea/replstate.xml
 | 
					**/.idea/replstate.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# SonarLint plugin
 | 
					# SonarLint plugin
 | 
				
			||||||
.idea/sonarlint/
 | 
					**/.idea/sonarlint/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
 | 
					# Crashlytics plugin (for Android Studio and IntelliJ)
 | 
				
			||||||
com_crashlytics_export_strings.xml
 | 
					com_crashlytics_export_strings.xml
 | 
				
			||||||
@ -99,10 +100,10 @@ crashlytics-build.properties
 | 
				
			|||||||
fabric.properties
 | 
					fabric.properties
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Editor-based Rest Client
 | 
					# Editor-based Rest Client
 | 
				
			||||||
.idea/httpRequests
 | 
					**/.idea/httpRequests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Android studio 3.1+ serialized cache file
 | 
					# Android studio 3.1+ serialized cache file
 | 
				
			||||||
.idea/caches/build_file_checksums.ser
 | 
					**/.idea/caches/build_file_checksums.ser
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ---> Maven
 | 
					# ---> Maven
 | 
				
			||||||
target/
 | 
					target/
 | 
				
			||||||
 | 
				
			|||||||
@ -4,9 +4,13 @@
 | 
				
			|||||||
    <option name="autoReloadType" value="SELECTIVE" />
 | 
					    <option name="autoReloadType" value="SELECTIVE" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="ChangeListManager">
 | 
					  <component name="ChangeListManager">
 | 
				
			||||||
    <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Remove entityManager from TaskService">
 | 
					    <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Basic Reschedule">
 | 
				
			||||||
      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 | 
					      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
 | 
				
			||||||
      <change beforePath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" 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/ScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/ScheduleRepository.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" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/src/test/java/core/schedules/ScheduleServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/schedules/ScheduleServiceTest.java" afterDir="false" />
 | 
				
			||||||
 | 
					      <change beforePath="$PROJECT_DIR$/src/test/resources/basicScheduleEntries.sql" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/resources/basicScheduleEntries.sql" 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" />
 | 
				
			||||||
@ -85,81 +89,82 @@
 | 
				
			|||||||
      <recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
 | 
					      <recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
 | 
				
			||||||
    </key>
 | 
					    </key>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="RunManager" selected="JUnit.TaskServiceTest">
 | 
					  <component name="RunManager" selected="Spring Boot.DemoApplication">
 | 
				
			||||||
    <configuration name="TaskServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
					    <configuration name="ScheduleServiceTest.deleteSchedule" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
				
			||||||
      <module name="demo" />
 | 
					      <module name="demo" />
 | 
				
			||||||
      <extension name="coverage">
 | 
					      <extension name="coverage">
 | 
				
			||||||
        <pattern>
 | 
					        <pattern>
 | 
				
			||||||
          <option name="PATTERN" value="core.tasks.*" />
 | 
					          <option name="PATTERN" value="core.schedules.*" />
 | 
				
			||||||
          <option name="ENABLED" value="true" />
 | 
					          <option name="ENABLED" value="true" />
 | 
				
			||||||
        </pattern>
 | 
					        </pattern>
 | 
				
			||||||
      </extension>
 | 
					      </extension>
 | 
				
			||||||
      <option name="PACKAGE_NAME" value="core.tasks" />
 | 
					      <option name="PACKAGE_NAME" value="core.schedules" />
 | 
				
			||||||
      <option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
 | 
					      <option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
 | 
				
			||||||
      <option name="TEST_OBJECT" value="class" />
 | 
					      <option name="METHOD_NAME" value="deleteSchedule" />
 | 
				
			||||||
      <method v="2">
 | 
					 | 
				
			||||||
        <option name="Make" enabled="true" />
 | 
					 | 
				
			||||||
      </method>
 | 
					 | 
				
			||||||
    </configuration>
 | 
					 | 
				
			||||||
    <configuration name="TaskServiceTest.clearTasks" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
					 | 
				
			||||||
      <module name="demo" />
 | 
					 | 
				
			||||||
      <extension name="coverage">
 | 
					 | 
				
			||||||
        <pattern>
 | 
					 | 
				
			||||||
          <option name="PATTERN" value="core.tasks.*" />
 | 
					 | 
				
			||||||
          <option name="ENABLED" value="true" />
 | 
					 | 
				
			||||||
        </pattern>
 | 
					 | 
				
			||||||
      </extension>
 | 
					 | 
				
			||||||
      <option name="PACKAGE_NAME" value="core.tasks" />
 | 
					 | 
				
			||||||
      <option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
 | 
					 | 
				
			||||||
      <option name="METHOD_NAME" value="clearTasks" />
 | 
					 | 
				
			||||||
      <option name="TEST_OBJECT" value="method" />
 | 
					      <option name="TEST_OBJECT" value="method" />
 | 
				
			||||||
      <method v="2">
 | 
					      <method v="2">
 | 
				
			||||||
        <option name="Make" enabled="true" />
 | 
					        <option name="Make" enabled="true" />
 | 
				
			||||||
      </method>
 | 
					      </method>
 | 
				
			||||||
    </configuration>
 | 
					    </configuration>
 | 
				
			||||||
    <configuration name="TaskServiceTest.deleteTask" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
					    <configuration name="ScheduleServiceTest.editBasicSchedule" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
				
			||||||
      <module name="demo" />
 | 
					      <module name="demo" />
 | 
				
			||||||
      <extension name="coverage">
 | 
					      <extension name="coverage">
 | 
				
			||||||
        <pattern>
 | 
					        <pattern>
 | 
				
			||||||
          <option name="PATTERN" value="core.tasks.*" />
 | 
					          <option name="PATTERN" value="core.schedules.*" />
 | 
				
			||||||
          <option name="ENABLED" value="true" />
 | 
					          <option name="ENABLED" value="true" />
 | 
				
			||||||
        </pattern>
 | 
					        </pattern>
 | 
				
			||||||
      </extension>
 | 
					      </extension>
 | 
				
			||||||
      <option name="PACKAGE_NAME" value="core.tasks" />
 | 
					      <option name="PACKAGE_NAME" value="core.schedules" />
 | 
				
			||||||
      <option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
 | 
					      <option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
 | 
				
			||||||
      <option name="METHOD_NAME" value="deleteTask" />
 | 
					      <option name="METHOD_NAME" value="editBasicSchedule" />
 | 
				
			||||||
      <option name="TEST_OBJECT" value="method" />
 | 
					      <option name="TEST_OBJECT" value="method" />
 | 
				
			||||||
      <method v="2">
 | 
					      <method v="2">
 | 
				
			||||||
        <option name="Make" enabled="true" />
 | 
					        <option name="Make" enabled="true" />
 | 
				
			||||||
      </method>
 | 
					      </method>
 | 
				
			||||||
    </configuration>
 | 
					    </configuration>
 | 
				
			||||||
    <configuration name="TaskServiceTest.finishTask" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
					    <configuration name="ScheduleServiceTest.getAllSchedulesOfUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
				
			||||||
      <module name="demo" />
 | 
					      <module name="demo" />
 | 
				
			||||||
      <extension name="coverage">
 | 
					      <extension name="coverage">
 | 
				
			||||||
        <pattern>
 | 
					        <pattern>
 | 
				
			||||||
          <option name="PATTERN" value="core.tasks.*" />
 | 
					          <option name="PATTERN" value="core.schedules.*" />
 | 
				
			||||||
          <option name="ENABLED" value="true" />
 | 
					          <option name="ENABLED" value="true" />
 | 
				
			||||||
        </pattern>
 | 
					        </pattern>
 | 
				
			||||||
      </extension>
 | 
					      </extension>
 | 
				
			||||||
      <option name="PACKAGE_NAME" value="core.tasks" />
 | 
					      <option name="PACKAGE_NAME" value="core.schedules" />
 | 
				
			||||||
      <option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
 | 
					      <option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
 | 
				
			||||||
      <option name="METHOD_NAME" value="finishTask" />
 | 
					      <option name="METHOD_NAME" value="getAllSchedulesOfUser" />
 | 
				
			||||||
      <option name="TEST_OBJECT" value="method" />
 | 
					      <option name="TEST_OBJECT" value="method" />
 | 
				
			||||||
      <method v="2">
 | 
					      <method v="2">
 | 
				
			||||||
        <option name="Make" enabled="true" />
 | 
					        <option name="Make" enabled="true" />
 | 
				
			||||||
      </method>
 | 
					      </method>
 | 
				
			||||||
    </configuration>
 | 
					    </configuration>
 | 
				
			||||||
    <configuration name="TaskServiceTest.loadAllTasks" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
					    <configuration name="ScheduleServiceTest.getFilteredScheduledOfUser" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
				
			||||||
      <module name="demo" />
 | 
					      <module name="demo" />
 | 
				
			||||||
      <extension name="coverage">
 | 
					      <extension name="coverage">
 | 
				
			||||||
        <pattern>
 | 
					        <pattern>
 | 
				
			||||||
          <option name="PATTERN" value="core.tasks.*" />
 | 
					          <option name="PATTERN" value="core.schedules.*" />
 | 
				
			||||||
          <option name="ENABLED" value="true" />
 | 
					          <option name="ENABLED" value="true" />
 | 
				
			||||||
        </pattern>
 | 
					        </pattern>
 | 
				
			||||||
      </extension>
 | 
					      </extension>
 | 
				
			||||||
      <option name="PACKAGE_NAME" value="core.tasks" />
 | 
					      <option name="PACKAGE_NAME" value="core.schedules" />
 | 
				
			||||||
      <option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
 | 
					      <option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
 | 
				
			||||||
      <option name="METHOD_NAME" value="loadAllTasks" />
 | 
					      <option name="METHOD_NAME" value="getFilteredScheduledOfUser" />
 | 
				
			||||||
 | 
					      <option name="TEST_OBJECT" value="method" />
 | 
				
			||||||
 | 
					      <method v="2">
 | 
				
			||||||
 | 
					        <option name="Make" enabled="true" />
 | 
				
			||||||
 | 
					      </method>
 | 
				
			||||||
 | 
					    </configuration>
 | 
				
			||||||
 | 
					    <configuration name="ScheduleServiceTest.scheduleBasic" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
 | 
				
			||||||
 | 
					      <module name="demo" />
 | 
				
			||||||
 | 
					      <extension name="coverage">
 | 
				
			||||||
 | 
					        <pattern>
 | 
				
			||||||
 | 
					          <option name="PATTERN" value="core.schedules.*" />
 | 
				
			||||||
 | 
					          <option name="ENABLED" value="true" />
 | 
				
			||||||
 | 
					        </pattern>
 | 
				
			||||||
 | 
					      </extension>
 | 
				
			||||||
 | 
					      <option name="PACKAGE_NAME" value="core.schedules" />
 | 
				
			||||||
 | 
					      <option name="MAIN_CLASS_NAME" value="core.schedules.ScheduleServiceTest" />
 | 
				
			||||||
 | 
					      <option name="METHOD_NAME" value="scheduleBasic" />
 | 
				
			||||||
      <option name="TEST_OBJECT" value="method" />
 | 
					      <option name="TEST_OBJECT" value="method" />
 | 
				
			||||||
      <method v="2">
 | 
					      <method v="2">
 | 
				
			||||||
        <option name="Make" enabled="true" />
 | 
					        <option name="Make" enabled="true" />
 | 
				
			||||||
@ -174,11 +179,11 @@
 | 
				
			|||||||
    </configuration>
 | 
					    </configuration>
 | 
				
			||||||
    <recent_temporary>
 | 
					    <recent_temporary>
 | 
				
			||||||
      <list>
 | 
					      <list>
 | 
				
			||||||
        <item itemvalue="JUnit.TaskServiceTest" />
 | 
					        <item itemvalue="JUnit.ScheduleServiceTest.getFilteredScheduledOfUser" />
 | 
				
			||||||
        <item itemvalue="JUnit.TaskServiceTest.loadAllTasks" />
 | 
					        <item itemvalue="JUnit.ScheduleServiceTest.deleteSchedule" />
 | 
				
			||||||
        <item itemvalue="JUnit.TaskServiceTest.finishTask" />
 | 
					        <item itemvalue="JUnit.ScheduleServiceTest.editBasicSchedule" />
 | 
				
			||||||
        <item itemvalue="JUnit.TaskServiceTest.clearTasks" />
 | 
					        <item itemvalue="JUnit.ScheduleServiceTest.scheduleBasic" />
 | 
				
			||||||
        <item itemvalue="JUnit.TaskServiceTest.deleteTask" />
 | 
					        <item itemvalue="JUnit.ScheduleServiceTest.getAllSchedulesOfUser" />
 | 
				
			||||||
      </list>
 | 
					      </list>
 | 
				
			||||||
    </recent_temporary>
 | 
					    </recent_temporary>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
@ -482,17 +487,45 @@
 | 
				
			|||||||
      <option name="project" value="LOCAL" />
 | 
					      <option name="project" value="LOCAL" />
 | 
				
			||||||
      <updated>1699695051881</updated>
 | 
					      <updated>1699695051881</updated>
 | 
				
			||||||
    </task>
 | 
					    </task>
 | 
				
			||||||
    <option name="localTasksCounter" value="34" />
 | 
					    <task id="LOCAL-00034" summary="Update gitignore and add Clear ScheduleCode">
 | 
				
			||||||
 | 
					      <option name="closed" value="true" />
 | 
				
			||||||
 | 
					      <created>1699705458914</created>
 | 
				
			||||||
 | 
					      <option name="number" value="00034" />
 | 
				
			||||||
 | 
					      <option name="presentableId" value="LOCAL-00034" />
 | 
				
			||||||
 | 
					      <option name="project" value="LOCAL" />
 | 
				
			||||||
 | 
					      <updated>1699705458914</updated>
 | 
				
			||||||
 | 
					    </task>
 | 
				
			||||||
 | 
					    <task id="LOCAL-00035" summary="Get All Schedules of User">
 | 
				
			||||||
 | 
					      <option name="closed" value="true" />
 | 
				
			||||||
 | 
					      <created>1699708881009</created>
 | 
				
			||||||
 | 
					      <option name="number" value="00035" />
 | 
				
			||||||
 | 
					      <option name="presentableId" value="LOCAL-00035" />
 | 
				
			||||||
 | 
					      <option name="project" value="LOCAL" />
 | 
				
			||||||
 | 
					      <updated>1699708881009</updated>
 | 
				
			||||||
 | 
					    </task>
 | 
				
			||||||
 | 
					    <task id="LOCAL-00036" summary="Get All Schedules of Task + create Basic Schedule">
 | 
				
			||||||
 | 
					      <option name="closed" value="true" />
 | 
				
			||||||
 | 
					      <created>1699711238266</created>
 | 
				
			||||||
 | 
					      <option name="number" value="00036" />
 | 
				
			||||||
 | 
					      <option name="presentableId" value="LOCAL-00036" />
 | 
				
			||||||
 | 
					      <option name="project" value="LOCAL" />
 | 
				
			||||||
 | 
					      <updated>1699711238266</updated>
 | 
				
			||||||
 | 
					    </task>
 | 
				
			||||||
 | 
					    <task id="LOCAL-00037" summary="Basic Reschedule">
 | 
				
			||||||
 | 
					      <option name="closed" value="true" />
 | 
				
			||||||
 | 
					      <created>1699714216432</created>
 | 
				
			||||||
 | 
					      <option name="number" value="00037" />
 | 
				
			||||||
 | 
					      <option name="presentableId" value="LOCAL-00037" />
 | 
				
			||||||
 | 
					      <option name="project" value="LOCAL" />
 | 
				
			||||||
 | 
					      <updated>1699714216432</updated>
 | 
				
			||||||
 | 
					    </task>
 | 
				
			||||||
 | 
					    <option name="localTasksCounter" value="38" />
 | 
				
			||||||
    <servers />
 | 
					    <servers />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="TypeScriptGeneratedFilesManager">
 | 
					  <component name="TypeScriptGeneratedFilesManager">
 | 
				
			||||||
    <option name="version" value="3" />
 | 
					    <option name="version" value="3" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="VcsManagerConfiguration">
 | 
					  <component name="VcsManagerConfiguration">
 | 
				
			||||||
    <MESSAGE value="Fix Foreign Key Constraint Fail when deleting Taskgroups" />
 | 
					 | 
				
			||||||
    <MESSAGE value="Stop and Finish TaskSchedules" />
 | 
					 | 
				
			||||||
    <MESSAGE value="Include TaskScheduleStopResponse" />
 | 
					 | 
				
			||||||
    <MESSAGE value="Fix starting schedule and returning active time of schedule after stop" />
 | 
					 | 
				
			||||||
    <MESSAGE value="Remove update spamming in console" />
 | 
					    <MESSAGE value="Remove update spamming in console" />
 | 
				
			||||||
    <MESSAGE value="Start task now from Taskoverview in Dashboard" />
 | 
					    <MESSAGE value="Start task now from Taskoverview in Dashboard" />
 | 
				
			||||||
    <MESSAGE value="Load worked minutes when reloading dashboard" />
 | 
					    <MESSAGE value="Load worked minutes when reloading dashboard" />
 | 
				
			||||||
@ -514,31 +547,25 @@
 | 
				
			|||||||
    <MESSAGE value="Deleting Task test" />
 | 
					    <MESSAGE value="Deleting Task test" />
 | 
				
			||||||
    <MESSAGE value="Consider increased number of tasks" />
 | 
					    <MESSAGE value="Consider increased number of tasks" />
 | 
				
			||||||
    <MESSAGE value="Remove entityManager from TaskService" />
 | 
					    <MESSAGE value="Remove entityManager from TaskService" />
 | 
				
			||||||
    <option name="LAST_COMMIT_MESSAGE" value="Remove entityManager from TaskService" />
 | 
					    <MESSAGE value="Update gitignore and add Clear ScheduleCode" />
 | 
				
			||||||
 | 
					    <MESSAGE value="Get All Schedules of User" />
 | 
				
			||||||
 | 
					    <MESSAGE value="Get All Schedules of Task + create Basic Schedule" />
 | 
				
			||||||
 | 
					    <MESSAGE value="Basic Reschedule" />
 | 
				
			||||||
 | 
					    <option name="LAST_COMMIT_MESSAGE" value="Basic Reschedule" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="XDebuggerManager">
 | 
					  <component name="XDebuggerManager">
 | 
				
			||||||
    <breakpoint-manager>
 | 
					    <breakpoint-manager>
 | 
				
			||||||
      <breakpoints>
 | 
					      <breakpoints>
 | 
				
			||||||
        <line-breakpoint enabled="true" type="java-line">
 | 
					 | 
				
			||||||
          <url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
 | 
					 | 
				
			||||||
          <line>87</line>
 | 
					 | 
				
			||||||
          <option name="timeStamp" value="5" />
 | 
					 | 
				
			||||||
        </line-breakpoint>
 | 
					 | 
				
			||||||
        <line-breakpoint enabled="true" type="java-line">
 | 
					 | 
				
			||||||
          <url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
 | 
					 | 
				
			||||||
          <line>94</line>
 | 
					 | 
				
			||||||
          <option name="timeStamp" value="6" />
 | 
					 | 
				
			||||||
        </line-breakpoint>
 | 
					 | 
				
			||||||
        <line-breakpoint enabled="true" type="java-line">
 | 
					 | 
				
			||||||
          <url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
 | 
					 | 
				
			||||||
          <line>202</line>
 | 
					 | 
				
			||||||
          <option name="timeStamp" value="10" />
 | 
					 | 
				
			||||||
        </line-breakpoint>
 | 
					 | 
				
			||||||
        <line-breakpoint enabled="true" type="java-line">
 | 
					        <line-breakpoint enabled="true" type="java-line">
 | 
				
			||||||
          <url>file://$PROJECT_DIR$/src/main/java/core/entities/User.java</url>
 | 
					          <url>file://$PROJECT_DIR$/src/main/java/core/entities/User.java</url>
 | 
				
			||||||
          <line>57</line>
 | 
					          <line>57</line>
 | 
				
			||||||
          <option name="timeStamp" value="12" />
 | 
					          <option name="timeStamp" value="12" />
 | 
				
			||||||
        </line-breakpoint>
 | 
					        </line-breakpoint>
 | 
				
			||||||
 | 
					        <line-breakpoint enabled="true" type="java-line">
 | 
				
			||||||
 | 
					          <url>file://$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java</url>
 | 
				
			||||||
 | 
					          <line>52</line>
 | 
				
			||||||
 | 
					          <option name="timeStamp" value="32" />
 | 
				
			||||||
 | 
					        </line-breakpoint>
 | 
				
			||||||
      </breakpoints>
 | 
					      </breakpoints>
 | 
				
			||||||
    </breakpoint-manager>
 | 
					    </breakpoint-manager>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,131 +1,43 @@
 | 
				
			|||||||
package core.api.controller;
 | 
					package core.api.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import core.api.models.auth.SimpleStatusResponse;
 | 
					import core.api.models.auth.SimpleStatusResponse;
 | 
				
			||||||
import core.api.models.timemanager.taskSchedule.*;
 | 
					import core.api.models.timemanager.taskSchedule.*;
 | 
				
			||||||
import core.entities.User;
 | 
					import core.entities.timemanager.AbstractSchedule;
 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					import core.entities.timemanager.BasicTaskSchedule;
 | 
				
			||||||
import core.entities.timemanager.ScheduleType;
 | 
					 | 
				
			||||||
import core.entities.timemanager.Task;
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
import core.repositories.UserRepository;
 | 
					 | 
				
			||||||
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.beans.factory.annotation.Value;
 | 
				
			||||||
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.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.validation.Valid;
 | 
					import javax.validation.Valid;
 | 
				
			||||||
import java.util.*;
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@CrossOrigin(origins = "*", maxAge = 3600)
 | 
					@CrossOrigin(origins = "*", maxAge = 3600)
 | 
				
			||||||
@RestController
 | 
					@RestController
 | 
				
			||||||
@RequestMapping("/api")
 | 
					@RequestMapping("/api")
 | 
				
			||||||
public class ScheduleController {
 | 
					public class ScheduleController {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final TaskService taskService;
 | 
					    @Autowired private TaskScheduleService taskScheduleService;
 | 
				
			||||||
    private final TaskScheduleService taskScheduleService;
 | 
					    @Autowired private TaskService taskService;
 | 
				
			||||||
    private final BasicTaskScheduleRepository basicTaskScheduleRepository;
 | 
					 | 
				
			||||||
    private final UserRepository userRepository;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public ScheduleController(@Autowired TaskService taskService, @Autowired TaskScheduleService taskScheduleService,
 | 
					 | 
				
			||||||
                              BasicTaskScheduleRepository basicTaskScheduleRepository,
 | 
					 | 
				
			||||||
                              UserRepository userRepository) {
 | 
					 | 
				
			||||||
        this.taskService = taskService;
 | 
					 | 
				
			||||||
        this.taskScheduleService = taskScheduleService;
 | 
					 | 
				
			||||||
        this.basicTaskScheduleRepository = basicTaskScheduleRepository;
 | 
					 | 
				
			||||||
        this.userRepository = userRepository;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @GetMapping("/schedules/{taskID}/{scheduleType}")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> loadSchedulesOfTask(@PathVariable long taskID, @PathVariable ScheduleType scheduleType) {
 | 
					 | 
				
			||||||
        PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					 | 
				
			||||||
        if(!taskPermissionResult.isHasPermissions()) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(taskPermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        switch (scheduleType) {
 | 
					 | 
				
			||||||
            case BASIC -> {
 | 
					 | 
				
			||||||
                List<BasicTaskSchedule> basicTaskScheduleList = new ArrayList<>(taskPermissionResult.getResult().getBasicTaskSchedules());
 | 
					 | 
				
			||||||
                basicTaskScheduleList.sort(Comparator.comparing(BasicTaskSchedule::getScheduleDate));
 | 
					 | 
				
			||||||
                return ResponseEntity.ok(basicTaskScheduleList.stream().map(BasicTaskScheduleEntityInfo::new));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            case ADVANCED, MODERATE -> ResponseEntity.ok(new ArrayList<>());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @PutMapping("/schedules/{taskID}/basic")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> basicScheduleTask(@PathVariable long taskID, @Valid @RequestBody BasicTaskScheduleFieldInfo basicTaskSchedule) {
 | 
					 | 
				
			||||||
        PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					 | 
				
			||||||
        if(!taskPermissionResult.isHasPermissions()) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(taskPermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ServiceResult<BasicTaskSchedule> creationResult = taskScheduleService.createBasicTaskSchedule(taskPermissionResult.getResult(), basicTaskSchedule);
 | 
					 | 
				
			||||||
        return ResponseEntity.ok(new BasicTaskScheduleEntityInfo(creationResult.getResult()));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @PostMapping("/schedules/{scheduleID}/basic")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> editScheduledTask(@PathVariable long scheduleID, @Valid @RequestBody BasicTaskScheduleFieldInfo basicTaskScheduleFieldInfo) {
 | 
					 | 
				
			||||||
        PermissionResult<BasicTaskSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					 | 
				
			||||||
        if(!permissionResult.isHasPermissions()) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        taskScheduleService.reschedule(permissionResult.getResult(), basicTaskScheduleFieldInfo);
 | 
					 | 
				
			||||||
        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @DeleteMapping("/schedules/{scheduleID}/{scheduleType}")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> deleteScheduledTask(@PathVariable long scheduleID, @PathVariable ScheduleType scheduleType) {
 | 
					 | 
				
			||||||
        PermissionResult<BasicTaskSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					 | 
				
			||||||
        if(!permissionResult.isHasPermissions()) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        taskScheduleService.deleteBasicSchedule(permissionResult.getResult());
 | 
					 | 
				
			||||||
        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @GetMapping("/schedules/today/{activateable}")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> loadTodaysSchedules(@PathVariable boolean activateable) {
 | 
					 | 
				
			||||||
        ServiceResult<List<BasicTaskSchedule>> todaysSchedules = taskScheduleService.loadTodaysSchedule(SecurityContextHolder.getContext().getAuthentication().getName(), activateable);
 | 
					 | 
				
			||||||
        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")
 | 
					    @GetMapping("/schedules")
 | 
				
			||||||
    public ResponseEntity<?> loadSchedules() {
 | 
					    public ResponseEntity<?> loadAllSchedulesOfUser() {
 | 
				
			||||||
        ServiceResult<List<BasicTaskSchedule>> schedules = taskScheduleService.loadSchedules(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					        String username = SecurityContextHolder.getContext().getAuthentication().getName();
 | 
				
			||||||
        if(schedules.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					        List<AbstractSchedule> schedules = taskScheduleService.getAllSchedulesOfUser(username);
 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					
 | 
				
			||||||
        } else {
 | 
					        return ResponseEntity.ok(schedules.stream().map(AbstractSchedule::toScheduleInfo).toList());
 | 
				
			||||||
            return ResponseEntity.ok(schedules.getResult().stream().map(ScheduleInfo::new).toList());
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					
 | 
				
			||||||
    @PostMapping("/schedules/{taskID}/now")
 | 
					    @GetMapping("/schedules/{taskID}")
 | 
				
			||||||
    public ResponseEntity<?> scheduleTaskNow(@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.isHasPermissions()) {
 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -133,79 +45,107 @@ public class ScheduleController {
 | 
				
			|||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ServiceResult<BasicTaskSchedule> scheduleResult = taskScheduleService.scheduleTaskNow(permissionResult.getResult());
 | 
					        List<AbstractSchedule> taskSchedules = permissionResult.getResult().getBasicTaskSchedules();
 | 
				
			||||||
 | 
					        return ResponseEntity.ok(taskSchedules.stream().map(AbstractSchedule::toScheduleInfo).toList());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PutMapping("/schedules/{taskID}")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> createSchedule(@PathVariable long taskID, @RequestBody @Valid ScheduleFieldInfo scheduleFieldInfo) {
 | 
				
			||||||
 | 
					        PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(scheduleFieldInfo instanceof BasicScheduleFieldInfo) {
 | 
				
			||||||
 | 
					            ServiceResult<AbstractSchedule> scheduleResult = taskScheduleService.scheduleBasic(permissionResult.getResult(), (BasicScheduleFieldInfo) scheduleFieldInfo);
 | 
				
			||||||
 | 
					            return ResponseEntity.ok(scheduleResult.getResult().toScheduleInfo());
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/schedules/{scheduleID}")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> editSchedule(@PathVariable long scheduleID, @RequestBody @Valid ScheduleFieldInfo scheduleFieldInfo) {
 | 
				
			||||||
 | 
					        PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(permissionResult.getResult() instanceof BasicTaskSchedule && scheduleFieldInfo instanceof BasicScheduleFieldInfo) {
 | 
				
			||||||
 | 
					            ServiceResult<AbstractSchedule> updatedSchedule = taskScheduleService.editBasicSchedule((BasicTaskSchedule) permissionResult.getResult(), (BasicScheduleFieldInfo) scheduleFieldInfo);
 | 
				
			||||||
 | 
					            if(updatedSchedule.getExitCode() == ServiceExitCode.INVALID_OPERATION) {
 | 
				
			||||||
 | 
					                return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                return ResponseEntity.ok(updatedSchedule.getResult().toScheduleInfo());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @DeleteMapping("/schedules/{scheduleID}")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> deleteSchedule(@PathVariable long scheduleID) {
 | 
				
			||||||
 | 
					        PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        taskScheduleService.deleteSchedule(permissionResult.getResult());
 | 
				
			||||||
 | 
					        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/schedules/{date}/{startable}")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> loadFilteredSchedulesOfUser(@PathVariable String date, @PathVariable boolean startable) {
 | 
				
			||||||
 | 
					        List<AbstractSchedule> abstractSchedules = taskScheduleService.getFilteredScheduledOfUser(LocalDate.parse(date), startable, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return ResponseEntity.ok(abstractSchedules.stream().map(AbstractSchedule::toScheduleInfo).toList());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/schedules/{taskID}/now")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> scheduleNow(@PathVariable long taskID) {
 | 
				
			||||||
 | 
					        PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> scheduleResult = taskScheduleService.scheduleNow(permissionResult.getResult());
 | 
				
			||||||
        if(scheduleResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
 | 
					        if(scheduleResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
 | 
				
			||||||
            return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            return ResponseEntity.ok(new ScheduleInfo(scheduleResult.getResult()));
 | 
					            return ResponseEntity.ok(scheduleResult.getResult().toScheduleInfo());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/schedules/active")
 | 
					    @GetMapping("/schedules/active")
 | 
				
			||||||
    public ResponseEntity<?> getActiveSchedule() {
 | 
					    public ResponseEntity<?> getActiveSchedule() {
 | 
				
			||||||
        ServiceResult<BasicTaskSchedule> activeScheduleResult = taskScheduleService.getActiveSchedule(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					        ServiceResult<AbstractSchedule> serviceResult = taskScheduleService.getActiveSchedule(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
        if(activeScheduleResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					        if(serviceResult.getExitCode() == ServiceExitCode.OK) {
 | 
				
			||||||
            return ResponseEntity.ok(new ScheduleInfo());
 | 
					            return ResponseEntity.ok(serviceResult.getResult().toScheduleInfo());
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            return ResponseEntity.ok(new ScheduleInfo(activeScheduleResult.getResult()));
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @PostMapping("/schedules/{scheduleID}/activate")
 | 
					    @PostMapping("/schedules/{scheduleID}/activate")
 | 
				
			||||||
    public ResponseEntity<?> activateSchedule(@PathVariable long scheduleID) {
 | 
					    public ResponseEntity<?> activateSchedule(@PathVariable long scheduleID) {
 | 
				
			||||||
        PermissionResult<BasicTaskSchedule> schedulePermissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					        PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
        if(!schedulePermissionResult.isHasPermissions()) {
 | 
					        if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(schedulePermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ServiceResult<BasicTaskSchedule> scheduleActivateResult = taskScheduleService.activateSchedule(schedulePermissionResult.getResult());
 | 
					 | 
				
			||||||
        if(scheduleActivateResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        } else if(scheduleActivateResult.getExitCode() == ServiceExitCode.OK){
 | 
					 | 
				
			||||||
            return ResponseEntity.ok(new ScheduleActivateInfo(scheduleActivateResult.getResult().getStartTime()));
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @PostMapping("/schedules/{scheduleID}/stop/{finish}")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> stopSchedule(@PathVariable long scheduleID, @PathVariable boolean finish) {
 | 
					 | 
				
			||||||
        PermissionResult<BasicTaskSchedule> schedulePermissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					 | 
				
			||||||
        if(!schedulePermissionResult.isHasPermissions()) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(schedulePermissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ServiceResult<Integer> stopResult = taskScheduleService.stopSchedule(schedulePermissionResult.getResult(), finish);
 | 
					 | 
				
			||||||
        if(stopResult.getExitCode() == ServiceExitCode.INVALID_OPERATION) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            return ResponseEntity.ok(new TaskScheduleStopResponse(stopResult.getResult()));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @GetMapping("/schedules/status/today")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> getWorkedMinutesToday() {
 | 
					 | 
				
			||||||
        Optional<User> user = userRepository.findByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					 | 
				
			||||||
        if(user.isEmpty()) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        int workedMinutes = taskScheduleService.getWorkedMinutes(user.get());
 | 
					 | 
				
			||||||
        return ResponseEntity.ok(new ScheduleStatus(workedMinutes, taskScheduleService.isAnyScheduleMissed(user.get())));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @PostMapping("/schedules/{taskID}/forgotten")
 | 
					 | 
				
			||||||
    public ResponseEntity<?> registerForgottenActivity(@PathVariable long taskID, @Valid @RequestBody ForgottenActivity forgottenActivity) {
 | 
					 | 
				
			||||||
        PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					 | 
				
			||||||
        if(!permissionResult.isHasPermissions()) {
 | 
					 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -213,42 +153,67 @@ public class ScheduleController {
 | 
				
			|||||||
            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ServiceResult<Integer> serviceResult = taskScheduleService.registerForgottenActivity(permissionResult.getResult(), forgottenActivity);
 | 
					        ServiceResult<AbstractSchedule> serviceResult = taskScheduleService.activateSchedule(permissionResult.getResult());
 | 
				
			||||||
        if(serviceResult.getExitCode() == ServiceExitCode.INVALID_OPERATION) {
 | 
					        return ResponseEntity.ok(new ScheduleActivateResponse(serviceResult.getResult().getStartTime()));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/schedules/{scheduleID}/stop/{finish}")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> stopSchedule(@PathVariable long scheduleID, @PathVariable boolean finish) {
 | 
				
			||||||
 | 
					        PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> serviceResult = taskScheduleService.stopSchedule(permissionResult.getResult(), finish);
 | 
				
			||||||
 | 
					        return ResponseEntity.ok(new TaskScheduleStopResponse(serviceResult.getResult().getActiveTime()));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @PostMapping("/schedules/{taskID}/forgotten")
 | 
				
			||||||
 | 
					    public ResponseEntity<?> registerForgottenSchedule(@PathVariable long taskID, @RequestBody @Valid ForgottenScheduleInfo forgottenScheduleInfo) {
 | 
				
			||||||
 | 
					        PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
 | 
					        if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
 | 
					            return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> scheduleResult = taskScheduleService.registerForgottenSchedule(permissionResult.getResult(), forgottenScheduleInfo);
 | 
				
			||||||
 | 
					        if(scheduleResult.getExitCode() == ServiceExitCode.INVALID_OPERATION) {
 | 
				
			||||||
            return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
 | 
					            return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            return ResponseEntity.ok(new TaskScheduleStopResponse(serviceResult.getResult()));
 | 
					            return ResponseEntity.ok(new TaskScheduleStopResponse(scheduleResult.getResult().getActiveTime()));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/schedules/missed")
 | 
					    @GetMapping("/schedules/missed")
 | 
				
			||||||
    public ResponseEntity<?> loadMissedSchedules() {
 | 
					    public ResponseEntity<?> loadMissedSchedules() {
 | 
				
			||||||
        Optional<User> user = userRepository.findByUsername(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					        List<AbstractSchedule> missedSchedules = taskScheduleService.getAllMissedSchedulesOfUser(SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
        if(user.isEmpty()) {
 | 
					        return ResponseEntity.ok(missedSchedules.stream().map(AbstractSchedule::toScheduleInfo).toList());
 | 
				
			||||||
            return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        List<BasicTaskSchedule> schedules = taskScheduleService.loadMissedSchedules(user.get());
 | 
					 | 
				
			||||||
        return ResponseEntity.ok(schedules.stream().map(ScheduleInfo::new).toList());
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @DeleteMapping("/schedules/{scheduleIDs}/all")
 | 
					    @DeleteMapping("/schedules/{scheduleIDs}/all")
 | 
				
			||||||
    public ResponseEntity<?> deleteSchedules(@PathVariable long[] scheduleIDs) {
 | 
					    public ResponseEntity<?> deleteSchedules(@PathVariable long[] scheduleIDs) {
 | 
				
			||||||
        List<BasicTaskSchedule> schedulesToDelete = new LinkedList<>();
 | 
					        List<PermissionResult<AbstractSchedule>> permissionResults = new ArrayList<>();
 | 
				
			||||||
        for(long scheduleID: scheduleIDs) {
 | 
					        for(long scheduleID: scheduleIDs) {
 | 
				
			||||||
            PermissionResult<BasicTaskSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
					            PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
 | 
				
			||||||
            if(!permissionResult.isHasPermissions()) {
 | 
					            if(permissionResult.isHasPermissions()) {
 | 
				
			||||||
                return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
					                return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					            if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
				
			||||||
                return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
					                return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            schedulesToDelete.add(permissionResult.getResult());
 | 
					            permissionResults.add(permissionResult);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for(BasicTaskSchedule schedule : schedulesToDelete) {
 | 
					        for(PermissionResult<AbstractSchedule> permissionResult : permissionResults) {
 | 
				
			||||||
            this.taskScheduleService.deleteBasicSchedule(schedule);
 | 
					            taskScheduleService.deleteSchedule(permissionResult.getResult());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
					        return ResponseEntity.ok(new SimpleStatusResponse("success"));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,6 @@
 | 
				
			|||||||
package core.api.controller;
 | 
					package core.api.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import core.api.models.auth.SimpleStatusResponse;
 | 
					import core.api.models.auth.SimpleStatusResponse;
 | 
				
			||||||
import core.api.models.timemanager.taskSchedule.ScheduleInfo;
 | 
					 | 
				
			||||||
import core.api.models.timemanager.tasks.*;
 | 
					import core.api.models.timemanager.tasks.*;
 | 
				
			||||||
import core.entities.timemanager.Task;
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
import core.entities.timemanager.Taskgroup;
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
@ -13,7 +12,6 @@ import org.springframework.web.bind.annotation.*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import javax.validation.Valid;
 | 
					import javax.validation.Valid;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.LinkedList;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@CrossOrigin(origins = "*", maxAge = 3600)
 | 
					@CrossOrigin(origins = "*", maxAge = 3600)
 | 
				
			||||||
 | 
				
			|||||||
@ -3,10 +3,18 @@ package core.api.models.timemanager.taskSchedule;
 | 
				
			|||||||
import javax.validation.constraints.NotNull;
 | 
					import javax.validation.constraints.NotNull;
 | 
				
			||||||
import java.time.LocalDate;
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class BasicTaskScheduleFieldInfo {
 | 
					public class BasicScheduleFieldInfo extends ScheduleFieldInfo{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NotNull
 | 
					    @NotNull
 | 
				
			||||||
    private LocalDate scheduleDate;
 | 
					    private LocalDate scheduleDate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public BasicScheduleFieldInfo(LocalDate localDate) {
 | 
				
			||||||
 | 
					        this.scheduleDate = localDate;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public BasicScheduleFieldInfo() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public LocalDate getScheduleDate() {
 | 
					    public LocalDate getScheduleDate() {
 | 
				
			||||||
        return scheduleDate;
 | 
					        return scheduleDate;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
 | 
				
			||||||
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class BasicScheduleInfo extends ScheduleInfo{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private LocalDate scheduleDate;
 | 
				
			||||||
 | 
					    public BasicScheduleInfo(long scheduleID, ScheduleType scheduleType, LocalDateTime startTime, LocalDateTime stopTime, int activeMinutes, Task task, List<TaskgroupEntityInfo> taskgroupPath) {
 | 
				
			||||||
 | 
					        super(scheduleID, scheduleType, startTime, stopTime, activeMinutes, task, taskgroupPath);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public BasicScheduleInfo(long scheduleID) {
 | 
				
			||||||
 | 
					        super(scheduleID, ScheduleType.BASIC, null, null, 0, null, new ArrayList<>());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDate getScheduleDate() {
 | 
				
			||||||
 | 
					        return scheduleDate;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setScheduleDate(LocalDate scheduleDate) {
 | 
				
			||||||
 | 
					        this.scheduleDate = scheduleDate;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,22 +0,0 @@
 | 
				
			|||||||
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;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,53 +0,0 @@
 | 
				
			|||||||
package core.api.models.timemanager.taskSchedule;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.time.LocalDate;
 | 
					 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class BasicTaskScheduleEntityInfo {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private long scheduleID;
 | 
					 | 
				
			||||||
    private LocalDate scheduleDate;
 | 
					 | 
				
			||||||
    private LocalDateTime startTime;
 | 
					 | 
				
			||||||
    private LocalDateTime finishedTime;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public BasicTaskScheduleEntityInfo(BasicTaskSchedule basicTaskSchedule) {
 | 
					 | 
				
			||||||
        this.scheduleID = basicTaskSchedule.getScheduleID();
 | 
					 | 
				
			||||||
        this.scheduleDate = basicTaskSchedule.getScheduleDate();
 | 
					 | 
				
			||||||
        this.startTime = basicTaskSchedule.getStartTime();
 | 
					 | 
				
			||||||
        this.finishedTime = basicTaskSchedule.getFinishedTime();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public long getScheduleID() {
 | 
					 | 
				
			||||||
        return scheduleID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setScheduleID(long scheduleID) {
 | 
					 | 
				
			||||||
        this.scheduleID = scheduleID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public LocalDate getScheduleDate() {
 | 
					 | 
				
			||||||
        return scheduleDate;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setScheduleDate(LocalDate scheduleDate) {
 | 
					 | 
				
			||||||
        this.scheduleDate = scheduleDate;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public LocalDateTime getStartTime() {
 | 
					 | 
				
			||||||
        return startTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setStartTime(LocalDateTime startTime) {
 | 
					 | 
				
			||||||
        this.startTime = startTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public LocalDateTime getFinishedTime() {
 | 
					 | 
				
			||||||
        return finishedTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setFinishedTime(LocalDateTime finishedTime) {
 | 
					 | 
				
			||||||
        this.finishedTime = finishedTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,22 +0,0 @@
 | 
				
			|||||||
package core.api.models.timemanager.taskSchedule;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class ForgottenActivity {
 | 
					 | 
				
			||||||
    private ForgottenActivityMode mode;
 | 
					 | 
				
			||||||
    private int minutesSpent;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public ForgottenActivityMode getMode() {
 | 
					 | 
				
			||||||
        return mode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setMode(ForgottenActivityMode mode) {
 | 
					 | 
				
			||||||
        this.mode = mode;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int getMinutesSpent() {
 | 
					 | 
				
			||||||
        return minutesSpent;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setMinutesSpent(int minutesSpent) {
 | 
					 | 
				
			||||||
        this.minutesSpent = minutesSpent;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,8 +0,0 @@
 | 
				
			|||||||
package core.api.models.timemanager.taskSchedule;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public enum ForgottenActivityMode {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    MANUAL,
 | 
					 | 
				
			||||||
    LAST,
 | 
					 | 
				
			||||||
    PLANNED
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.validation.constraints.NotNull;
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ForgottenScheduleInfo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull
 | 
				
			||||||
 | 
					    private LocalDateTime startTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @NotNull
 | 
				
			||||||
 | 
					    private LocalDateTime endTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ForgottenScheduleInfo(LocalDateTime startTime, LocalDateTime endTime) {
 | 
				
			||||||
 | 
					        this.startTime = startTime;
 | 
				
			||||||
 | 
					        this.endTime = endTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ForgottenScheduleInfo() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDateTime getStartTime() {
 | 
				
			||||||
 | 
					        return startTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setStartTime(LocalDateTime startTime) {
 | 
				
			||||||
 | 
					        this.startTime = startTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDateTime getEndTime() {
 | 
				
			||||||
 | 
					        return endTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setEndTime(LocalDateTime endTime) {
 | 
				
			||||||
 | 
					        this.endTime = endTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,16 +1,17 @@
 | 
				
			|||||||
package core.api.models.timemanager.taskSchedule;
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.time.LocalDate;
 | 
					 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ScheduleActivateInfo {
 | 
					public class ScheduleActivateResponse {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private LocalDateTime startTime;
 | 
					    private LocalDateTime startTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ScheduleActivateInfo(LocalDateTime startTime) {
 | 
					    public ScheduleActivateResponse(LocalDateTime startTime) {
 | 
				
			||||||
        this.startTime = startTime;
 | 
					        this.startTime = startTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public ScheduleActivateResponse() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public LocalDateTime getStartTime() {
 | 
					    public LocalDateTime getStartTime() {
 | 
				
			||||||
        return startTime;
 | 
					        return startTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package core.api.models.timemanager.taskSchedule;
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public abstract class AbstractScheduleShortInfo {
 | 
					public abstract class ScheduleFieldInfo {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,114 +1,38 @@
 | 
				
			|||||||
package core.api.models.timemanager.taskSchedule;
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
 | 
					import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
 | 
				
			||||||
import core.api.models.timemanager.tasks.TaskShortInfo;
 | 
					import core.api.models.timemanager.tasks.TaskShortInfo;
 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
import core.entities.timemanager.ScheduleType;
 | 
					 | 
				
			||||||
import core.entities.timemanager.Taskgroup;
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.time.Duration;
 | 
					 | 
				
			||||||
import java.time.LocalDate;
 | 
					 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ScheduleInfo {
 | 
					public abstract class ScheduleInfo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @JsonProperty
 | 
				
			||||||
    private long scheduleID;
 | 
					    private long scheduleID;
 | 
				
			||||||
 | 
					    @JsonProperty
 | 
				
			||||||
    private ScheduleType scheduleType;
 | 
					    private ScheduleType scheduleType;
 | 
				
			||||||
 | 
					    @JsonProperty
 | 
				
			||||||
    private LocalDateTime startTime;
 | 
					    private LocalDateTime startTime;
 | 
				
			||||||
 | 
					    @JsonProperty
 | 
				
			||||||
    private LocalDateTime finishTime;
 | 
					    private LocalDateTime stopTime;
 | 
				
			||||||
 | 
					    @JsonProperty
 | 
				
			||||||
    private int activeMinutes;
 | 
					    private int activeMinutes;
 | 
				
			||||||
    private AbstractScheduleShortInfo schedule;
 | 
					    @JsonProperty
 | 
				
			||||||
 | 
					    private TaskShortInfo task;
 | 
				
			||||||
 | 
					    @JsonProperty
 | 
				
			||||||
    private List<TaskgroupEntityInfo> taskgroupPath;
 | 
					    private List<TaskgroupEntityInfo> taskgroupPath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private TaskShortInfo task;
 | 
					    public ScheduleInfo(long scheduleID, ScheduleType scheduleType, LocalDateTime startTime, LocalDateTime stopTime, int activeMinutes, Task task, List<TaskgroupEntityInfo> taskgroupPath) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    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.startTime != null) {
 | 
					 | 
				
			||||||
            this.activeMinutes = (int) Duration.between(basicTaskSchedule.getStartTime(), LocalDateTime.now()).toMinutes();
 | 
					 | 
				
			||||||
        } else if(this.startTime != null){
 | 
					 | 
				
			||||||
            this.activeMinutes = (int) Duration.between(basicTaskSchedule.getStartTime(), basicTaskSchedule.getFinishedTime()).toMinutes();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        this.schedule = new BasicScheduleShortInfo(basicTaskSchedule);
 | 
					 | 
				
			||||||
        this.task = new TaskShortInfo(basicTaskSchedule.getTask());
 | 
					 | 
				
			||||||
        List<Taskgroup> taskgroupPath = Taskgroup.getAncestorList(basicTaskSchedule.getTask().getTaskgroup());
 | 
					 | 
				
			||||||
        taskgroupPath.add(basicTaskSchedule.getTask().getTaskgroup());
 | 
					 | 
				
			||||||
        this.taskgroupPath = taskgroupPath.stream().map(TaskgroupEntityInfo::new).toList();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public ScheduleInfo() {
 | 
					 | 
				
			||||||
        this.scheduleID = -1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public long getScheduleID() {
 | 
					 | 
				
			||||||
        return scheduleID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setScheduleID(long scheduleID) {
 | 
					 | 
				
			||||||
        this.scheduleID = scheduleID;
 | 
					        this.scheduleID = scheduleID;
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public ScheduleType getScheduleType() {
 | 
					 | 
				
			||||||
        return scheduleType;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setScheduleType(ScheduleType scheduleType) {
 | 
					 | 
				
			||||||
        this.scheduleType = scheduleType;
 | 
					        this.scheduleType = scheduleType;
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public LocalDateTime getStartTime() {
 | 
					 | 
				
			||||||
        return startTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setStartTime(LocalDateTime startTime) {
 | 
					 | 
				
			||||||
        this.startTime = startTime;
 | 
					        this.startTime = startTime;
 | 
				
			||||||
    }
 | 
					        this.stopTime = stopTime;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    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;
 | 
					        this.activeMinutes = activeMinutes;
 | 
				
			||||||
    }
 | 
					        this.task = new TaskShortInfo(task);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public AbstractScheduleShortInfo getSchedule() {
 | 
					 | 
				
			||||||
        return schedule;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setSchedule(AbstractScheduleShortInfo schedule) {
 | 
					 | 
				
			||||||
        this.schedule = schedule;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public List<TaskgroupEntityInfo> getTaskgroupPath() {
 | 
					 | 
				
			||||||
        return taskgroupPath;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setTaskgroupPath(List<TaskgroupEntityInfo> taskgroupPath) {
 | 
					 | 
				
			||||||
        this.taskgroupPath = taskgroupPath;
 | 
					        this.taskgroupPath = taskgroupPath;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public TaskShortInfo getTask() {
 | 
					 | 
				
			||||||
        return task;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setTask(TaskShortInfo task) {
 | 
					 | 
				
			||||||
        this.task = task;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,28 +0,0 @@
 | 
				
			|||||||
package core.api.models.timemanager.taskSchedule;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class ScheduleStatus {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private int activeMinutes;
 | 
					 | 
				
			||||||
    private boolean missedSchedules;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public ScheduleStatus(int activeMinutes, boolean missedSchedules) {
 | 
					 | 
				
			||||||
        this.activeMinutes = activeMinutes;
 | 
					 | 
				
			||||||
        this.missedSchedules = missedSchedules;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int getActiveMinutes() {
 | 
					 | 
				
			||||||
        return activeMinutes;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setActiveMinutes(int activeMinutes) {
 | 
					 | 
				
			||||||
        this.activeMinutes = activeMinutes;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean isMissedSchedules() {
 | 
					 | 
				
			||||||
        return missedSchedules;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setMissedSchedules(boolean missedSchedules) {
 | 
					 | 
				
			||||||
        this.missedSchedules = missedSchedules;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package core.api.models.timemanager.taskSchedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public enum ScheduleType {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    BASIC,
 | 
				
			||||||
 | 
					    MODERATE,
 | 
				
			||||||
 | 
					    ADVANCED;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -2,17 +2,17 @@ package core.api.models.timemanager.taskSchedule;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class TaskScheduleStopResponse {
 | 
					public class TaskScheduleStopResponse {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private int workTime;
 | 
					    private int activeTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public TaskScheduleStopResponse(int workTime) {
 | 
					    public TaskScheduleStopResponse(int activeTime) {
 | 
				
			||||||
        this.workTime = workTime;
 | 
					        this.activeTime = activeTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public int getWorkTime() {
 | 
					    public int getActiveTime() {
 | 
				
			||||||
        return workTime;
 | 
					        return activeTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setWorkTime(int workTime) {
 | 
					    public void setActiveTime(int activeTime) {
 | 
				
			||||||
        this.workTime = workTime;
 | 
					        this.activeTime = activeTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,112 @@
 | 
				
			|||||||
 | 
					package core.entities.timemanager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.ScheduleInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.persistence.*;
 | 
				
			||||||
 | 
					import java.time.Duration;
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Entity
 | 
				
			||||||
 | 
					@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 | 
				
			||||||
 | 
					@DiscriminatorColumn(name="scheduleType",
 | 
				
			||||||
 | 
					        discriminatorType = DiscriminatorType.INTEGER)
 | 
				
			||||||
 | 
					public abstract class AbstractSchedule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Id
 | 
				
			||||||
 | 
					    @GeneratedValue(strategy = GenerationType.IDENTITY)
 | 
				
			||||||
 | 
					    protected long scheduleID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @ManyToOne
 | 
				
			||||||
 | 
					    @JoinColumn(referencedColumnName = "taskID", name = "task")
 | 
				
			||||||
 | 
					    protected Task task;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected LocalDateTime startTime;
 | 
				
			||||||
 | 
					    protected LocalDateTime stopTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AbstractSchedule() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AbstractSchedule(Task task, LocalDateTime startTime, LocalDateTime stopTime) {
 | 
				
			||||||
 | 
					        this.task = task;
 | 
				
			||||||
 | 
					        this.startTime = startTime;
 | 
				
			||||||
 | 
					        this.stopTime = stopTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AbstractSchedule(Task task, LocalDateTime startTime) {
 | 
				
			||||||
 | 
					        this.task = task;
 | 
				
			||||||
 | 
					        this.startTime = startTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AbstractSchedule(Task task) {
 | 
				
			||||||
 | 
					        this.task = task;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public long getScheduleID() {
 | 
				
			||||||
 | 
					        return scheduleID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setScheduleID(long scheduleID) {
 | 
				
			||||||
 | 
					        this.scheduleID = scheduleID;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Task getTask() {
 | 
				
			||||||
 | 
					        return task;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setTask(Task task) {
 | 
				
			||||||
 | 
					        this.task = task;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDateTime getStartTime() {
 | 
				
			||||||
 | 
					        return startTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setStartTime(LocalDateTime startTime) {
 | 
				
			||||||
 | 
					        this.startTime = startTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LocalDateTime getStopTime() {
 | 
				
			||||||
 | 
					        return stopTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setStopTime(LocalDateTime stopTime) {
 | 
				
			||||||
 | 
					        this.stopTime = stopTime;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean equals(Object o) {
 | 
				
			||||||
 | 
					        if (this == o) return true;
 | 
				
			||||||
 | 
					        if (o == null || getClass() != o.getClass()) return false;
 | 
				
			||||||
 | 
					        AbstractSchedule that = (AbstractSchedule) o;
 | 
				
			||||||
 | 
					        return scheduleID == that.scheduleID && Objects.equals(task, that.task) && Objects.equals(startTime, that.startTime) && Objects.equals(stopTime, that.stopTime);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int hashCode() {
 | 
				
			||||||
 | 
					        return Objects.hash(scheduleID, task, startTime, stopTime);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public abstract ScheduleInfo toScheduleInfo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isActive() {
 | 
				
			||||||
 | 
					        return startTime != null && stopTime == null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getActiveTime() {
 | 
				
			||||||
 | 
					        if(startTime == null) {
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        } else if(stopTime == null) {
 | 
				
			||||||
 | 
					            return (int) Duration.between(startTime, LocalDateTime.now()).toMinutes();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return (int) Duration.between(startTime, stopTime).toMinutes();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isStartable() {
 | 
				
			||||||
 | 
					        return startTime == null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public abstract boolean isMissed(LocalDateTime timeReference);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					package core.entities.timemanager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.ScheduleInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.persistence.DiscriminatorValue;
 | 
				
			||||||
 | 
					import javax.persistence.Entity;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					@Entity
 | 
				
			||||||
 | 
					@DiscriminatorValue("1")
 | 
				
			||||||
 | 
					public class AdvancedTaskSchedule extends AbstractSchedule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private LocalDateTime scheduleStart;
 | 
				
			||||||
 | 
					    private LocalDateTime scheduleEnd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public ScheduleInfo toScheduleInfo() {
 | 
				
			||||||
 | 
					        return null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean isMissed(LocalDateTime timeReference) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,56 +1,40 @@
 | 
				
			|||||||
package core.entities.timemanager;
 | 
					package core.entities.timemanager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.BasicScheduleInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.ScheduleInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.ScheduleType;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.tasks.TaskEntityInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.persistence.*;
 | 
					import javax.persistence.*;
 | 
				
			||||||
 | 
					import java.time.Duration;
 | 
				
			||||||
import java.time.LocalDate;
 | 
					import java.time.LocalDate;
 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Objects;
 | 
					import java.util.Objects;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Entity
 | 
					@Entity
 | 
				
			||||||
@Table(name = "basic_schedules")
 | 
					@DiscriminatorValue("0")
 | 
				
			||||||
public class BasicTaskSchedule {
 | 
					public class BasicTaskSchedule extends AbstractSchedule{
 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Id
 | 
					 | 
				
			||||||
    @GeneratedValue(strategy = GenerationType.AUTO)
 | 
					 | 
				
			||||||
    private long scheduleID;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @ManyToOne
 | 
					 | 
				
			||||||
    @JoinColumn(referencedColumnName = "taskID", name = "task")
 | 
					 | 
				
			||||||
    private Task task;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
   private LocalDate scheduleDate;
 | 
					   private LocalDate scheduleDate;
 | 
				
			||||||
    private LocalDateTime startTime;
 | 
					 | 
				
			||||||
    private LocalDateTime finishedTime;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public BasicTaskSchedule(Task task, LocalDate scheduleDate) {
 | 
					 | 
				
			||||||
        this.task = task;
 | 
					 | 
				
			||||||
        this.scheduleDate = scheduleDate;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public BasicTaskSchedule() {
 | 
					    public BasicTaskSchedule() {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void start() {
 | 
					    public BasicTaskSchedule(Task task, LocalDateTime startTime, LocalDateTime stopTime, LocalDate scheduleDate) {
 | 
				
			||||||
        this.startTime = LocalDateTime.now();
 | 
					        super(task, startTime, stopTime);
 | 
				
			||||||
 | 
					        this.scheduleDate = scheduleDate;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void end() {
 | 
					    public BasicTaskSchedule(Task task, LocalDateTime startTime) {
 | 
				
			||||||
        this.finishedTime = LocalDateTime.now();
 | 
					        super(task, startTime);
 | 
				
			||||||
 | 
					        this.scheduleDate = startTime.toLocalDate();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public long getScheduleID() {
 | 
					    public BasicTaskSchedule(Task task, LocalDate scheduleDate) {
 | 
				
			||||||
        return scheduleID;
 | 
					        super(task);
 | 
				
			||||||
    }
 | 
					        this.scheduleDate = scheduleDate;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setScheduleID(long scheduleID) {
 | 
					 | 
				
			||||||
        this.scheduleID = scheduleID;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Task getTask() {
 | 
					 | 
				
			||||||
        return task;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setTask(Task task) {
 | 
					 | 
				
			||||||
        this.task = task;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public LocalDate getScheduleDate() {
 | 
					    public LocalDate getScheduleDate() {
 | 
				
			||||||
@ -61,36 +45,26 @@ public class BasicTaskSchedule {
 | 
				
			|||||||
        this.scheduleDate = scheduleDate;
 | 
					        this.scheduleDate = scheduleDate;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public LocalDateTime getStartTime() {
 | 
					    public ScheduleInfo toScheduleInfo() {
 | 
				
			||||||
        return startTime;
 | 
					        int activeMinutes = calcActiveMinutes();
 | 
				
			||||||
    }
 | 
					        List<TaskgroupEntityInfo> taskgroupEntityInfos = Taskgroup.getAncestorList(task.getTaskgroup()).stream().map(TaskgroupEntityInfo::new).toList();
 | 
				
			||||||
 | 
					        return new BasicScheduleInfo(scheduleID, ScheduleType.BASIC, startTime, stopTime, activeMinutes, task, taskgroupEntityInfos);
 | 
				
			||||||
    public void setStartTime(LocalDateTime startTime) {
 | 
					 | 
				
			||||||
        this.startTime = startTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public LocalDateTime getFinishedTime() {
 | 
					 | 
				
			||||||
        return finishedTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setFinishedTime(LocalDateTime finishedTime) {
 | 
					 | 
				
			||||||
        this.finishedTime = finishedTime;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean isActivateAble() {
 | 
					 | 
				
			||||||
        return startTime == null;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean equals(Object o) {
 | 
					    public boolean isMissed(LocalDateTime timeReference) {
 | 
				
			||||||
        if (this == o) return true;
 | 
					        return startTime == null && scheduleDate.isBefore(timeReference.toLocalDate());
 | 
				
			||||||
        if (o == null || getClass() != o.getClass()) return false;
 | 
					 | 
				
			||||||
        BasicTaskSchedule that = (BasicTaskSchedule) o;
 | 
					 | 
				
			||||||
        return scheduleID == that.scheduleID;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    public int calcActiveMinutes() {
 | 
				
			||||||
    public int hashCode() {
 | 
					        if(startTime == null) {
 | 
				
			||||||
        return Objects.hash(scheduleID);
 | 
					            return 0;
 | 
				
			||||||
 | 
					        } else if(stopTime == null) {
 | 
				
			||||||
 | 
					            Duration duration = Duration.between(startTime, LocalDateTime.now());
 | 
				
			||||||
 | 
					            return (int) duration.toMinutes();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            Duration duration = Duration.between(startTime, stopTime);
 | 
				
			||||||
 | 
					            return (int) duration.toMinutes();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ package core.entities.timemanager;
 | 
				
			|||||||
import javax.persistence.*;
 | 
					import javax.persistence.*;
 | 
				
			||||||
import java.time.LocalDate;
 | 
					import java.time.LocalDate;
 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Objects;
 | 
					import java.util.Objects;
 | 
				
			||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
@ -29,7 +30,7 @@ public class Task {
 | 
				
			|||||||
    private boolean finished;
 | 
					    private boolean finished;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @OneToMany(mappedBy = "task", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
 | 
					    @OneToMany(mappedBy = "task", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
 | 
				
			||||||
    private List<BasicTaskSchedule> basicTaskSchedules;
 | 
					    private List<AbstractSchedule> basicTaskSchedules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private int workTime;
 | 
					    private int workTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -117,27 +118,14 @@ public class Task {
 | 
				
			|||||||
        this.taskID = taskID;
 | 
					        this.taskID = taskID;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public List<BasicTaskSchedule> getBasicTaskSchedules() {
 | 
					    public List<AbstractSchedule> getBasicTaskSchedules() {
 | 
				
			||||||
        return basicTaskSchedules;
 | 
					        return basicTaskSchedules;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setBasicTaskSchedules(List<BasicTaskSchedule> basicTaskSchedules) {
 | 
					    public void setBasicTaskSchedules(List<AbstractSchedule> basicTaskSchedules) {
 | 
				
			||||||
        this.basicTaskSchedules = basicTaskSchedules;
 | 
					        this.basicTaskSchedules = basicTaskSchedules;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean hasActiveSchedule() {
 | 
					 | 
				
			||||||
        for(BasicTaskSchedule basicTaskSchedule : basicTaskSchedules) {
 | 
					 | 
				
			||||||
           if(basicTaskSchedule.getStartTime() != null && basicTaskSchedule.getFinishedTime() == null) {
 | 
					 | 
				
			||||||
               return true;
 | 
					 | 
				
			||||||
           }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void increaseActiveTime(int minutesSpent) {
 | 
					 | 
				
			||||||
        this.workTime += minutesSpent;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean equals(Object o) {
 | 
					    public boolean equals(Object o) {
 | 
				
			||||||
        if (this == o) return true;
 | 
					        if (this == o) return true;
 | 
				
			||||||
@ -164,4 +152,23 @@ public class Task {
 | 
				
			|||||||
                ", workTime=" + workTime +
 | 
					                ", workTime=" + workTime +
 | 
				
			||||||
                '}';
 | 
					                '}';
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean hasActiveSchedule() {
 | 
				
			||||||
 | 
					        for (AbstractSchedule schedule : getBasicTaskSchedules()) {
 | 
				
			||||||
 | 
					            if (schedule.isActive()) {
 | 
				
			||||||
 | 
					                return true;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public List<AbstractSchedule> getStartableSchedules() {
 | 
				
			||||||
 | 
					        List<AbstractSchedule> abstractSchedules = new ArrayList<>();
 | 
				
			||||||
 | 
					        for(AbstractSchedule schedule : getBasicTaskSchedules()) {
 | 
				
			||||||
 | 
					            if(schedule.isStartable()) {
 | 
				
			||||||
 | 
					                abstractSchedules.add(schedule);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return abstractSchedules;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,45 +0,0 @@
 | 
				
			|||||||
package core.repositories.timemanager;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import core.entities.User;
 | 
					 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					 | 
				
			||||||
import core.entities.timemanager.Task;
 | 
					 | 
				
			||||||
import org.springframework.data.jpa.repository.Modifying;
 | 
					 | 
				
			||||||
import org.springframework.data.jpa.repository.Query;
 | 
					 | 
				
			||||||
import org.springframework.data.repository.CrudRepository;
 | 
					 | 
				
			||||||
import org.springframework.stereotype.Repository;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import javax.transaction.Transactional;
 | 
					 | 
				
			||||||
import java.time.LocalDate;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Optional;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Repository
 | 
					 | 
				
			||||||
public interface BasicTaskScheduleRepository extends CrudRepository<BasicTaskSchedule, Long> {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Modifying
 | 
					 | 
				
			||||||
    @Transactional
 | 
					 | 
				
			||||||
    @Query(value = "DELETE FROM BasicTaskSchedule bts WHERE bts.scheduleID = ?1")
 | 
					 | 
				
			||||||
    void deleteBasicTaskScheduleByID(long id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Modifying
 | 
					 | 
				
			||||||
    @Transactional
 | 
					 | 
				
			||||||
    @Query(value = "DELETE FROM BasicTaskSchedule bts WHERE bts.task = ?1")
 | 
					 | 
				
			||||||
    void deleteAllByTask(Task task);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @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);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user.username = ?1 AND bts.startTime is not null  and bts.finishedTime is null")
 | 
					 | 
				
			||||||
    Optional<BasicTaskSchedule> findActiveTaskSchedule(String username);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    List<BasicTaskSchedule> findAllByStartTimeIsNull();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1 AND bts.scheduleDate = ?2 AND bts.finishedTime IS NOT NULL")
 | 
					 | 
				
			||||||
    List<BasicTaskSchedule> findAllFinishedByUserAndDate(User user, LocalDate now);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Query(value = "SELECT bts FROM BasicTaskSchedule bts WHERE bts.task.taskgroup.user = ?1 AND bts.startTime IS NULL AND bts.finishedTime IS NULL")
 | 
					 | 
				
			||||||
    List<BasicTaskSchedule> findAllUnstartedSchedulesOfUser(User user);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					package core.repositories.timemanager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.timemanager.AbstractSchedule;
 | 
				
			||||||
 | 
					import org.springframework.data.jpa.repository.Query;
 | 
				
			||||||
 | 
					import org.springframework.data.repository.CrudRepository;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Repository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Repository
 | 
				
			||||||
 | 
					public interface ScheduleRepository extends CrudRepository<AbstractSchedule, Long> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query(value = "SELECT s FROM AbstractSchedule s WHERE s.task.taskgroup.user.username = ?1")
 | 
				
			||||||
 | 
					    List<AbstractSchedule> findAllByUsername(String username);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Query(value = "SELECT s FROM AbstractSchedule s WHERE s.task.taskgroup.user.username = ?1 AND s.startTime is NOT NULL and s.stopTime is NULL")
 | 
				
			||||||
 | 
					    Optional<AbstractSchedule> getActiveScheduleOfUser(String username);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,20 +1,19 @@
 | 
				
			|||||||
package core.services;
 | 
					package core.services;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import core.api.models.timemanager.taskSchedule.BasicTaskScheduleFieldInfo;
 | 
					import core.api.models.timemanager.taskSchedule.BasicScheduleFieldInfo;
 | 
				
			||||||
import core.api.models.timemanager.taskSchedule.ForgottenActivity;
 | 
					import core.api.models.timemanager.taskSchedule.ForgottenScheduleInfo;
 | 
				
			||||||
import core.entities.User;
 | 
					import core.entities.timemanager.AbstractSchedule;
 | 
				
			||||||
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.UserRepository;
 | 
				
			||||||
import core.repositories.timemanager.BasicTaskScheduleRepository;
 | 
					import core.repositories.timemanager.ScheduleRepository;
 | 
				
			||||||
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.security.core.context.SecurityContextHolder;
 | 
					 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.time.Duration;
 | 
					 | 
				
			||||||
import java.time.LocalDate;
 | 
					import java.time.LocalDate;
 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.LinkedList;
 | 
					import java.util.LinkedList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Optional;
 | 
					import java.util.Optional;
 | 
				
			||||||
@ -22,204 +21,127 @@ import java.util.Optional;
 | 
				
			|||||||
@Service
 | 
					@Service
 | 
				
			||||||
public class TaskScheduleService {
 | 
					public class TaskScheduleService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final BasicTaskScheduleRepository basicTaskScheduleRepository;
 | 
					    @Autowired private ScheduleRepository scheduleRepository;
 | 
				
			||||||
    private final TaskRepository taskRepository;
 | 
					    @Autowired private UserRepository userRepository;
 | 
				
			||||||
    private final UserRepository userRepository;
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private TaskRepository taskRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public TaskScheduleService(@Autowired BasicTaskScheduleRepository basicTaskScheduleRepository,
 | 
					    public List<AbstractSchedule> getAllSchedulesOfUser(String username) {
 | 
				
			||||||
                               @Autowired TaskRepository taskRepository,
 | 
					        return scheduleRepository.findAllByUsername(username);
 | 
				
			||||||
                               UserRepository userRepository) {
 | 
					 | 
				
			||||||
        this.basicTaskScheduleRepository = basicTaskScheduleRepository;
 | 
					 | 
				
			||||||
        this.taskRepository = taskRepository;
 | 
					 | 
				
			||||||
        this.userRepository = userRepository;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ServiceResult<BasicTaskSchedule> createBasicTaskSchedule(Task task, BasicTaskScheduleFieldInfo basicTaskScheduleFieldInfo) {
 | 
					    public ServiceResult<AbstractSchedule> scheduleBasic(Task task, BasicScheduleFieldInfo scheduleFieldInfo) {
 | 
				
			||||||
        BasicTaskSchedule basicTaskSchedule = new BasicTaskSchedule(task, basicTaskScheduleFieldInfo.getScheduleDate());
 | 
					        if(task.isFinished() || scheduleFieldInfo.getScheduleDate().isBefore(LocalDate.now())) {
 | 
				
			||||||
        task.getBasicTaskSchedules().add(basicTaskSchedule);
 | 
					            return new ServiceResult<>(ServiceExitCode.INVALID_OPERATION);
 | 
				
			||||||
        basicTaskScheduleRepository.save(basicTaskSchedule);
 | 
					        }
 | 
				
			||||||
        taskRepository.save(task);
 | 
					
 | 
				
			||||||
 | 
					        BasicTaskSchedule basicTaskSchedule = new BasicTaskSchedule(task, scheduleFieldInfo.getScheduleDate());
 | 
				
			||||||
 | 
					        scheduleRepository.save(basicTaskSchedule);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return new ServiceResult<>(basicTaskSchedule);
 | 
					        return new ServiceResult<>(basicTaskSchedule);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public PermissionResult<BasicTaskSchedule> getSchedulePermissions(long scheduleID, String name) {
 | 
					    public PermissionResult<AbstractSchedule> getSchedulePermissions(long scheduleID, String username) {
 | 
				
			||||||
        Optional<BasicTaskSchedule> basicSchedule = basicTaskScheduleRepository.findById(scheduleID);
 | 
					        Optional<AbstractSchedule> abstractSchedule = scheduleRepository.findById(scheduleID);
 | 
				
			||||||
        return basicSchedule.map(value -> new PermissionResult<>(value, value.getTask().getTaskgroup().getUser().getUsername().equals(name))).orElseGet(() ->
 | 
					        return abstractSchedule.map(schedule -> new PermissionResult<>(schedule, schedule.getTask().getTaskgroup().getUser().getUsername().equals(username))).orElseGet(() -> new PermissionResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
				
			||||||
                new PermissionResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void reschedule(BasicTaskSchedule basicTaskSchedule, BasicTaskScheduleFieldInfo basicTaskScheduleFieldInfo) {
 | 
					    public ServiceResult<AbstractSchedule> editBasicSchedule(BasicTaskSchedule schedule, BasicScheduleFieldInfo scheduleFieldInfo) {
 | 
				
			||||||
        basicTaskSchedule.setScheduleDate(basicTaskScheduleFieldInfo.getScheduleDate());
 | 
					        if(schedule.getTask().isFinished() || scheduleFieldInfo.getScheduleDate().isBefore(LocalDate.now())) {
 | 
				
			||||||
        basicTaskScheduleRepository.save(basicTaskSchedule);
 | 
					            return new ServiceResult<>(ServiceExitCode.INVALID_OPERATION);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void deleteBasicSchedule(BasicTaskSchedule basicTaskSchedule) {
 | 
					        schedule.setScheduleDate(scheduleFieldInfo.getScheduleDate());
 | 
				
			||||||
        basicTaskScheduleRepository.deleteBasicTaskScheduleByID(basicTaskSchedule.getScheduleID());
 | 
					        scheduleRepository.save(schedule);
 | 
				
			||||||
 | 
					        return new ServiceResult<>(schedule);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ServiceResult<List<BasicTaskSchedule>> loadTodaysSchedule(String username, boolean onlyActivateable) {
 | 
					    public void deleteSchedule(AbstractSchedule schedule) {
 | 
				
			||||||
        Optional<User> user = userRepository.findByUsername(username);
 | 
					        scheduleRepository.delete(schedule);
 | 
				
			||||||
        if(user.isEmpty()) {
 | 
					 | 
				
			||||||
            return new ServiceResult<>(ServiceExitCode.MISSING_ENTITY);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        List<BasicTaskSchedule> basicTaskSchedules = basicTaskScheduleRepository.findAllByUserAndDate(user.get(), LocalDate.now());
 | 
					    public List<AbstractSchedule> getFilteredScheduledOfUser(LocalDate date, boolean startable, String name) {
 | 
				
			||||||
        List<BasicTaskSchedule> activatableSchedules = new LinkedList<>();
 | 
					        List<AbstractSchedule> abstractSchedules = getAllSchedulesOfUser(name);
 | 
				
			||||||
        if(onlyActivateable) {
 | 
					        List<AbstractSchedule> filteredSchedules = new LinkedList<>();
 | 
				
			||||||
            for (BasicTaskSchedule basicTaskSchedule : basicTaskSchedules) {
 | 
					        for(AbstractSchedule abstractSchedule : abstractSchedules) {
 | 
				
			||||||
                if (basicTaskSchedule.isActivateAble()) {
 | 
					            if(abstractSchedule instanceof BasicTaskSchedule) {
 | 
				
			||||||
                    activatableSchedules.add(basicTaskSchedule);
 | 
					                if(((BasicTaskSchedule) abstractSchedule).getScheduleDate().isEqual(date)) {
 | 
				
			||||||
 | 
					                    //Schedule is today
 | 
				
			||||||
 | 
					                    if(startable && abstractSchedule.getStartTime() == null) {
 | 
				
			||||||
 | 
					                        if(abstractSchedule.getStartTime() == null) {
 | 
				
			||||||
 | 
					                            filteredSchedules.add(abstractSchedule);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    } else if(!startable) {
 | 
				
			||||||
 | 
					                        filteredSchedules.add(abstractSchedule);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                //to continue...
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        return new ServiceResult<>(activatableSchedules);
 | 
					        }
 | 
				
			||||||
 | 
					        return filteredSchedules;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ServiceResult<List<BasicTaskSchedule>> loadSchedules(String username) {
 | 
					    public ServiceResult<AbstractSchedule> scheduleNow(Task task) {
 | 
				
			||||||
        Optional<User> user = userRepository.findByUsername(username);
 | 
					        if(task.isFinished()) {
 | 
				
			||||||
        return user.map(value -> new ServiceResult<>(basicTaskScheduleRepository.findAllByUser(value))).orElseGet(() ->
 | 
					            return new ServiceResult<>(ServiceExitCode.INVALID_OPERATION);
 | 
				
			||||||
                new ServiceResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ServiceResult<BasicTaskSchedule> scheduleTaskNow(Task task) {
 | 
					        if(task.hasActiveSchedule()) {
 | 
				
			||||||
        //Check if task has already an active schedule
 | 
					 | 
				
			||||||
        ServiceResult<BasicTaskSchedule> activeSchedule = getActiveSchedule(task.getTaskgroup().getUser().getUsername());
 | 
					 | 
				
			||||||
        if(task.hasActiveSchedule() || activeSchedule.getExitCode() != ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            return new ServiceResult<>(ServiceExitCode.ENTITY_ALREADY_EXIST);
 | 
					            return new ServiceResult<>(ServiceExitCode.ENTITY_ALREADY_EXIST);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            BasicTaskSchedule basicTaskSchedule = new BasicTaskSchedule(task, LocalDate.now());
 | 
					            BasicTaskSchedule basicTaskSchedule = new BasicTaskSchedule(task, LocalDateTime.now());
 | 
				
			||||||
            basicTaskSchedule.setStartTime(LocalDateTime.now());
 | 
					            scheduleRepository.save(basicTaskSchedule);
 | 
				
			||||||
            task.getBasicTaskSchedules().add(basicTaskSchedule);
 | 
					 | 
				
			||||||
            basicTaskScheduleRepository.save(basicTaskSchedule);
 | 
					 | 
				
			||||||
            taskRepository.save(task);
 | 
					 | 
				
			||||||
            return new ServiceResult<>(basicTaskSchedule);
 | 
					            return new ServiceResult<>(basicTaskSchedule);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void deleteScheduleByTask(Task task) {
 | 
					    public ServiceResult<AbstractSchedule> getActiveSchedule(String username) {
 | 
				
			||||||
        basicTaskScheduleRepository.deleteAllByTask(task);
 | 
					        Optional<AbstractSchedule> activeSchedule = scheduleRepository.getActiveScheduleOfUser(username);
 | 
				
			||||||
 | 
					        return activeSchedule.map(ServiceResult::new).orElseGet(() -> new ServiceResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ServiceResult<BasicTaskSchedule> getActiveSchedule(String username) {
 | 
					    public ServiceResult<AbstractSchedule> activateSchedule(AbstractSchedule schedule) {
 | 
				
			||||||
        Optional<BasicTaskSchedule> activeTaskScheduleResult = basicTaskScheduleRepository.findActiveTaskSchedule(username);
 | 
					        if(schedule.getStartTime() == null) {
 | 
				
			||||||
        return activeTaskScheduleResult.map(ServiceResult::new).orElseGet(() -> new ServiceResult<>(ServiceExitCode.MISSING_ENTITY));
 | 
					            schedule.setStartTime(LocalDateTime.now());
 | 
				
			||||||
 | 
					            scheduleRepository.save(schedule);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return new ServiceResult<>(schedule);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ServiceResult<BasicTaskSchedule> activateSchedule(BasicTaskSchedule taskSchedule) {
 | 
					    public ServiceResult<AbstractSchedule> stopSchedule(AbstractSchedule schedule, boolean finish) {
 | 
				
			||||||
        //Check if taskSchedule can be started
 | 
					        if(schedule.getStartTime() != null && schedule.getStopTime() == null) {
 | 
				
			||||||
        if(taskSchedule.getStartTime() != null) {
 | 
					            schedule.setStopTime(LocalDateTime.now());
 | 
				
			||||||
            return new ServiceResult<>(ServiceExitCode.INVALID_OPERATION);
 | 
					            scheduleRepository.save(schedule);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(getActiveSchedule(taskSchedule.getTask().getTaskgroup().getUser().getUsername()).getExitCode() == ServiceExitCode.MISSING_ENTITY) {
 | 
					 | 
				
			||||||
            taskSchedule.setStartTime(LocalDateTime.now());
 | 
					 | 
				
			||||||
            basicTaskScheduleRepository.save(taskSchedule);
 | 
					 | 
				
			||||||
            return new ServiceResult<>(taskSchedule);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            return new ServiceResult<>(ServiceExitCode.ENTITY_ALREADY_EXIST);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public ServiceResult<Integer> stopSchedule(BasicTaskSchedule taskSchedule, boolean finish) {
 | 
					 | 
				
			||||||
        if(taskSchedule.getStartTime() == null || taskSchedule.getFinishedTime() != null) {
 | 
					 | 
				
			||||||
            return new ServiceResult<>(ServiceExitCode.INVALID_OPERATION);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        taskSchedule.setFinishedTime(LocalDateTime.now());
 | 
					 | 
				
			||||||
        long activeTime = Duration.between(taskSchedule.getStartTime(), taskSchedule.getFinishedTime()).toMinutes();
 | 
					 | 
				
			||||||
        long workTime = taskSchedule.getTask().getWorkTime() + activeTime;
 | 
					 | 
				
			||||||
        taskSchedule.getTask().setWorkTime((int) workTime);
 | 
					 | 
				
			||||||
        if(finish) {
 | 
					        if(finish) {
 | 
				
			||||||
            taskSchedule.getTask().setFinished(true);
 | 
					            schedule.getTask().setFinished(true);
 | 
				
			||||||
 | 
					            taskRepository.save(schedule.getTask());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            List<AbstractSchedule> startableSchedules = schedule.getTask().getStartableSchedules();
 | 
				
			||||||
 | 
					            scheduleRepository.deleteAll(startableSchedules);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        basicTaskScheduleRepository.save(taskSchedule);
 | 
					        return new ServiceResult<>(schedule);
 | 
				
			||||||
        taskRepository.save(taskSchedule.getTask());
 | 
					 | 
				
			||||||
        return new ServiceResult<>((int) activeTime);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public int getWorkedMinutes(User user) {
 | 
					    public ServiceResult<AbstractSchedule> registerForgottenSchedule(Task task, ForgottenScheduleInfo forgottenScheduleInfo) {
 | 
				
			||||||
        List<BasicTaskSchedule> basicTaskSchedules = basicTaskScheduleRepository.findAllByUser(user);
 | 
					        if(task.isFinished()) {
 | 
				
			||||||
        long workedMinutes = 0;
 | 
					 | 
				
			||||||
        for(BasicTaskSchedule basicTaskSchedule : basicTaskSchedules) {
 | 
					 | 
				
			||||||
            if(basicTaskSchedule.getFinishedTime() != null && basicTaskSchedule.getFinishedTime().toLocalDate().isEqual(LocalDate.now())) {
 | 
					 | 
				
			||||||
                workedMinutes += Duration.between(basicTaskSchedule.getStartTime(), basicTaskSchedule.getFinishedTime()).toMinutes();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return (int) workedMinutes;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public boolean isAnyScheduleMissed(User user) {
 | 
					 | 
				
			||||||
        List<BasicTaskSchedule> unstartedSchedules = basicTaskScheduleRepository.findAllByStartTimeIsNull();
 | 
					 | 
				
			||||||
        LocalDate dateReference = LocalDate.now();
 | 
					 | 
				
			||||||
        for(BasicTaskSchedule schedule : unstartedSchedules) {
 | 
					 | 
				
			||||||
            if(schedule.getScheduleDate().isBefore(dateReference)) {
 | 
					 | 
				
			||||||
                return true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public ServiceResult<Integer> registerForgottenActivity(Task task, ForgottenActivity forgottenActivity) {
 | 
					 | 
				
			||||||
        switch (forgottenActivity.getMode()) {
 | 
					 | 
				
			||||||
            case MANUAL -> {
 | 
					 | 
				
			||||||
                task.increaseActiveTime(forgottenActivity.getMinutesSpent());
 | 
					 | 
				
			||||||
                BasicTaskSchedule basicTaskSchedule = new BasicTaskSchedule(task, LocalDate.now());
 | 
					 | 
				
			||||||
                LocalDateTime timeReference = LocalDateTime.now();
 | 
					 | 
				
			||||||
                basicTaskSchedule.setStartTime(timeReference.minusMinutes(forgottenActivity.getMinutesSpent()));
 | 
					 | 
				
			||||||
                basicTaskSchedule.setFinishedTime(timeReference);
 | 
					 | 
				
			||||||
                task.getBasicTaskSchedules().add(basicTaskSchedule);
 | 
					 | 
				
			||||||
                basicTaskScheduleRepository.save(basicTaskSchedule);
 | 
					 | 
				
			||||||
                taskRepository.save(task);
 | 
					 | 
				
			||||||
                return new ServiceResult<>(forgottenActivity.getMinutesSpent());
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            case LAST -> {
 | 
					 | 
				
			||||||
                List<BasicTaskSchedule> schedules = basicTaskScheduleRepository.findAllFinishedByUserAndDate(task.getTaskgroup().getUser(), LocalDate.now());
 | 
					 | 
				
			||||||
                if(schedules.isEmpty()) {
 | 
					 | 
				
			||||||
            return new ServiceResult<>(ServiceExitCode.INVALID_OPERATION);
 | 
					            return new ServiceResult<>(ServiceExitCode.INVALID_OPERATION);
 | 
				
			||||||
                } else {
 | 
					 | 
				
			||||||
                    LocalDateTime timeReference = LocalDateTime.now();
 | 
					 | 
				
			||||||
                    BasicTaskSchedule nearestSchedule = null;
 | 
					 | 
				
			||||||
                    long nearestDuration = Long.MAX_VALUE;
 | 
					 | 
				
			||||||
                    for(BasicTaskSchedule schedule : schedules) {
 | 
					 | 
				
			||||||
                        if(nearestSchedule == null) {
 | 
					 | 
				
			||||||
                            nearestSchedule = schedule;
 | 
					 | 
				
			||||||
                            nearestDuration = Duration.between(nearestSchedule.getFinishedTime(), timeReference).getSeconds();
 | 
					 | 
				
			||||||
                        } else {
 | 
					 | 
				
			||||||
                            long currentDuration = Duration.between(schedule.getFinishedTime(), timeReference).getSeconds();
 | 
					 | 
				
			||||||
                            if(currentDuration < nearestDuration) {
 | 
					 | 
				
			||||||
                                nearestSchedule = schedule;
 | 
					 | 
				
			||||||
                                nearestDuration = currentDuration;
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    int minutesSpent = (int) Duration.between(nearestSchedule.getFinishedTime(), timeReference).toMinutes();
 | 
					        BasicTaskSchedule basicTaskSchedule = new BasicTaskSchedule(task, forgottenScheduleInfo.getStartTime(), forgottenScheduleInfo.getEndTime(), forgottenScheduleInfo.getStartTime().toLocalDate());
 | 
				
			||||||
                    task.increaseActiveTime(minutesSpent);
 | 
					        scheduleRepository.save(basicTaskSchedule);
 | 
				
			||||||
                    BasicTaskSchedule basicTaskSchedule = new BasicTaskSchedule(task, timeReference.toLocalDate());
 | 
					
 | 
				
			||||||
                    basicTaskSchedule.setStartTime(nearestSchedule.getFinishedTime());
 | 
					        return new ServiceResult<>(basicTaskSchedule);
 | 
				
			||||||
                    basicTaskSchedule.setFinishedTime(timeReference);
 | 
					 | 
				
			||||||
                    basicTaskScheduleRepository.save(basicTaskSchedule);
 | 
					 | 
				
			||||||
                    taskRepository.save(task);
 | 
					 | 
				
			||||||
                    return new ServiceResult<>(minutesSpent);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            case PLANNED -> {
 | 
					 | 
				
			||||||
                //Does not make sense until advanced schedule/moderate schedule is implemented
 | 
					 | 
				
			||||||
                return new ServiceResult<>(0);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            default -> {
 | 
					 | 
				
			||||||
                throw new RuntimeException("INVALID MODE");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    public List<AbstractSchedule> getAllMissedSchedulesOfUser(String username) {
 | 
				
			||||||
 | 
					        List<AbstractSchedule> missedSchedules = new ArrayList<>();
 | 
				
			||||||
    public List<BasicTaskSchedule> loadMissedSchedules(User user) {
 | 
					        List<AbstractSchedule> schedules = getAllSchedulesOfUser(username);
 | 
				
			||||||
        List<BasicTaskSchedule> unstartedSchedules = basicTaskScheduleRepository.findAllUnstartedSchedulesOfUser(user);
 | 
					        LocalDateTime now = LocalDateTime.now();
 | 
				
			||||||
        LocalDate currentDate = LocalDate.now();
 | 
					        for(AbstractSchedule schedule : schedules) {
 | 
				
			||||||
        List<BasicTaskSchedule> missedSchedules = new LinkedList<>();
 | 
					            if(schedule.isMissed(now)) {
 | 
				
			||||||
        for(BasicTaskSchedule schedule : unstartedSchedules) {
 | 
					 | 
				
			||||||
            if(schedule.getScheduleDate().isBefore(currentDate)) {
 | 
					 | 
				
			||||||
                missedSchedules.add(schedule);
 | 
					                missedSchedules.add(schedule);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -2,17 +2,14 @@ package core.services;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import core.api.models.timemanager.tasks.TaskFieldInfo;
 | 
					import core.api.models.timemanager.tasks.TaskFieldInfo;
 | 
				
			||||||
import core.api.models.timemanager.tasks.TaskScope;
 | 
					import core.api.models.timemanager.tasks.TaskScope;
 | 
				
			||||||
import core.entities.timemanager.BasicTaskSchedule;
 | 
					 | 
				
			||||||
import core.entities.timemanager.Task;
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
import core.entities.timemanager.Taskgroup;
 | 
					import core.entities.timemanager.Taskgroup;
 | 
				
			||||||
import core.repositories.timemanager.BasicTaskScheduleRepository;
 | 
					 | 
				
			||||||
import core.repositories.timemanager.TaskRepository;
 | 
					import core.repositories.timemanager.TaskRepository;
 | 
				
			||||||
import core.repositories.timemanager.TaskgroupRepository;
 | 
					import core.repositories.timemanager.TaskgroupRepository;
 | 
				
			||||||
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.time.LocalDate;
 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
@ -93,7 +90,7 @@ public class TaskService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void deleteTask(Task task) {
 | 
					    public void deleteTask(Task task) {
 | 
				
			||||||
        taskScheduleService.deleteScheduleByTask(task);
 | 
					        //taskScheduleService.deleteScheduleByTask(task);
 | 
				
			||||||
        taskRepository.deleteByTaskID(task.getTaskID());
 | 
					        taskRepository.deleteByTaskID(task.getTaskID());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -106,7 +103,7 @@ public class TaskService {
 | 
				
			|||||||
        task.finish();
 | 
					        task.finish();
 | 
				
			||||||
        taskRepository.save(task);
 | 
					        taskRepository.save(task);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        List<BasicTaskSchedule> removedBasicTaskSchedules = new LinkedList<>();
 | 
					        /*List<BasicTaskSchedule> removedBasicTaskSchedules = new LinkedList<>();
 | 
				
			||||||
        for(BasicTaskSchedule basicTaskSchedule : task.getBasicTaskSchedules()) {
 | 
					        for(BasicTaskSchedule basicTaskSchedule : task.getBasicTaskSchedules()) {
 | 
				
			||||||
            if(basicTaskSchedule.getStartTime() == null) {
 | 
					            if(basicTaskSchedule.getStartTime() == null) {
 | 
				
			||||||
                removedBasicTaskSchedules.add(basicTaskSchedule);
 | 
					                removedBasicTaskSchedules.add(basicTaskSchedule);
 | 
				
			||||||
@ -120,7 +117,7 @@ public class TaskService {
 | 
				
			|||||||
            task.getBasicTaskSchedules().remove(deletedTaskSchedule);
 | 
					            task.getBasicTaskSchedules().remove(deletedTaskSchedule);
 | 
				
			||||||
            taskRepository.save(task);
 | 
					            taskRepository.save(task);
 | 
				
			||||||
            taskScheduleService.deleteBasicSchedule(deletedTaskSchedule);
 | 
					            taskScheduleService.deleteBasicSchedule(deletedTaskSchedule);
 | 
				
			||||||
        }
 | 
					        }*/
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public List<Task> loadAllTasks(String username, TaskScope scope) {
 | 
					    public List<Task> loadAllTasks(String username, TaskScope scope) {
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,57 @@
 | 
				
			|||||||
 | 
					package core.schedules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.entities.User;
 | 
				
			||||||
 | 
					import core.entities.timemanager.AbstractSchedule;
 | 
				
			||||||
 | 
					import core.repositories.timemanager.ScheduleRepository;
 | 
				
			||||||
 | 
					import core.services.ServiceResult;
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.ExtendWith;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
 | 
				
			||||||
 | 
					import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
 | 
				
			||||||
 | 
					import org.springframework.test.context.jdbc.Sql;
 | 
				
			||||||
 | 
					import org.springframework.test.context.jdbc.SqlGroup;
 | 
				
			||||||
 | 
					import org.springframework.test.context.junit.jupiter.SpringExtension;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static org.junit.jupiter.api.Assertions.assertEquals;
 | 
				
			||||||
 | 
					import static org.junit.jupiter.api.Assertions.assertTrue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@ExtendWith(SpringExtension.class)
 | 
				
			||||||
 | 
					@DataJpaTest
 | 
				
			||||||
 | 
					public class ScheduleRepositoryTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired private ScheduleRepository scheduleRepository;
 | 
				
			||||||
 | 
					    @Autowired private TestEntityManager entityManager;
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void getAllSchedulesOfUser() {
 | 
				
			||||||
 | 
					        User referenceUser_1 = entityManager.find(User.class, 1L);
 | 
				
			||||||
 | 
					        User referenceUser_2 = entityManager.find(User.class, 2L);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertEquals(0, scheduleRepository.findAllByUsername(referenceUser_2.getUsername()).size());
 | 
				
			||||||
 | 
					        assertEquals(5, scheduleRepository.findAllByUsername(referenceUser_1.getUsername()).size());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void getActiveScheduleOfUser() {
 | 
				
			||||||
 | 
					        User referenceUser_1 = entityManager.find(User.class, 1L);
 | 
				
			||||||
 | 
					        User referenceUser_2 = entityManager.find(User.class, 2L);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Optional<AbstractSchedule> result_1 = scheduleRepository.getActiveScheduleOfUser(referenceUser_2.getUsername());
 | 
				
			||||||
 | 
					        assertTrue(result_1.isEmpty());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Optional<AbstractSchedule> result_2 = scheduleRepository.getActiveScheduleOfUser(referenceUser_1.getUsername());
 | 
				
			||||||
 | 
					        assertTrue(result_2.isPresent());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										237
									
								
								backend/src/test/java/core/schedules/ScheduleServiceTest.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										237
									
								
								backend/src/test/java/core/schedules/ScheduleServiceTest.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,237 @@
 | 
				
			|||||||
 | 
					package core.schedules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.BasicScheduleFieldInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.BasicScheduleInfo;
 | 
				
			||||||
 | 
					import core.api.models.timemanager.taskSchedule.ForgottenScheduleInfo;
 | 
				
			||||||
 | 
					import core.entities.timemanager.AbstractSchedule;
 | 
				
			||||||
 | 
					import core.entities.timemanager.BasicTaskSchedule;
 | 
				
			||||||
 | 
					import core.entities.timemanager.Task;
 | 
				
			||||||
 | 
					import core.repositories.timemanager.TaskgroupRepository;
 | 
				
			||||||
 | 
					import core.services.ServiceExitCode;
 | 
				
			||||||
 | 
					import core.services.ServiceResult;
 | 
				
			||||||
 | 
					import core.services.TaskScheduleService;
 | 
				
			||||||
 | 
					import core.services.TaskgroupService;
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.boot.test.context.SpringBootTest;
 | 
				
			||||||
 | 
					import org.springframework.test.context.jdbc.Sql;
 | 
				
			||||||
 | 
					import org.springframework.test.context.jdbc.SqlGroup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.persistence.EntityManager;
 | 
				
			||||||
 | 
					import javax.transaction.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.LocalDate;
 | 
				
			||||||
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
 | 
				
			||||||
 | 
					import static org.junit.jupiter.api.Assertions.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@SpringBootTest
 | 
				
			||||||
 | 
					@Transactional
 | 
				
			||||||
 | 
					public class ScheduleServiceTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private EntityManager entityManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired private TaskScheduleService taskScheduleService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final String username = "Testuser1";
 | 
				
			||||||
 | 
					    private static final String username2 = "Testuser2";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void getAllSchedulesOfUser() {
 | 
				
			||||||
 | 
					        assertEquals(0, taskScheduleService.getAllSchedulesOfUser(username2).size());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<AbstractSchedule> result_1 = taskScheduleService.getAllSchedulesOfUser(username);
 | 
				
			||||||
 | 
					        assertEquals(5, result_1.size());
 | 
				
			||||||
 | 
					        assertTrue(result_1.contains(entityManager.find(AbstractSchedule.class, 1L)));
 | 
				
			||||||
 | 
					        assertTrue(result_1.contains(entityManager.find(AbstractSchedule.class, 2L)));
 | 
				
			||||||
 | 
					        assertTrue(result_1.contains(entityManager.find(AbstractSchedule.class, 3L)));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void scheduleBasic() {
 | 
				
			||||||
 | 
					        //Situation 1: Schedule finished Task
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_1 = taskScheduleService.scheduleBasic(entityManager.find(Task.class, 2L), new BasicScheduleFieldInfo(LocalDate.now()));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.INVALID_OPERATION, result_1.getExitCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Situation 2: Schedule before today
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_2 = taskScheduleService.scheduleBasic(entityManager.find(Task.class, 1L), new BasicScheduleFieldInfo(LocalDate.of(2010, 3, 14)));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.INVALID_OPERATION, result_2.getExitCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Situation 3: Valid schedule
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_3 = taskScheduleService.scheduleBasic(entityManager.find(Task.class, 1L), new BasicScheduleFieldInfo(LocalDate.now()));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.OK, result_3.getExitCode());
 | 
				
			||||||
 | 
					        assertThat(entityManager.find(BasicTaskSchedule.class, result_3.getResult().getScheduleID())).isNotNull();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void editBasicSchedule() {
 | 
				
			||||||
 | 
					        //Situation 1: Reschedule finished task
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_1 = taskScheduleService.editBasicSchedule(entityManager.find(BasicTaskSchedule.class, 2L), new BasicScheduleFieldInfo(LocalDate.now()));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.INVALID_OPERATION, result_1.getExitCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Situation 2: Reschedule unfinished task with invalid reschedule date
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_2 = taskScheduleService.editBasicSchedule(entityManager.find(BasicTaskSchedule.class, 1L), new BasicScheduleFieldInfo(LocalDate.of(2011, 3, 4)));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.INVALID_OPERATION, result_2.getExitCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Situation 3: Reschedule unfinished task with valid reschedule date
 | 
				
			||||||
 | 
					        LocalDate oldDate = entityManager.find(BasicTaskSchedule.class, 1L).getScheduleDate();
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_3 = taskScheduleService.editBasicSchedule(entityManager.find(BasicTaskSchedule.class, 1L), new BasicScheduleFieldInfo(LocalDate.now()));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.OK, result_3.getExitCode());
 | 
				
			||||||
 | 
					        assertNotEquals(((BasicTaskSchedule) result_3.getResult()).getScheduleDate(), oldDate);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void deleteSchedule() {
 | 
				
			||||||
 | 
					        for(long i=1; i<=2; i++) {
 | 
				
			||||||
 | 
					            taskScheduleService.deleteSchedule(entityManager.find(BasicTaskSchedule.class, i));
 | 
				
			||||||
 | 
					            assertThat(entityManager.find(BasicTaskSchedule.class, i)).isNull();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void getFilteredScheduledOfUser() {
 | 
				
			||||||
 | 
					        //Invalid user
 | 
				
			||||||
 | 
					        assertEquals(0, taskScheduleService.getFilteredScheduledOfUser(LocalDate.now(), false, "Quatsch").size());
 | 
				
			||||||
 | 
					        assertEquals(0, taskScheduleService.getFilteredScheduledOfUser(LocalDate.now(), true, "Quatsch").size());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //User with no tasks/schedules
 | 
				
			||||||
 | 
					        assertEquals(0, taskScheduleService.getFilteredScheduledOfUser(LocalDate.now(), false, username2).size());
 | 
				
			||||||
 | 
					        assertEquals(0, taskScheduleService.getFilteredScheduledOfUser(LocalDate.now(), true, username2).size());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //user with tasks and schedules
 | 
				
			||||||
 | 
					        List<AbstractSchedule> result_1 = taskScheduleService.getFilteredScheduledOfUser(LocalDate.of(2024,11,11), false, username);
 | 
				
			||||||
 | 
					        assertEquals(3, result_1.size());
 | 
				
			||||||
 | 
					        assertTrue(result_1.contains(entityManager.find(BasicTaskSchedule.class, 3L)));
 | 
				
			||||||
 | 
					        assertTrue(result_1.contains(entityManager.find(BasicTaskSchedule.class, 4L)));
 | 
				
			||||||
 | 
					        assertTrue(result_1.contains(entityManager.find(BasicTaskSchedule.class, 5L)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        List<AbstractSchedule> result_2 = taskScheduleService.getFilteredScheduledOfUser(LocalDate.of(2024,11,11), true, username);
 | 
				
			||||||
 | 
					        assertEquals(1, result_2.size());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void scheduleNow() {
 | 
				
			||||||
 | 
					        //Situation 1: Task has already an active schedule
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_1 = taskScheduleService.scheduleNow(entityManager.find(Task.class, 3L));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, result_1.getExitCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Situation 2: Task is already finished
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_2 = taskScheduleService.scheduleNow(entityManager.find(Task.class, 2L));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.INVALID_OPERATION, result_2.getExitCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Situation 3: Task can be scheduled and started
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_3 = taskScheduleService.scheduleNow(entityManager.find(Task.class, 5L));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.OK, result_3.getExitCode());
 | 
				
			||||||
 | 
					        assertThat(entityManager.find(BasicTaskSchedule.class, result_3.getResult().getScheduleID())).isNotNull();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void activateSchedule() {
 | 
				
			||||||
 | 
					        //Activate already running schedule
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_1 = taskScheduleService.activateSchedule(entityManager.find(BasicTaskSchedule.class, 4L));
 | 
				
			||||||
 | 
					        assertNotNull(result_1.getResult().getStartTime());
 | 
				
			||||||
 | 
					        assertNull(result_1.getResult().getStopTime());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        entityManager.remove(entityManager.find(BasicTaskSchedule.class, 4L));
 | 
				
			||||||
 | 
					        assertThat(entityManager.find(BasicTaskSchedule.class, 4L)).isNull();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Activate not running schedule
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_2 = taskScheduleService.activateSchedule(entityManager.find(BasicTaskSchedule.class, 5L));
 | 
				
			||||||
 | 
					        assertNotNull(result_2.getResult().getStartTime());
 | 
				
			||||||
 | 
					        assertNull(result_2.getResult().getStopTime());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void stopSchedule() {
 | 
				
			||||||
 | 
					        //Stop schedule that is not running 4
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_1 = taskScheduleService.stopSchedule(entityManager.find(BasicTaskSchedule.class, 5L), false);
 | 
				
			||||||
 | 
					        assertNull(result_1.getResult().getStartTime());
 | 
				
			||||||
 | 
					        assertNull(result_1.getResult().getStopTime());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Stop schedule (without finishing)
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_2 = taskScheduleService.stopSchedule(entityManager.find(BasicTaskSchedule.class, 4L), false);
 | 
				
			||||||
 | 
					        assertNotNull(result_2.getResult().getStartTime());
 | 
				
			||||||
 | 
					        assertNotNull(result_2.getResult().getStopTime());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Stop schedule with finishing
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_3 = taskScheduleService.stopSchedule(entityManager.find(BasicTaskSchedule.class, 7L), true);
 | 
				
			||||||
 | 
					        assertNotNull(result_3.getResult().getStartTime());
 | 
				
			||||||
 | 
					        assertNotNull(result_3.getResult().getStopTime());
 | 
				
			||||||
 | 
					        assertTrue(result_3.getResult().getTask().isFinished());
 | 
				
			||||||
 | 
					        assertFalse(result_3.getResult().isStartable());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void registerForgottenSchedule() {
 | 
				
			||||||
 | 
					        //Register task schedule for task that is already finished
 | 
				
			||||||
 | 
					        LocalDateTime startTime = LocalDateTime.now().minusMinutes(10L);
 | 
				
			||||||
 | 
					        LocalDateTime finishTime = LocalDateTime.now();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_1 = taskScheduleService.registerForgottenSchedule(entityManager.find(Task.class, 2L), new ForgottenScheduleInfo(startTime, finishTime));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.INVALID_OPERATION, result_1.getExitCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ServiceResult<AbstractSchedule> result_2 = taskScheduleService.registerForgottenSchedule(entityManager.find(Task.class, 5L), new ForgottenScheduleInfo(startTime, finishTime));
 | 
				
			||||||
 | 
					        assertEquals(ServiceExitCode.OK, result_2.getExitCode());
 | 
				
			||||||
 | 
					        assertEquals(startTime, result_2.getResult().getStartTime());
 | 
				
			||||||
 | 
					        assertEquals(finishTime, result_2.getResult().getStopTime());
 | 
				
			||||||
 | 
					        assertThat(entityManager.find(BasicTaskSchedule.class, result_2.getResult().getScheduleID())).isNotNull();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    @SqlGroup({
 | 
				
			||||||
 | 
					            @Sql("classpath:taskgroupRepositoryTestEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:taskRepositoryEntries.sql"),
 | 
				
			||||||
 | 
					            @Sql("classpath:basicScheduleEntries.sql")
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    void getAllMissedSchedulesOfUser() {
 | 
				
			||||||
 | 
					        assertEquals(1, taskScheduleService.getAllMissedSchedulesOfUser(username).size());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								backend/src/test/resources/basicScheduleEntries.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								backend/src/test/resources/basicScheduleEntries.sql
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					INSERT INTO abstract_schedule (schedule_type, scheduleid, start_time, stop_time, schedule_date, task, schedule_end, schedule_start)
 | 
				
			||||||
 | 
					VALUES (0, 1, null, null, '2010-11-11', 1, null, null),
 | 
				
			||||||
 | 
					       (0, 2, null, null, '2048-11-11', 2, null, null),
 | 
				
			||||||
 | 
					       (0, 3, '2023-10-10', '2022-10-10', '2024-11-11', 1, null, null),
 | 
				
			||||||
 | 
					       (0, 4, '2023-10-10', null, '2024-11-11', 3, null, null),
 | 
				
			||||||
 | 
					       (0, 5, null, null, '2024-11-11', 5, null, null),
 | 
				
			||||||
 | 
					       (0, 6, '2023-10-10', null, '2024-11-11', 16, null, null),
 | 
				
			||||||
 | 
					        (0, 7, '2023-10-10', null, '2024-11-11', 16, null, null);
 | 
				
			||||||
@ -17,3 +17,5 @@ INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, f
 | 
				
			|||||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (13, NULL, 0, '2022-03-20', 'Task 6', 2, true, 0);
 | 
					INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (13, NULL, 0, '2022-03-20', 'Task 6', 2, true, 0);
 | 
				
			||||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (14, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, true, 0);
 | 
					INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (14, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, true, 0);
 | 
				
			||||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (15, NULL, 0, NULL, 'Task 15', 2, false, 0);
 | 
					INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (15, NULL, 0, NULL, 'Task 15', 2, false, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (16, NULL, 0, NULL, 'Task 15', 9, false, 0);
 | 
				
			||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
INSERT INTO users (id, username, email, password) VALUES (1, 'Testuser1', 'test1@test.com', '123456');
 | 
					INSERT INTO users (id, username, email, password) VALUES (1, 'Testuser1', 'test1@test.com', '123456');
 | 
				
			||||||
INSERT INTO users (id, username, email, password) VALUES (2, 'Testuser2', 'test2@test.com', '123456');
 | 
					INSERT INTO users (id, username, email, password) VALUES (2, 'Testuser2', 'test2@test.com', '123456');
 | 
				
			||||||
 | 
					INSERT INTO users (id, username, email, password) VALUES (3, 'Testuser3', 'test3@test.com', '123456');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (1, 'No children', null, 1);
 | 
					INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (1, 'No children', null, 1);
 | 
				
			||||||
INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (2, 'Taskgroup 1', null, 1);
 | 
					INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (2, 'Taskgroup 1', null, 1);
 | 
				
			||||||
@ -10,3 +11,5 @@ INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (5,
 | 
				
			|||||||
INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (6, 'Taskgroup 2.1', 5, 1);
 | 
					INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (6, 'Taskgroup 2.1', 5, 1);
 | 
				
			||||||
INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (7, 'Taskgroup 2.2', 5, 1);
 | 
					INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (7, 'Taskgroup 2.2', 5, 1);
 | 
				
			||||||
INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (8, 'Taskgroup 2.1.2', 6, 1);
 | 
					INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (8, 'Taskgroup 2.1.2', 6, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					INSERT INTO taskgroups (taskgroupid, name, parent_id, taskgroupuser) VALUES (9, 'Taskgroup 1', null, 3);
 | 
				
			||||||
@ -16,6 +16,8 @@ index.ts
 | 
				
			|||||||
model/accountDeleteRequest.ts
 | 
					model/accountDeleteRequest.ts
 | 
				
			||||||
model/basicScheduleEntityInfo.ts
 | 
					model/basicScheduleEntityInfo.ts
 | 
				
			||||||
model/basicScheduleFieldInfo.ts
 | 
					model/basicScheduleFieldInfo.ts
 | 
				
			||||||
 | 
					model/basicScheduleInfo.ts
 | 
				
			||||||
 | 
					model/basicScheduleInfoAllOf.ts
 | 
				
			||||||
model/eMailChangeRequest.ts
 | 
					model/eMailChangeRequest.ts
 | 
				
			||||||
model/forgottenActivityRequest.ts
 | 
					model/forgottenActivityRequest.ts
 | 
				
			||||||
model/inlineResponse200.ts
 | 
					model/inlineResponse200.ts
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,6 @@ import { HttpClient, HttpHeaders, HttpParams,
 | 
				
			|||||||
import { CustomHttpParameterCodec }                          from '../encoder';
 | 
					import { CustomHttpParameterCodec }                          from '../encoder';
 | 
				
			||||||
import { Observable }                                        from 'rxjs';
 | 
					import { Observable }                                        from 'rxjs';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { BasicScheduleEntityInfo } from '../model/models';
 | 
					 | 
				
			||||||
import { BasicScheduleFieldInfo } from '../model/models';
 | 
					import { BasicScheduleFieldInfo } from '../model/models';
 | 
				
			||||||
import { ForgottenActivityRequest } from '../model/models';
 | 
					import { ForgottenActivityRequest } from '../model/models';
 | 
				
			||||||
import { ScheduleActivateInfo } from '../model/models';
 | 
					import { ScheduleActivateInfo } from '../model/models';
 | 
				
			||||||
@ -147,6 +146,69 @@ export class ScheduleService {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * get today\'s schedules
 | 
				
			||||||
 | 
					     * get all schedules of today
 | 
				
			||||||
 | 
					     * @param date determines the scheduled dates of the schedules
 | 
				
			||||||
 | 
					     * @param startable determines whether only schedules that can be started should be included or 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 schedulesDateStartableGet(date: string, startable: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
 | 
				
			||||||
 | 
					    public schedulesDateStartableGet(date: string, startable: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
 | 
				
			||||||
 | 
					    public schedulesDateStartableGet(date: string, startable: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
 | 
				
			||||||
 | 
					    public schedulesDateStartableGet(date: string, startable: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					        if (date === null || date === undefined) {
 | 
				
			||||||
 | 
					            throw new Error('Required parameter date was null or undefined when calling schedulesDateStartableGet.');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (startable === null || startable === undefined) {
 | 
				
			||||||
 | 
					            throw new Error('Required parameter startable was null or undefined when calling schedulesDateStartableGet.');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        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/${encodeURIComponent(String(date))}/${encodeURIComponent(String(startable))}`,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * gets all schedules of user
 | 
					     * gets all schedules of user
 | 
				
			||||||
     * gets all schedules of user
 | 
					     * gets all schedules of user
 | 
				
			||||||
@ -317,6 +379,65 @@ export class ScheduleService {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * deletes schedule
 | 
				
			||||||
 | 
					     * deletes a schedule
 | 
				
			||||||
 | 
					     * @param scheduleID internal id of schedule
 | 
				
			||||||
 | 
					     * @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 schedulesScheduleIDDelete(scheduleID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
 | 
				
			||||||
 | 
					    public schedulesScheduleIDDelete(scheduleID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
 | 
				
			||||||
 | 
					    public schedulesScheduleIDDelete(scheduleID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
 | 
				
			||||||
 | 
					    public schedulesScheduleIDDelete(scheduleID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					        if (scheduleID === null || scheduleID === undefined) {
 | 
				
			||||||
 | 
					            throw new Error('Required parameter scheduleID was null or undefined when calling schedulesScheduleIDDelete.');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        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.delete<SimpleStatusResponse>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}`,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * reschedules task
 | 
					     * reschedules task
 | 
				
			||||||
     * reschedules a task
 | 
					     * reschedules a task
 | 
				
			||||||
@ -325,12 +446,12 @@ export class ScheduleService {
 | 
				
			|||||||
     * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
 | 
					     * @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.
 | 
					     * @param reportProgress flag to report request and response progress.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
 | 
					    public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
 | 
				
			||||||
    public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
 | 
					    public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
 | 
				
			||||||
    public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
 | 
					    public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
 | 
				
			||||||
    public schedulesScheduleIDBasicPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
					    public schedulesScheduleIDPost(scheduleID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
        if (scheduleID === null || scheduleID === undefined) {
 | 
					        if (scheduleID === null || scheduleID === undefined) {
 | 
				
			||||||
            throw new Error('Required parameter scheduleID was null or undefined when calling schedulesScheduleIDBasicPost.');
 | 
					            throw new Error('Required parameter scheduleID was null or undefined when calling schedulesScheduleIDPost.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let localVarHeaders = this.defaultHeaders;
 | 
					        let localVarHeaders = this.defaultHeaders;
 | 
				
			||||||
@ -374,7 +495,7 @@ export class ScheduleService {
 | 
				
			|||||||
            responseType_ = 'text';
 | 
					            responseType_ = 'text';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return this.httpClient.post<SimpleStatusResponse>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/basic`,
 | 
					        return this.httpClient.post<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}`,
 | 
				
			||||||
            basicScheduleFieldInfo,
 | 
					            basicScheduleFieldInfo,
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                context: localVarHttpContext,
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
@ -387,69 +508,6 @@ export class ScheduleService {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * deletes schedule
 | 
					 | 
				
			||||||
     * deletes a schedule
 | 
					 | 
				
			||||||
     * @param scheduleID internal id of schedule
 | 
					 | 
				
			||||||
     * @param scheduleType internal id of task
 | 
					 | 
				
			||||||
     * @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 schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
 | 
					 | 
				
			||||||
    public schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
 | 
					 | 
				
			||||||
    public schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
 | 
					 | 
				
			||||||
    public schedulesScheduleIDScheduleTypeDelete(scheduleID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
					 | 
				
			||||||
        if (scheduleID === null || scheduleID === undefined) {
 | 
					 | 
				
			||||||
            throw new Error('Required parameter scheduleID was null or undefined when calling schedulesScheduleIDScheduleTypeDelete.');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (scheduleType === null || scheduleType === undefined) {
 | 
					 | 
				
			||||||
            throw new Error('Required parameter scheduleType was null or undefined when calling schedulesScheduleIDScheduleTypeDelete.');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        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.delete<SimpleStatusResponse>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/${encodeURIComponent(String(scheduleType))}`,
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                context: localVarHttpContext,
 | 
					 | 
				
			||||||
                responseType: <any>responseType_,
 | 
					 | 
				
			||||||
                withCredentials: this.configuration.withCredentials,
 | 
					 | 
				
			||||||
                headers: localVarHeaders,
 | 
					 | 
				
			||||||
                observe: observe,
 | 
					 | 
				
			||||||
                reportProgress: reportProgress
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @param scheduleID internal id of schedule
 | 
					     * @param scheduleID internal id of schedule
 | 
				
			||||||
     * @param finish internal id of schedule
 | 
					     * @param finish internal id of schedule
 | 
				
			||||||
@ -626,76 +684,6 @@ export class ScheduleService {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * creates basic schedule for task
 | 
					 | 
				
			||||||
     * creates a basic schedule for a task
 | 
					 | 
				
			||||||
     * @param taskID internal id of task
 | 
					 | 
				
			||||||
     * @param basicScheduleFieldInfo 
 | 
					 | 
				
			||||||
     * @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 schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<BasicScheduleEntityInfo>;
 | 
					 | 
				
			||||||
    public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<BasicScheduleEntityInfo>>;
 | 
					 | 
				
			||||||
    public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<BasicScheduleEntityInfo>>;
 | 
					 | 
				
			||||||
    public schedulesTaskIDBasicPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
					 | 
				
			||||||
        if (taskID === null || taskID === undefined) {
 | 
					 | 
				
			||||||
            throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDBasicPut.');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        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();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // to determine the Content-Type header
 | 
					 | 
				
			||||||
        const consumes: string[] = [
 | 
					 | 
				
			||||||
            'application/json'
 | 
					 | 
				
			||||||
        ];
 | 
					 | 
				
			||||||
        const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
 | 
					 | 
				
			||||||
        if (httpContentTypeSelected !== undefined) {
 | 
					 | 
				
			||||||
            localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        let responseType_: 'text' | 'json' = 'json';
 | 
					 | 
				
			||||||
        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
					 | 
				
			||||||
            responseType_ = 'text';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return this.httpClient.put<BasicScheduleEntityInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}/basic`,
 | 
					 | 
				
			||||||
            basicScheduleFieldInfo,
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                context: localVarHttpContext,
 | 
					 | 
				
			||||||
                responseType: <any>responseType_,
 | 
					 | 
				
			||||||
                withCredentials: this.configuration.withCredentials,
 | 
					 | 
				
			||||||
                headers: localVarHeaders,
 | 
					 | 
				
			||||||
                observe: observe,
 | 
					 | 
				
			||||||
                reportProgress: reportProgress
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * registers forgotten schedule
 | 
					     * registers forgotten schedule
 | 
				
			||||||
     * Registers forgotten schedule
 | 
					     * Registers forgotten schedule
 | 
				
			||||||
@ -766,6 +754,65 @@ export class ScheduleService {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * gets schedules of task
 | 
				
			||||||
 | 
					     * gets schedules of task
 | 
				
			||||||
 | 
					     * @param taskID internal id of task
 | 
				
			||||||
 | 
					     * @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 schedulesTaskIDGet(taskID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
 | 
				
			||||||
 | 
					    public schedulesTaskIDGet(taskID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
 | 
				
			||||||
 | 
					    public schedulesTaskIDGet(taskID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
 | 
				
			||||||
 | 
					    public schedulesTaskIDGet(taskID: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
 | 
					        if (taskID === null || taskID === undefined) {
 | 
				
			||||||
 | 
					            throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDGet.');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        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/${encodeURIComponent(String(taskID))}`,
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
					                withCredentials: this.configuration.withCredentials,
 | 
				
			||||||
 | 
					                headers: localVarHeaders,
 | 
				
			||||||
 | 
					                observe: observe,
 | 
				
			||||||
 | 
					                reportProgress: reportProgress
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * schedule task now
 | 
					     * schedule task now
 | 
				
			||||||
     * schedule task now
 | 
					     * schedule task now
 | 
				
			||||||
@ -827,22 +874,19 @@ export class ScheduleService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * gets schedules of task
 | 
					     * creates basic schedule for task
 | 
				
			||||||
     * gets schedules of task
 | 
					     * creates a basic schedule for a task
 | 
				
			||||||
     * @param taskID internal id of task
 | 
					     * @param taskID internal id of task
 | 
				
			||||||
     * @param scheduleType internal id of task
 | 
					     * @param basicScheduleFieldInfo 
 | 
				
			||||||
     * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
 | 
					     * @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.
 | 
					     * @param reportProgress flag to report request and response progress.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<BasicScheduleEntityInfo>>;
 | 
					    public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
 | 
				
			||||||
    public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<BasicScheduleEntityInfo>>>;
 | 
					    public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
 | 
				
			||||||
    public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<BasicScheduleEntityInfo>>>;
 | 
					    public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
 | 
				
			||||||
    public schedulesTaskIDScheduleTypeGet(taskID: number, scheduleType: 'BASIC' | 'MODERATE' | 'ADVANCED', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
					    public schedulesTaskIDPut(taskID: number, basicScheduleFieldInfo?: BasicScheduleFieldInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
				
			||||||
        if (taskID === null || taskID === undefined) {
 | 
					        if (taskID === null || taskID === undefined) {
 | 
				
			||||||
            throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDScheduleTypeGet.');
 | 
					            throw new Error('Required parameter taskID was null or undefined when calling schedulesTaskIDPut.');
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (scheduleType === null || scheduleType === undefined) {
 | 
					 | 
				
			||||||
            throw new Error('Required parameter scheduleType was null or undefined when calling schedulesTaskIDScheduleTypeGet.');
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let localVarHeaders = this.defaultHeaders;
 | 
					        let localVarHeaders = this.defaultHeaders;
 | 
				
			||||||
@ -872,71 +916,22 @@ export class ScheduleService {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let responseType_: 'text' | 'json' = 'json';
 | 
					        // to determine the Content-Type header
 | 
				
			||||||
        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
					        const consumes: string[] = [
 | 
				
			||||||
            responseType_ = 'text';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return this.httpClient.get<Array<BasicScheduleEntityInfo>>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}/${encodeURIComponent(String(scheduleType))}`,
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                context: localVarHttpContext,
 | 
					 | 
				
			||||||
                responseType: <any>responseType_,
 | 
					 | 
				
			||||||
                withCredentials: this.configuration.withCredentials,
 | 
					 | 
				
			||||||
                headers: localVarHeaders,
 | 
					 | 
				
			||||||
                observe: observe,
 | 
					 | 
				
			||||||
                reportProgress: reportProgress
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * get today\'s schedules
 | 
					 | 
				
			||||||
     * get all schedules of today
 | 
					 | 
				
			||||||
     * @param activateable determines whether only schedules that can be started should be included or 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 schedulesTodayActivateableGet(activateable: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
 | 
					 | 
				
			||||||
    public schedulesTodayActivateableGet(activateable: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
 | 
					 | 
				
			||||||
    public schedulesTodayActivateableGet(activateable: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
 | 
					 | 
				
			||||||
    public schedulesTodayActivateableGet(activateable: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
 | 
					 | 
				
			||||||
        if (activateable === null || activateable === undefined) {
 | 
					 | 
				
			||||||
            throw new Error('Required parameter activateable was null or undefined when calling schedulesTodayActivateableGet.');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        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'
 | 
					            'application/json'
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
            localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
 | 
					        const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
 | 
				
			||||||
 | 
					        if (httpContentTypeSelected !== undefined) {
 | 
				
			||||||
 | 
					            localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        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';
 | 
					        let responseType_: 'text' | 'json' = 'json';
 | 
				
			||||||
        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
					        if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
 | 
				
			||||||
            responseType_ = 'text';
 | 
					            responseType_ = 'text';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return this.httpClient.get<Array<ScheduleInfo>>(`${this.configuration.basePath}/schedules/today/${encodeURIComponent(String(activateable))}`,
 | 
					        return this.httpClient.put<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(taskID))}`,
 | 
				
			||||||
 | 
					            basicScheduleFieldInfo,
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                context: localVarHttpContext,
 | 
					                context: localVarHttpContext,
 | 
				
			||||||
                responseType: <any>responseType_,
 | 
					                responseType: <any>responseType_,
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										52
									
								
								frontend/src/api/model/basicScheduleInfo.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								frontend/src/api/model/basicScheduleInfo.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,52 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * API Title
 | 
				
			||||||
 | 
					 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The version of the OpenAPI document: 1.0
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 | 
				
			||||||
 | 
					 * https://openapi-generator.tech
 | 
				
			||||||
 | 
					 * Do not edit the class manually.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					import { BasicScheduleInfoAllOf } from './basicScheduleInfoAllOf';
 | 
				
			||||||
 | 
					import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
 | 
				
			||||||
 | 
					import { TaskShortInfo } from './taskShortInfo';
 | 
				
			||||||
 | 
					import { ScheduleInfo } from './scheduleInfo';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface BasicScheduleInfo { 
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * internal id of schedule
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    scheduleID: number;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * type of schedule
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    scheduleType: BasicScheduleInfo.ScheduleTypeEnum;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 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;
 | 
				
			||||||
 | 
					    task: TaskShortInfo;
 | 
				
			||||||
 | 
					    taskgroupPath: Array<TaskgroupEntityInfo>;
 | 
				
			||||||
 | 
					    scheduleDate: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					export namespace BasicScheduleInfo {
 | 
				
			||||||
 | 
					    export type ScheduleTypeEnum = 'BASIC' | 'MODERATE' | 'ADVANCED';
 | 
				
			||||||
 | 
					    export const ScheduleTypeEnum = {
 | 
				
			||||||
 | 
					        Basic: 'BASIC' as ScheduleTypeEnum,
 | 
				
			||||||
 | 
					        Moderate: 'MODERATE' as ScheduleTypeEnum,
 | 
				
			||||||
 | 
					        Advanced: 'ADVANCED' as ScheduleTypeEnum
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										17
									
								
								frontend/src/api/model/basicScheduleInfoAllOf.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								frontend/src/api/model/basicScheduleInfoAllOf.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * API Title
 | 
				
			||||||
 | 
					 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The version of the OpenAPI document: 1.0
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 | 
				
			||||||
 | 
					 * https://openapi-generator.tech
 | 
				
			||||||
 | 
					 * Do not edit the class manually.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface BasicScheduleInfoAllOf { 
 | 
				
			||||||
 | 
					    scheduleDate: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -13,21 +13,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface ForgottenActivityRequest { 
 | 
					export interface ForgottenActivityRequest { 
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * mode of register forgotten activity
 | 
					     * time the schedule was started
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    mode: ForgottenActivityRequest.ModeEnum;
 | 
					    startTime: string;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * number of minutes spent on task
 | 
					     * time the schedule was stopped
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    minutesSpent?: number;
 | 
					    endTime: string;
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
export namespace ForgottenActivityRequest {
 | 
					 | 
				
			||||||
    export type ModeEnum = 'MANUAL' | 'LAST' | 'PLANNED';
 | 
					 | 
				
			||||||
    export const ModeEnum = {
 | 
					 | 
				
			||||||
        Manual: 'MANUAL' as ModeEnum,
 | 
					 | 
				
			||||||
        Last: 'LAST' as ModeEnum,
 | 
					 | 
				
			||||||
        Planned: 'PLANNED' as ModeEnum
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,8 @@
 | 
				
			|||||||
export * from './accountDeleteRequest';
 | 
					export * from './accountDeleteRequest';
 | 
				
			||||||
export * from './basicScheduleEntityInfo';
 | 
					export * from './basicScheduleEntityInfo';
 | 
				
			||||||
export * from './basicScheduleFieldInfo';
 | 
					export * from './basicScheduleFieldInfo';
 | 
				
			||||||
 | 
					export * from './basicScheduleInfo';
 | 
				
			||||||
 | 
					export * from './basicScheduleInfoAllOf';
 | 
				
			||||||
export * from './eMailChangeRequest';
 | 
					export * from './eMailChangeRequest';
 | 
				
			||||||
export * from './forgottenActivityRequest';
 | 
					export * from './forgottenActivityRequest';
 | 
				
			||||||
export * from './inlineResponse200';
 | 
					export * from './inlineResponse200';
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,6 @@
 | 
				
			|||||||
 * https://openapi-generator.tech
 | 
					 * https://openapi-generator.tech
 | 
				
			||||||
 * Do not edit the class manually.
 | 
					 * Do not edit the class manually.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
import { BasicScheduleFieldInfo } from './basicScheduleFieldInfo';
 | 
					 | 
				
			||||||
import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
 | 
					import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
 | 
				
			||||||
import { TaskShortInfo } from './taskShortInfo';
 | 
					import { TaskShortInfo } from './taskShortInfo';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -35,7 +34,6 @@ export interface ScheduleInfo {
 | 
				
			|||||||
     * number in minutes that the schedule was active
 | 
					     * number in minutes that the schedule was active
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    activeMinutes: number;
 | 
					    activeMinutes: number;
 | 
				
			||||||
    schedule: BasicScheduleFieldInfo;
 | 
					 | 
				
			||||||
    task: TaskShortInfo;
 | 
					    task: TaskShortInfo;
 | 
				
			||||||
    taskgroupPath: Array<TaskgroupEntityInfo>;
 | 
					    taskgroupPath: Array<TaskgroupEntityInfo>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,7 @@ export class DashboardComponent implements OnInit{
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit() {
 | 
					  ngOnInit() {
 | 
				
			||||||
    this.scheduleService.schedulesTodayActivateableGet(true).subscribe({
 | 
					    this.scheduleService.schedulesDateStartableGet(String(Date.now()),  true).subscribe({
 | 
				
			||||||
      next: resp => {
 | 
					      next: resp => {
 | 
				
			||||||
        this.schedules = resp;
 | 
					        this.schedules = resp;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<div mat-dialog-actions align="end">
 | 
					<div mat-dialog-actions align="end">
 | 
				
			||||||
  <button mat-raised-button>Cancel</button>
 | 
					  <button mat-raised-button>Cancel</button>
 | 
				
			||||||
  <button mat-raised-button color="primary" (click)="registerActivity()">Register</button>
 | 
					  <button mat-raised-button color="primary" (click)="registerActivity()" [disabled]="true">Register</button>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,6 @@ import {DialogRef} from "@angular/cdk/dialog";
 | 
				
			|||||||
import {MatDialogRef} from "@angular/material/dialog";
 | 
					import {MatDialogRef} from "@angular/material/dialog";
 | 
				
			||||||
import {filter, map, Observable, startWith} from "rxjs";
 | 
					import {filter, map, Observable, startWith} from "rxjs";
 | 
				
			||||||
import {FormControl} from "@angular/forms";
 | 
					import {FormControl} from "@angular/forms";
 | 
				
			||||||
import ModeEnum = ForgottenActivityRequest.ModeEnum;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
  selector: 'app-forgotten-task-start-dialog',
 | 
					  selector: 'app-forgotten-task-start-dialog',
 | 
				
			||||||
@ -53,7 +52,7 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
 | 
				
			|||||||
  registerActivity() {
 | 
					  registerActivity() {
 | 
				
			||||||
    const task = this.tasks.find(task => task.taskName === this.myControl.value);
 | 
					    const task = this.tasks.find(task => task.taskName === this.myControl.value);
 | 
				
			||||||
    if(task != undefined) {
 | 
					    if(task != undefined) {
 | 
				
			||||||
      this.scheduleService.schedulesTaskIDForgottenPost(task.taskID, {
 | 
					      /*this.scheduleService.schedulesTaskIDForgottenPost(task.taskID, {
 | 
				
			||||||
        mode: this.determineRegisterMode(),
 | 
					        mode: this.determineRegisterMode(),
 | 
				
			||||||
        minutesSpent: this.minutesSpentControl.value
 | 
					        minutesSpent: this.minutesSpentControl.value
 | 
				
			||||||
      }).subscribe({
 | 
					      }).subscribe({
 | 
				
			||||||
@ -71,17 +70,7 @@ export class ForgottenTaskStartDialogComponent implements OnInit{
 | 
				
			|||||||
            this.snackbar.open("Unexpected error", "", {duration: 2000});
 | 
					            this.snackbar.open("Unexpected error", "", {duration: 2000});
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })*/
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  private determineRegisterMode(): ModeEnum {
 | 
					 | 
				
			||||||
    if(this.lastSchedule) {
 | 
					 | 
				
			||||||
      return "LAST";
 | 
					 | 
				
			||||||
    } else if(this.plannedSchedule) {
 | 
					 | 
				
			||||||
      return "PLANNED";
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      return "MANUAL";
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,7 @@
 | 
				
			|||||||
      <mat-progress-bar mode="determinate" [value]="schedule.activeMinutes"></mat-progress-bar>
 | 
					      <mat-progress-bar mode="determinate" [value]="schedule.activeMinutes"></mat-progress-bar>
 | 
				
			||||||
      <div class="originally-planned-container">
 | 
					      <div class="originally-planned-container">
 | 
				
			||||||
        <div style="width: 100%">
 | 
					        <div style="width: 100%">
 | 
				
			||||||
          <p style="display: inline-block"><i>Originally planned:</i> {{schedule.schedule.scheduleDate}}</p>
 | 
					          <p style="display: inline-block"><i>Originally planned:</i> {{toBasicSchedule(schedule).scheduleDate}}</p>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div style="width: 100%" class="reschedule-actions-container">
 | 
					        <div style="width: 100%" class="reschedule-actions-container">
 | 
				
			||||||
          <button mat-raised-button color="primary" class="rescheduleBtn"
 | 
					          <button mat-raised-button color="primary" class="rescheduleBtn"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
import {Component, OnInit} from '@angular/core';
 | 
					import {Component, OnInit} from '@angular/core';
 | 
				
			||||||
import {ScheduleInfo, ScheduleService} from "../../api";
 | 
					import {BasicScheduleInfo, ScheduleInfo, ScheduleService} from "../../api";
 | 
				
			||||||
import {NavigationLink} from "../navigation-link-list/navigation-link-list.component";
 | 
					import {NavigationLink} from "../navigation-link-list/navigation-link-list.component";
 | 
				
			||||||
import {MatSnackBar} from "@angular/material/snack-bar";
 | 
					import {MatSnackBar} from "@angular/material/snack-bar";
 | 
				
			||||||
import {MatDialog} from "@angular/material/dialog";
 | 
					import {MatDialog} from "@angular/material/dialog";
 | 
				
			||||||
@ -39,7 +39,7 @@ export class MissedSchedulesComponent implements OnInit{
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  forgetSchedule(scheduleInfo: ScheduleInfo) {
 | 
					  forgetSchedule(scheduleInfo: ScheduleInfo) {
 | 
				
			||||||
    this.scheduleService.schedulesScheduleIDScheduleTypeDelete(scheduleInfo.scheduleID, "BASIC").subscribe({
 | 
					    this.scheduleService.schedulesScheduleIDDelete(scheduleInfo.scheduleID).subscribe({
 | 
				
			||||||
      next: resp => {
 | 
					      next: resp => {
 | 
				
			||||||
        this.missedSchedules = this.missedSchedules.filter(schedule => schedule.scheduleID !== scheduleInfo.scheduleID)
 | 
					        this.missedSchedules = this.missedSchedules.filter(schedule => schedule.scheduleID !== scheduleInfo.scheduleID)
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@ -63,4 +63,8 @@ export class MissedSchedulesComponent implements OnInit{
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  toBasicSchedule(schedule: ScheduleInfo) {
 | 
				
			||||||
 | 
					    return schedule as BasicScheduleInfo
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,12 @@
 | 
				
			|||||||
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
 | 
					import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
 | 
				
			||||||
import {FormControl, Validators} from "@angular/forms";
 | 
					import {FormControl, Validators} from "@angular/forms";
 | 
				
			||||||
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo, TaskgroupEntityInfo} from "../../../api";
 | 
					import {
 | 
				
			||||||
 | 
					  BasicScheduleEntityInfo,
 | 
				
			||||||
 | 
					  BasicScheduleInfo,
 | 
				
			||||||
 | 
					  ScheduleService,
 | 
				
			||||||
 | 
					  TaskEntityInfo,
 | 
				
			||||||
 | 
					  TaskgroupEntityInfo
 | 
				
			||||||
 | 
					} from "../../../api";
 | 
				
			||||||
import {MatSnackBar} from "@angular/material/snack-bar";
 | 
					import {MatSnackBar} from "@angular/material/snack-bar";
 | 
				
			||||||
import {Router} from "@angular/router";
 | 
					import {Router} from "@angular/router";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -29,15 +35,15 @@ export class BasicSchedulerComponent implements OnChanges{
 | 
				
			|||||||
  schedule() {
 | 
					  schedule() {
 | 
				
			||||||
    if(this.task != undefined) {
 | 
					    if(this.task != undefined) {
 | 
				
			||||||
      if(this.scheduleEntityInfo == undefined) {
 | 
					      if(this.scheduleEntityInfo == undefined) {
 | 
				
			||||||
        this.scheduleService.schedulesTaskIDBasicPut(this.task.taskID, {
 | 
					        this.scheduleService.schedulesTaskIDPut(this.task.taskID, {
 | 
				
			||||||
          scheduleDate: this.dateCtrl.value
 | 
					          scheduleDate: this.dateCtrl.value
 | 
				
			||||||
        }).subscribe({
 | 
					        }).subscribe({
 | 
				
			||||||
          next: resp => {
 | 
					          next: resp => {
 | 
				
			||||||
            this.scheduleEmitter.emit(resp);
 | 
					            this.scheduleEmitter.emit(resp as BasicScheduleInfo);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        this.scheduleService.schedulesScheduleIDBasicPost(this.scheduleEntityInfo!.scheduleID, {
 | 
					        this.scheduleService.schedulesScheduleIDPost(this.scheduleEntityInfo!.scheduleID, {
 | 
				
			||||||
          scheduleDate: this.dateCtrl.value
 | 
					          scheduleDate: this.dateCtrl.value
 | 
				
			||||||
        }).subscribe({
 | 
					        }).subscribe({
 | 
				
			||||||
          next: resp => {
 | 
					          next: resp => {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,17 @@
 | 
				
			|||||||
<mat-card *ngFor="let schedule of schedules" class="scheduleContainer">
 | 
					<mat-card *ngFor="let schedule of schedules" class="scheduleContainer">
 | 
				
			||||||
  <mat-card-content>
 | 
					  <mat-card-content>
 | 
				
			||||||
 | 
					    <ng-container *ngIf="schedule.scheduleType == 'BASIC'">
 | 
				
			||||||
      <div class="basicScheduleContainer">
 | 
					      <div class="basicScheduleContainer">
 | 
				
			||||||
      <p class="basicScheduleContent">{{schedule.scheduleDate | date:'EEEE, d MMM. y'}}</p>
 | 
					        <p class="basicScheduleContent">{{ toBasicSchedule(schedule).scheduleDate | date:'EEEE, d MMM. y'}}</p>
 | 
				
			||||||
        <div class="basicScheduleContent">
 | 
					        <div class="basicScheduleContent">
 | 
				
			||||||
          <button mat-icon-button color="primary" [routerLink]="['/taskgroups', taskgroup!.taskgroupID, 'tasks', task!.taskID, 'schedule', schedule.scheduleID]"><mat-icon>edit</mat-icon></button>
 | 
					          <button mat-icon-button color="primary" [routerLink]="['/taskgroups', taskgroup!.taskgroupID, 'tasks', task!.taskID, 'schedule', schedule.scheduleID]"><mat-icon>edit</mat-icon></button>
 | 
				
			||||||
          <button mat-icon-button color="warn" (click)="deleteSchedule(schedule)"><mat-icon>delete</mat-icon></button>
 | 
					          <button mat-icon-button color="warn" (click)="deleteSchedule(schedule)"><mat-icon>delete</mat-icon></button>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    </ng-container>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,11 @@
 | 
				
			|||||||
import {Component, Input, OnInit} from '@angular/core';
 | 
					import {Component, Input, OnInit} from '@angular/core';
 | 
				
			||||||
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo, TaskgroupEntityInfo} from "../../../api";
 | 
					import {
 | 
				
			||||||
 | 
					  BasicScheduleEntityInfo, BasicScheduleInfo,
 | 
				
			||||||
 | 
					  ScheduleInfo,
 | 
				
			||||||
 | 
					  ScheduleService,
 | 
				
			||||||
 | 
					  TaskEntityInfo,
 | 
				
			||||||
 | 
					  TaskgroupEntityInfo
 | 
				
			||||||
 | 
					} from "../../../api";
 | 
				
			||||||
import {MatSnackBar} from "@angular/material/snack-bar";
 | 
					import {MatSnackBar} from "@angular/material/snack-bar";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component({
 | 
					@Component({
 | 
				
			||||||
@ -12,7 +18,7 @@ export class ScheduleDashboardComponent implements OnInit{
 | 
				
			|||||||
  @Input('taskgroup')  taskgroup: TaskgroupEntityInfo | undefined
 | 
					  @Input('taskgroup')  taskgroup: TaskgroupEntityInfo | undefined
 | 
				
			||||||
  @Input('task') task: TaskEntityInfo | undefined
 | 
					  @Input('task') task: TaskEntityInfo | undefined
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  schedules: BasicScheduleEntityInfo[] = []
 | 
					  schedules: ScheduleInfo[] = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(private scheduleService: ScheduleService,
 | 
					  constructor(private scheduleService: ScheduleService,
 | 
				
			||||||
              private snackbar: MatSnackBar) {
 | 
					              private snackbar: MatSnackBar) {
 | 
				
			||||||
@ -20,7 +26,7 @@ export class ScheduleDashboardComponent implements OnInit{
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ngOnInit() {
 | 
					  ngOnInit() {
 | 
				
			||||||
    this.scheduleService.schedulesTaskIDScheduleTypeGet(this.task!.taskID, "BASIC").subscribe({
 | 
					    this.scheduleService.schedulesTaskIDGet(this.task!.taskID).subscribe({
 | 
				
			||||||
      next: resp => {
 | 
					      next: resp => {
 | 
				
			||||||
        this.schedules = resp;
 | 
					        this.schedules = resp;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -31,8 +37,8 @@ export class ScheduleDashboardComponent implements OnInit{
 | 
				
			|||||||
    //todo
 | 
					    //todo
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  deleteSchedule(deletedSchedule: BasicScheduleEntityInfo) {
 | 
					  deleteSchedule(deletedSchedule: ScheduleInfo) {
 | 
				
			||||||
    this.scheduleService.schedulesScheduleIDScheduleTypeDelete(deletedSchedule.scheduleID, 'BASIC').subscribe({
 | 
					    this.scheduleService.schedulesScheduleIDDelete(deletedSchedule.scheduleID).subscribe({
 | 
				
			||||||
      next: resp => {
 | 
					      next: resp => {
 | 
				
			||||||
        this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID);
 | 
					        this.schedules = this.schedules.filter(schedule => schedule.scheduleID !== deletedSchedule.scheduleID);
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@ -47,4 +53,8 @@ export class ScheduleDashboardComponent implements OnInit{
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  toBasicSchedule(schedule: ScheduleInfo) {
 | 
				
			||||||
 | 
					    return schedule as BasicScheduleInfo
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
import {Component, OnInit, ViewChild} from '@angular/core';
 | 
					import {Component, OnInit, ViewChild} from '@angular/core';
 | 
				
			||||||
import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
 | 
					import {NavigationLink, NavigationLinkListComponent} from "../../navigation-link-list/navigation-link-list.component";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  BasicScheduleEntityInfo, ScheduleService,
 | 
					  BasicScheduleEntityInfo, BasicScheduleInfo, ScheduleService,
 | 
				
			||||||
  TaskEntityInfo,
 | 
					  TaskEntityInfo,
 | 
				
			||||||
  TaskgroupEntityInfo,
 | 
					  TaskgroupEntityInfo,
 | 
				
			||||||
  TaskgroupService,
 | 
					  TaskgroupService,
 | 
				
			||||||
@ -136,7 +136,18 @@ export class SchedulerComponent implements OnInit{
 | 
				
			|||||||
  fetschSchedules() {
 | 
					  fetschSchedules() {
 | 
				
			||||||
    this.scheduleService.schedulesGet().subscribe({
 | 
					    this.scheduleService.schedulesGet().subscribe({
 | 
				
			||||||
      next: resp => {
 | 
					      next: resp => {
 | 
				
			||||||
        resp.forEach(schedule => {
 | 
					        resp.forEach(abstractSchedule => {
 | 
				
			||||||
 | 
					          if(abstractSchedule.scheduleType == 'BASIC') {
 | 
				
			||||||
 | 
					            this.handleFetchedBasicSchedule(abstractSchedule as BasicScheduleInfo)
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					        this.refresh.next();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  handleFetchedBasicSchedule(schedule: BasicScheduleInfo) {
 | 
				
			||||||
    let color: EventColor = colors['red']
 | 
					    let color: EventColor = colors['red']
 | 
				
			||||||
    if(schedule.scheduleID === this.scheduleID) {
 | 
					    if(schedule.scheduleID === this.scheduleID) {
 | 
				
			||||||
      color = colors['yellow']
 | 
					      color = colors['yellow']
 | 
				
			||||||
@ -144,16 +155,12 @@ export class SchedulerComponent implements OnInit{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if(schedule.scheduleType === 'BASIC') {
 | 
					    if(schedule.scheduleType === 'BASIC') {
 | 
				
			||||||
      this.events.push({
 | 
					      this.events.push({
 | 
				
			||||||
              start: new Date(schedule.schedule.scheduleDate),
 | 
					        start: new Date(schedule.scheduleDate),
 | 
				
			||||||
        title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
 | 
					        title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
 | 
				
			||||||
        color: color,
 | 
					        color: color,
 | 
				
			||||||
        allDay: true,
 | 
					        allDay: true,
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
        this.refresh.next();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  eventClicked({ event }: { event: CalendarEvent }): void {
 | 
					  eventClicked({ event }: { event: CalendarEvent }): void {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										82
									
								
								openapi.yaml
									
									
									
									
									
								
							
							
						
						
									
										82
									
								
								openapi.yaml
									
									
									
									
									
								
							@ -1270,7 +1270,7 @@ paths:
 | 
				
			|||||||
                items: 
 | 
					                items: 
 | 
				
			||||||
                  $ref: '#/components/schemas/ScheduleInfo'
 | 
					                  $ref: '#/components/schemas/ScheduleInfo'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /schedules/{taskID}/{scheduleType}:
 | 
					  /schedules/{taskID}:
 | 
				
			||||||
    get:
 | 
					    get:
 | 
				
			||||||
      security:
 | 
					      security:
 | 
				
			||||||
        - API_TOKEN: []
 | 
					        - API_TOKEN: []
 | 
				
			||||||
@ -1286,16 +1286,6 @@ paths:
 | 
				
			|||||||
          schema:
 | 
					          schema:
 | 
				
			||||||
            type: number
 | 
					            type: number
 | 
				
			||||||
            example: 1
 | 
					            example: 1
 | 
				
			||||||
        - name: scheduleType
 | 
					 | 
				
			||||||
          in: path
 | 
					 | 
				
			||||||
          description: internal id of task
 | 
					 | 
				
			||||||
          required: true
 | 
					 | 
				
			||||||
          schema:
 | 
					 | 
				
			||||||
            type: string
 | 
					 | 
				
			||||||
            enum:
 | 
					 | 
				
			||||||
              - BASIC
 | 
					 | 
				
			||||||
              - MODERATE
 | 
					 | 
				
			||||||
              - ADVANCED
 | 
					 | 
				
			||||||
      responses:
 | 
					      responses:
 | 
				
			||||||
        200:
 | 
					        200:
 | 
				
			||||||
          description: operation successfull
 | 
					          description: operation successfull
 | 
				
			||||||
@ -1304,7 +1294,7 @@ paths:
 | 
				
			|||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: array
 | 
					                type: array
 | 
				
			||||||
                items:
 | 
					                items:
 | 
				
			||||||
                  $ref: '#/components/schemas/BasicScheduleEntityInfo'
 | 
					                  $ref: '#/components/schemas/ScheduleInfo'
 | 
				
			||||||
        403:
 | 
					        403:
 | 
				
			||||||
          description: No permission
 | 
					          description: No permission
 | 
				
			||||||
          content:
 | 
					          content:
 | 
				
			||||||
@ -1319,7 +1309,6 @@ paths:
 | 
				
			|||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: object
 | 
					                type: object
 | 
				
			||||||
                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
					                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
				
			||||||
  /schedules/{taskID}/basic:
 | 
					 | 
				
			||||||
    put:
 | 
					    put:
 | 
				
			||||||
      security:
 | 
					      security:
 | 
				
			||||||
        - API_TOKEN: []
 | 
					        - API_TOKEN: []
 | 
				
			||||||
@ -1347,7 +1336,7 @@ paths:
 | 
				
			|||||||
            application/json:
 | 
					            application/json:
 | 
				
			||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: object
 | 
					                type: object
 | 
				
			||||||
                $ref: '#/components/schemas/BasicScheduleEntityInfo'
 | 
					                $ref: '#/components/schemas/ScheduleInfo'
 | 
				
			||||||
        403:
 | 
					        403:
 | 
				
			||||||
          description: No permission
 | 
					          description: No permission
 | 
				
			||||||
          content:
 | 
					          content:
 | 
				
			||||||
@ -1362,7 +1351,7 @@ paths:
 | 
				
			|||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: object
 | 
					                type: object
 | 
				
			||||||
                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
					                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
				
			||||||
  /schedules/{scheduleID}/basic:
 | 
					  /schedules/{scheduleID}:
 | 
				
			||||||
    post:
 | 
					    post:
 | 
				
			||||||
      security:
 | 
					      security:
 | 
				
			||||||
        - API_TOKEN: []
 | 
					        - API_TOKEN: []
 | 
				
			||||||
@ -1390,7 +1379,7 @@ paths:
 | 
				
			|||||||
            application/json:
 | 
					            application/json:
 | 
				
			||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: object
 | 
					                type: object
 | 
				
			||||||
                $ref: '#/components/schemas/SimpleStatusResponse'
 | 
					                $ref: '#/components/schemas/ScheduleInfo'
 | 
				
			||||||
        403:
 | 
					        403:
 | 
				
			||||||
          description: No permission
 | 
					          description: No permission
 | 
				
			||||||
          content:
 | 
					          content:
 | 
				
			||||||
@ -1405,7 +1394,6 @@ paths:
 | 
				
			|||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: object
 | 
					                type: object
 | 
				
			||||||
                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
					                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
				
			||||||
  /schedules/{scheduleID}/{scheduleType}:
 | 
					 | 
				
			||||||
    delete:
 | 
					    delete:
 | 
				
			||||||
      security:
 | 
					      security:
 | 
				
			||||||
        - API_TOKEN: []
 | 
					        - API_TOKEN: []
 | 
				
			||||||
@ -1421,16 +1409,6 @@ paths:
 | 
				
			|||||||
          schema:
 | 
					          schema:
 | 
				
			||||||
            type: number
 | 
					            type: number
 | 
				
			||||||
            example: 1
 | 
					            example: 1
 | 
				
			||||||
        - name: scheduleType
 | 
					 | 
				
			||||||
          in: path
 | 
					 | 
				
			||||||
          description: internal id of task
 | 
					 | 
				
			||||||
          required: true
 | 
					 | 
				
			||||||
          schema:
 | 
					 | 
				
			||||||
            type: string
 | 
					 | 
				
			||||||
            enum:
 | 
					 | 
				
			||||||
              - BASIC
 | 
					 | 
				
			||||||
              - MODERATE
 | 
					 | 
				
			||||||
              - ADVANCED
 | 
					 | 
				
			||||||
      responses:
 | 
					      responses:
 | 
				
			||||||
        200:
 | 
					        200:
 | 
				
			||||||
          description: operation successfull
 | 
					          description: operation successfull
 | 
				
			||||||
@ -1453,7 +1431,7 @@ paths:
 | 
				
			|||||||
              schema:
 | 
					              schema:
 | 
				
			||||||
                type: object
 | 
					                type: object
 | 
				
			||||||
                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
					                $ref: "#/components/schemas/SimpleStatusResponse"
 | 
				
			||||||
  /schedules/today/{activateable}:
 | 
					  /schedules/{date}/{startable}:
 | 
				
			||||||
    get: 
 | 
					    get: 
 | 
				
			||||||
      security:
 | 
					      security:
 | 
				
			||||||
        - API_TOKEN: []
 | 
					        - API_TOKEN: []
 | 
				
			||||||
@ -1462,7 +1440,15 @@ paths:
 | 
				
			|||||||
      description: get all schedules of today
 | 
					      description: get all schedules of today
 | 
				
			||||||
      summary: get today's schedules
 | 
					      summary: get today's schedules
 | 
				
			||||||
      parameters:
 | 
					      parameters:
 | 
				
			||||||
        - name: activateable
 | 
					        - name: date
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: determines the scheduled dates of the schedules
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					            format: date
 | 
				
			||||||
 | 
					            nullable: true
 | 
				
			||||||
 | 
					        - name: startable
 | 
				
			||||||
          in: path
 | 
					          in: path
 | 
				
			||||||
          description: determines whether only schedules that can be started should be included or all schedules of today
 | 
					          description: determines whether only schedules that can be started should be included or all schedules of today
 | 
				
			||||||
          required: true
 | 
					          required: true
 | 
				
			||||||
@ -2182,7 +2168,6 @@ components:
 | 
				
			|||||||
        - startTime
 | 
					        - startTime
 | 
				
			||||||
        - finishTime
 | 
					        - finishTime
 | 
				
			||||||
        - activeMinutes
 | 
					        - activeMinutes
 | 
				
			||||||
        - schedule
 | 
					 | 
				
			||||||
        - task
 | 
					        - task
 | 
				
			||||||
        - taskgroupPath
 | 
					        - taskgroupPath
 | 
				
			||||||
      additionalProperties: false
 | 
					      additionalProperties: false
 | 
				
			||||||
@ -2211,10 +2196,6 @@ components:
 | 
				
			|||||||
          type: number
 | 
					          type: number
 | 
				
			||||||
          description: number in minutes that the schedule was active
 | 
					          description: number in minutes that the schedule was active
 | 
				
			||||||
          example: 10
 | 
					          example: 10
 | 
				
			||||||
        schedule:
 | 
					 | 
				
			||||||
          type: object
 | 
					 | 
				
			||||||
          oneOf:
 | 
					 | 
				
			||||||
            - $ref: '#/components/schemas/BasicScheduleFieldInfo'
 | 
					 | 
				
			||||||
        task:
 | 
					        task:
 | 
				
			||||||
          type: object
 | 
					          type: object
 | 
				
			||||||
          $ref: '#/components/schemas/TaskShortInfo'
 | 
					          $ref: '#/components/schemas/TaskShortInfo'
 | 
				
			||||||
@ -2222,7 +2203,17 @@ components:
 | 
				
			|||||||
          type: array
 | 
					          type: array
 | 
				
			||||||
          items:
 | 
					          items:
 | 
				
			||||||
            $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
					            $ref: '#/components/schemas/TaskgroupEntityInfo'
 | 
				
			||||||
        
 | 
					    BasicScheduleInfo:
 | 
				
			||||||
 | 
					      allOf:
 | 
				
			||||||
 | 
					        - $ref: '#/components/schemas/ScheduleInfo'
 | 
				
			||||||
 | 
					        - type: object
 | 
				
			||||||
 | 
					          required:
 | 
				
			||||||
 | 
					            - scheduleDate
 | 
				
			||||||
 | 
					          additionalProperties: false
 | 
				
			||||||
 | 
					          properties:
 | 
				
			||||||
 | 
					            scheduleDate:
 | 
				
			||||||
 | 
					              type: string
 | 
				
			||||||
 | 
					              format: date
 | 
				
			||||||
    TaskShortInfo:
 | 
					    TaskShortInfo:
 | 
				
			||||||
      required:
 | 
					      required:
 | 
				
			||||||
        - taskID
 | 
					        - taskID
 | 
				
			||||||
@ -2342,19 +2333,16 @@ components:
 | 
				
			|||||||
          example: true
 | 
					          example: true
 | 
				
			||||||
    ForgottenActivityRequest:
 | 
					    ForgottenActivityRequest:
 | 
				
			||||||
      required:
 | 
					      required:
 | 
				
			||||||
        - mode
 | 
					        - startTime
 | 
				
			||||||
 | 
					        - endTime
 | 
				
			||||||
      additionalProperties: false
 | 
					      additionalProperties: false
 | 
				
			||||||
      properties:
 | 
					      properties:
 | 
				
			||||||
        mode:
 | 
					        startTime:
 | 
				
			||||||
          type: string
 | 
					          type: string
 | 
				
			||||||
          description: mode of register forgotten activity
 | 
					          format: date
 | 
				
			||||||
          example: MANUAL
 | 
					          description: time the schedule was started
 | 
				
			||||||
          enum:
 | 
					        endTime:
 | 
				
			||||||
            - MANUAL
 | 
					          type: string
 | 
				
			||||||
            - LAST
 | 
					          format: date
 | 
				
			||||||
            - PLANNED
 | 
					          description: time the schedule was stopped
 | 
				
			||||||
        minutesSpent:
 | 
					 | 
				
			||||||
          type: number
 | 
					 | 
				
			||||||
          description: number of minutes spent on task
 | 
					 | 
				
			||||||
          example: 10
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user