Compare commits
180 Commits
nils-docke
...
master
Author | SHA1 | Date | |
---|---|---|---|
7dce3a434f | |||
|
952dddff2e | ||
|
dd58ec6520 | ||
|
57be3393c9 | ||
bc239f9b86 | |||
|
a8fb54f337 | ||
2bc3b3ab63 | |||
|
d537fd5d57 | ||
|
f0a596ff0c | ||
|
ba5faeed6a | ||
|
cd98423f6b | ||
|
8dffb6f9ad | ||
|
7cd1d68739 | ||
|
6417b7afb9 | ||
0d3ba5d7d7 | |||
|
79f1eba26b | ||
|
aa6eb9bfb2 | ||
|
8342d1ef2c | ||
|
583cb0aca0 | ||
d1527e6d9c | |||
|
28f390f88a | ||
|
bbdeaabd1e | ||
|
183030611b | ||
|
e1f69b340d | ||
|
985aa5f83b | ||
|
e53a1797fe | ||
1133d2123c | |||
|
514a5650bf | ||
|
88d285bef7 | ||
|
9d20335c59 | ||
|
f921d1d222 | ||
2215fe2ff8 | |||
|
b4a82c745d | ||
|
f5607f8023 | ||
4b6a90b085 | |||
|
0a60b8b27e | ||
|
4059500fa4 | ||
|
56d75fead9 | ||
|
7336daddb1 | ||
|
63418cb99a | ||
|
f080c6db52 | ||
|
9b995baa75 | ||
|
fea17c3fb9 | ||
|
f0d50a280e | ||
|
dcdba67f22 | ||
|
125ab10a00 | ||
|
dfe12e6102 | ||
|
8487a573a1 | ||
|
7526b6c134 | ||
|
6047f4097c | ||
|
682d88e183 | ||
|
d7b2683ffc | ||
|
160c379116 | ||
f7d844fd51 | |||
|
3e3fba9b2d | ||
|
e58e6addb9 | ||
|
e7283c030d | ||
|
f3c491826b | ||
|
9e5a1337d9 | ||
|
49119b2549 | ||
|
aafb5886db | ||
|
7d24ed1229 | ||
|
015d82587c | ||
|
ec4a1cfbc7 | ||
|
717e8d4e45 | ||
|
e102b91a1f | ||
|
c093720a07 | ||
|
59ee88b5fe | ||
|
4b9dd4d17c | ||
|
a3723e3459 | ||
|
3f58fe3600 | ||
13df4ac6fa | |||
|
56a7047bad | ||
|
313d329636 | ||
fcbf8b0a17 | |||
|
d68794236e | ||
574c86af7e | |||
|
19075b2b1d | ||
|
526c57a362 | ||
|
4155af45f5 | ||
|
4653ab9866 | ||
|
f2823ad21e | ||
|
6c8f216fa5 | ||
|
14aabc483f | ||
|
871751b5d4 | ||
|
248717cb45 | ||
|
2b0f9ef186 | ||
5366dcc0e3 | |||
|
a78be70a5d | ||
|
635b03ecac | ||
|
fc742a3526 | ||
|
376b5395f1 | ||
|
8e41085008 | ||
|
a66a72eb68 | ||
e88b030b03 | |||
a60533f379 | |||
16048d9023 | |||
ac4d6a712b | |||
0d64d9c72a | |||
84123f6664 | |||
3925828d1e | |||
08352add9d | |||
10dfda9031 | |||
303de733a1 | |||
29a74b934a | |||
1337bbb6ab | |||
be5af2bfe3 | |||
64e1a5c12f | |||
1ae6cd2a02 | |||
bb55951fb1 | |||
|
b71513a74b | ||
|
9a186fce5a | ||
|
882169840d | ||
|
cf0bbabb85 | ||
|
fda22edd96 | ||
|
da0cc90de6 | ||
|
bbae17fd25 | ||
63b2ea10a3 | |||
|
5f60470e2a | ||
|
edcd0f6c77 | ||
|
ed89c18f93 | ||
|
ac9e4c0f94 | ||
06a5826240 | |||
|
297bef284d | ||
|
cf7e2c5377 | ||
bcaae74516 | |||
|
fe9fae871a | ||
|
de01f5a100 | ||
|
eb3dba0830 | ||
19f3b6cf65 | |||
|
7b7d85d873 | ||
edf19a52ba | |||
|
ec5c74ca7d | ||
|
938087f8b3 | ||
e49b40fd48 | |||
|
5441ce0fbc | ||
|
912d8cc22f | ||
|
f88e97348e | ||
|
59e79a306f | ||
df8227a1f3 | |||
|
8a86241e86 | ||
|
e68f8e9432 | ||
|
7d63cd19cb | ||
|
e4daee49a1 | ||
|
af716718de | ||
|
523fa972f0 | ||
|
cf06f8107b | ||
|
afee5680e1 | ||
|
785032812f | ||
89a0979921 | |||
|
a4e7b12908 | ||
cb3394d7c4 | |||
|
f001abd73d | ||
|
a19de7b1b5 | ||
cf312ecc26 | |||
|
2d4c44ee09 | ||
|
aa9b462c96 | ||
|
0e28d59e3c | ||
|
8936dd65f4 | ||
|
ab43c49507 | ||
|
be6ab301c6 | ||
|
4f4c556bb9 | ||
617bac4d25 | |||
|
9ca128d80d | ||
|
7974bba473 | ||
79034a5b3a | |||
|
290cdd2fbf | ||
|
fa6b1b4fa1 | ||
89158aee1d | |||
|
1e492a9111 | ||
|
2477f32d0b | ||
db6e40e713 | |||
|
281d37cf0b | ||
55d2d4936e | |||
f97ed39bbe | |||
|
d2f5bb003e | ||
|
cf427cdd46 | ||
|
6cdf069b38 | ||
|
cfd1bfe7cb | ||
|
c25d45d697 |
@ -3,25 +3,61 @@ run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
build-and-push-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v4.5
|
||||
with:
|
||||
maven-version: 3.8.2
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file backend/pom.xml
|
||||
|
||||
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
|
||||
# - name: Update dependency graph
|
||||
#uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
|
||||
- uses: actions/checkout@v2
|
||||
- name: Log into registry at Gitea
|
||||
uses: docker/login-action@v2
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
registry: https://git.fawkes100.de
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v2
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
images: git.fawkes100.de/sebastian/timemanager/timemanager-frontend
|
||||
- name: Build and Push Latest Docker Image
|
||||
id: build-and-push-latest
|
||||
uses: docker/build-push-action@v4
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
context: frontend/.
|
||||
file: frontend/Dockerfile
|
||||
push: true
|
||||
tags: git.fawkes100.de/sebastian/timemanager/timemanager-frontend:latest
|
||||
build-and-push-backend:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Log into registry at Gitea
|
||||
uses: docker/login-action@v2
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
registry: https://git.fawkes100.de
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v2
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
images: git.fawkes100.de/sebastian/timemanager/timemanager-backend
|
||||
- name: Build and Push Latest Docker Image
|
||||
id: build-and-push-latest
|
||||
uses: docker/build-push-action@v4
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
context: backend/.
|
||||
file: backend/Dockerfile
|
||||
push: true
|
||||
tags: git.fawkes100.de/sebastian/timemanager/timemanager-backend:latest
|
@ -1,645 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Fix parsing datetime">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleFieldInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/taskSchedule/scheduleInfos/AdvancedScheduleFieldInfo.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/TaskgroupRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/TaskgroupRepository.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskgroupService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskgroupService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/core/taskgroups/TaskgroupRepsitoryTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/taskgroups/TaskgroupRepsitoryTest.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/advanced-scheduler/advanced-scheduler.component.ts" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Interface" />
|
||||
<option value="Enum" />
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$/.." value="master" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
</component>
|
||||
<component name="JpbToolWindowState">
|
||||
<option name="isToolWindowVisible" value="false" />
|
||||
</component>
|
||||
<component name="MavenRunner">
|
||||
<option name="skipTests" value="true" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"customColor": "",
|
||||
"associatedIndex": 6
|
||||
}</component>
|
||||
<component name="ProjectId" id="2VtEzh5AmQfX7fTAeLmHDDS0AYv" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RequestMappingsPanelOrder0": "0",
|
||||
"RequestMappingsPanelOrder1": "1",
|
||||
"RequestMappingsPanelWidth0": "75",
|
||||
"RequestMappingsPanelWidth1": "75",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"extract.method.default.visibility": "private",
|
||||
"git-widget-placeholder": "tests",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"last_directory_selection": "D:/Programmierprojekte/TimeManager/backend/src/main/java/core/api/models/timemanager",
|
||||
"last_opened_file_path": "/media/sebastian/Data2/Programmierprojekte/Storycreator",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "swagger",
|
||||
"ts.external.directory.path": "/snap/intellij-idea-ultimate/459/plugins/javascript-impl/jsLanguageServicesImpl/external",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"DatabaseDriversLRU": [
|
||||
"h2",
|
||||
"mariadb"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CreateClassDialog.RecentsKey">
|
||||
<recent name="core.taskgroups" />
|
||||
</key>
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/main/resources" />
|
||||
<recent name="$PROJECT_DIR$/src/test/resources/core/taskgroups" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/test/resources" />
|
||||
<recent name="$PROJECT_DIR$/src/test/java/core/taskgroups" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Spring Boot.DemoApplication">
|
||||
<configuration name="ScheduleServiceTest.editBasicSchedule" 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="editBasicSchedule" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="ScheduleServiceTest.editscheduleAdvanced" 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="editscheduleAdvanced" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="ScheduleServiceTest.scheduleAdvanced" 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="scheduleAdvanced" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="ScheduleServiceTest.scheduleNow" 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="scheduleNow" />
|
||||
<option name="TEST_OBJECT" value="method" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="TaskServiceTest" 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="TEST_OBJECT" value="class" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="DemoApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="demo" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="core.DemoApplication" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="JUnit.ScheduleServiceTest.scheduleNow" />
|
||||
<item itemvalue="JUnit.ScheduleServiceTest.editBasicSchedule" />
|
||||
<item itemvalue="JUnit.ScheduleServiceTest.editscheduleAdvanced" />
|
||||
<item itemvalue="JUnit.ScheduleServiceTest.scheduleAdvanced" />
|
||||
<item itemvalue="JUnit.TaskServiceTest" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="" />
|
||||
<created>1695647243767</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1695647243767</updated>
|
||||
<workItem from="1695647249321" duration="397000" />
|
||||
<workItem from="1696183811713" duration="4994000" />
|
||||
<workItem from="1696399523081" duration="666000" />
|
||||
<workItem from="1696517800445" duration="3887000" />
|
||||
<workItem from="1696573678147" duration="111000" />
|
||||
<workItem from="1697923629354" duration="3164000" />
|
||||
<workItem from="1697958018921" duration="91000" />
|
||||
<workItem from="1697958118995" duration="5749000" />
|
||||
<workItem from="1697969480767" duration="6407000" />
|
||||
<workItem from="1697989716016" duration="3814000" />
|
||||
<workItem from="1698067098771" duration="4770000" />
|
||||
<workItem from="1698127431684" duration="2039000" />
|
||||
<workItem from="1698164397550" duration="2329000" />
|
||||
<workItem from="1698246651541" duration="5106000" />
|
||||
<workItem from="1698298897364" duration="4242000" />
|
||||
<workItem from="1698426430946" duration="665000" />
|
||||
<workItem from="1698474363766" duration="3686000" />
|
||||
<workItem from="1698499063683" duration="8312000" />
|
||||
<workItem from="1698557538577" duration="18000" />
|
||||
<workItem from="1698557567325" duration="1724000" />
|
||||
<workItem from="1699205483652" duration="3298000" />
|
||||
<workItem from="1699380499473" duration="2708000" />
|
||||
<workItem from="1699460935890" duration="5000" />
|
||||
<workItem from="1699466564154" duration="6646000" />
|
||||
<workItem from="1699473376129" duration="1423000" />
|
||||
<workItem from="1699639316405" duration="9267000" />
|
||||
<workItem from="1699684493731" duration="1121000" />
|
||||
<workItem from="1699769541677" duration="7576000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
|
||||
<option name="closed" value="true" />
|
||||
<created>1696188127465</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1696188127467</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00002" summary="Datastructure for Tasks">
|
||||
<option name="closed" value="true" />
|
||||
<created>1696233406235</created>
|
||||
<option name="number" value="00002" />
|
||||
<option name="presentableId" value="LOCAL-00002" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1696233406235</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00003" summary="Implementing edit route for tasks">
|
||||
<option name="closed" value="true" />
|
||||
<created>1697929392755</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697929392755</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00004" summary="Delete and clear Tasks">
|
||||
<option name="closed" value="true" />
|
||||
<created>1697962016013</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697962016013</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00005" summary="Delete and clear Tasks (Frontend)">
|
||||
<option name="closed" value="true" />
|
||||
<created>1697962125518</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697962125518</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00006" summary="Define Entity BasicTaskSchedule and Taskcontroller">
|
||||
<option name="closed" value="true" />
|
||||
<created>1697976314517</created>
|
||||
<option name="number" value="00006" />
|
||||
<option name="presentableId" value="LOCAL-00006" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697976314517</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00007" summary="Delete Schedules">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698089745245</created>
|
||||
<option name="number" value="00007" />
|
||||
<option name="presentableId" value="LOCAL-00007" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698089745245</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00008" summary="Removed unused TaskgroupShortInfo.java">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698168406655</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698168406655</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00009" summary="Fix Foreign Key Constraint Fail when deleting Taskgroups">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698247531000</created>
|
||||
<option name="number" value="00009" />
|
||||
<option name="presentableId" value="LOCAL-00009" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698247531000</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00010" summary="Stop and Finish TaskSchedules">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698306038382</created>
|
||||
<option name="number" value="00010" />
|
||||
<option name="presentableId" value="LOCAL-00010" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698306038383</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00011" summary="Include TaskScheduleStopResponse">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698306056254</created>
|
||||
<option name="number" value="00011" />
|
||||
<option name="presentableId" value="LOCAL-00011" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698306056254</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00012" summary="Fix starting schedule and returning active time of schedule after stop">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698306442833</created>
|
||||
<option name="number" value="00012" />
|
||||
<option name="presentableId" value="LOCAL-00012" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698306442833</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00013" summary="Remove update spamming in console">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698306889808</created>
|
||||
<option name="number" value="00013" />
|
||||
<option name="presentableId" value="LOCAL-00013" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698306889808</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00014" summary="Start task now from Taskoverview in Dashboard">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698500028161</created>
|
||||
<option name="number" value="00014" />
|
||||
<option name="presentableId" value="LOCAL-00014" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698500028161</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00015" summary="Load worked minutes when reloading dashboard">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698512058945</created>
|
||||
<option name="number" value="00015" />
|
||||
<option name="presentableId" value="LOCAL-00015" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698512058945</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00016" summary="Load worked minutes when reloading dashboard">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698512069065</created>
|
||||
<option name="number" value="00016" />
|
||||
<option name="presentableId" value="LOCAL-00016" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698512069065</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00017" summary="Work also with start schedule based on last minute">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698569793571</created>
|
||||
<option name="number" value="00017" />
|
||||
<option name="presentableId" value="LOCAL-00017" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698569793571</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00018" summary="List missed Schedules">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698570969924</created>
|
||||
<option name="number" value="00018" />
|
||||
<option name="presentableId" value="LOCAL-00018" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698570969924</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00019" summary="Forget single schedule">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698573369764</created>
|
||||
<option name="number" value="00019" />
|
||||
<option name="presentableId" value="LOCAL-00019" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698573369764</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00020" summary="Fix marking finished task as overdue">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698592265846</created>
|
||||
<option name="number" value="00020" />
|
||||
<option name="presentableId" value="LOCAL-00020" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698592265846</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00021" summary="Write simple Testcase for ci/cd">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699207483922</created>
|
||||
<option name="number" value="00021" />
|
||||
<option name="presentableId" value="LOCAL-00021" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699207483922</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00022" summary="Deactivate Overall System test (temporarly)">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699207725882</created>
|
||||
<option name="number" value="00022" />
|
||||
<option name="presentableId" value="LOCAL-00022" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699207725883</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00023" summary="Fix failing test case">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699380549911</created>
|
||||
<option name="number" value="00023" />
|
||||
<option name="presentableId" value="LOCAL-00023" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699380549911</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00024" summary="TaskgroupRepsitoryTest">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699470020407</created>
|
||||
<option name="number" value="00024" />
|
||||
<option name="presentableId" value="LOCAL-00024" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699470020407</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00025" summary="TaskgroupRepsitoryTest (+Delete)">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699471078386</created>
|
||||
<option name="number" value="00025" />
|
||||
<option name="presentableId" value="LOCAL-00025" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699471078386</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00026" summary="FindAlltasksByUser Test">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699474949938</created>
|
||||
<option name="number" value="00026" />
|
||||
<option name="presentableId" value="LOCAL-00026" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699474949938</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00027" summary="Test TaskRepository">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699641346158</created>
|
||||
<option name="number" value="00027" />
|
||||
<option name="presentableId" value="LOCAL-00027" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699641346158</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00028" summary="Initialize Testing of Testservice">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699645467388</created>
|
||||
<option name="number" value="00028" />
|
||||
<option name="presentableId" value="LOCAL-00028" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699645467388</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00029" summary="Use @Sql instead of persit()">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699646291964</created>
|
||||
<option name="number" value="00029" />
|
||||
<option name="presentableId" value="LOCAL-00029" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699646291964</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00030" summary="Resolve Merge-Conflict">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699693472182</created>
|
||||
<option name="number" value="00030" />
|
||||
<option name="presentableId" value="LOCAL-00030" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699693472182</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00031" summary="Deleting Task test">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699694400508</created>
|
||||
<option name="number" value="00031" />
|
||||
<option name="presentableId" value="LOCAL-00031" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699694400508</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00032" summary="Consider increased number of tasks">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699694552466</created>
|
||||
<option name="number" value="00032" />
|
||||
<option name="presentableId" value="LOCAL-00032" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699694552466</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00033" summary="Remove entityManager from TaskService">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699695051881</created>
|
||||
<option name="number" value="00033" />
|
||||
<option name="presentableId" value="LOCAL-00033" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699695051881</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00034" summary="Get Working Status of Today Endpoint">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699726166056</created>
|
||||
<option name="number" value="00034" />
|
||||
<option name="presentableId" value="LOCAL-00034" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699726166056</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00035" summary="Include Working Status in Frontend Dashboard">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699726328681</created>
|
||||
<option name="number" value="00035" />
|
||||
<option name="presentableId" value="LOCAL-00035" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699726328681</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00036" summary="Create Datastructures for AdvancedSchedules and create schedules for them">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699730041496</created>
|
||||
<option name="number" value="00036" />
|
||||
<option name="presentableId" value="LOCAL-00036" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699730041496</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00037" summary="Reschedule Advanced Schedules">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699730644743</created>
|
||||
<option name="number" value="00037" />
|
||||
<option name="presentableId" value="LOCAL-00037" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699730644743</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00038" summary="ScheduleNow test with running advanced Schedule">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699730764558</created>
|
||||
<option name="number" value="00038" />
|
||||
<option name="presentableId" value="LOCAL-00038" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699730764558</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00039" summary="Update values of datetime picker automatically for editing">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699783953060</created>
|
||||
<option name="number" value="00039" />
|
||||
<option name="presentableId" value="LOCAL-00039" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699783953060</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00040" summary="Adapt datetime-picker">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699783968670</created>
|
||||
<option name="number" value="00040" />
|
||||
<option name="presentableId" value="LOCAL-00040" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699783968670</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00041" summary="Fix wrong date">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699786723938</created>
|
||||
<option name="number" value="00041" />
|
||||
<option name="presentableId" value="LOCAL-00041" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699786723938</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00042" summary="Deploy on docker (not productive yet!)">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699803821051</created>
|
||||
<option name="number" value="00042" />
|
||||
<option name="presentableId" value="LOCAL-00042" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699803821051</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00043" summary="Fix deleting tasks">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699805283751</created>
|
||||
<option name="number" value="00043" />
|
||||
<option name="presentableId" value="LOCAL-00043" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699805283751</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00044" summary="Fix parsing datetime">
|
||||
<option name="closed" value="true" />
|
||||
<created>1699806194258</created>
|
||||
<option name="number" value="00044" />
|
||||
<option name="presentableId" value="LOCAL-00044" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699806194258</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="45" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Write simple Testcase for ci/cd" />
|
||||
<MESSAGE value="Deactivate Overall System test (temporarly)" />
|
||||
<MESSAGE value="Fix failing test case" />
|
||||
<MESSAGE value="TaskgroupRepsitoryTest" />
|
||||
<MESSAGE value="TaskgroupRepsitoryTest (+Delete)" />
|
||||
<MESSAGE value="FindAlltasksByUser Test" />
|
||||
<MESSAGE value="Test TaskRepository" />
|
||||
<MESSAGE value="Initialize Testing of Testservice" />
|
||||
<MESSAGE value="Use @Sql instead of persit()" />
|
||||
<MESSAGE value="Make the Test Transactional" />
|
||||
<MESSAGE value="Resolve Merge-Conflict" />
|
||||
<MESSAGE value="Deleting Task test" />
|
||||
<MESSAGE value="Consider increased number of tasks" />
|
||||
<MESSAGE value="Remove entityManager from TaskService" />
|
||||
<MESSAGE value="Get Working Status of Today Endpoint" />
|
||||
<MESSAGE value="Include Working Status in Frontend Dashboard" />
|
||||
<MESSAGE value="Create Datastructures for AdvancedSchedules and create schedules for them" />
|
||||
<MESSAGE value="Reschedule Advanced Schedules" />
|
||||
<MESSAGE value="ScheduleNow test with running advanced Schedule" />
|
||||
<MESSAGE value="Update values of datetime picker automatically for editing" />
|
||||
<MESSAGE value="Adapt datetime-picker" />
|
||||
<MESSAGE value="Fix wrong date" />
|
||||
<MESSAGE value="Deploy on docker (not productive yet!)" />
|
||||
<MESSAGE value="Fix deleting tasks" />
|
||||
<MESSAGE value="Fix parsing datetime" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Fix parsing datetime" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/core/entities/User.java</url>
|
||||
<line>57</line>
|
||||
<option name="timeStamp" value="12" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java</url>
|
||||
<line>68</line>
|
||||
<option name="timeStamp" value="14" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java</url>
|
||||
<line>93</line>
|
||||
<option name="timeStamp" value="16" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/core/services/TaskService.java</url>
|
||||
<line>93</line>
|
||||
<option name="timeStamp" value="35" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
@ -1,9 +1,15 @@
|
||||
FROM maven:3.8.1-openjdk-17-slim AS build
|
||||
COPY src /home/app/src
|
||||
COPY pom.xml /home/app
|
||||
RUN mvn -f /home/app/pom.xml clean test package
|
||||
|
||||
|
||||
FROM openjdk:17-jdk-alpine
|
||||
RUN addgroup -S spring && adduser -S spring -G spring
|
||||
USER spring:spring
|
||||
|
||||
ARG JAR_FILE=target/*.jar
|
||||
COPY ${JAR_FILE} app.jar
|
||||
|
||||
#ARG JAR_FILE=target/*.jar
|
||||
#COPY ${JAR_FILE} app.jar
|
||||
COPY --from=build /home/app/target/*.jar app.jar
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["java","-jar","/app.jar"]
|
@ -21,6 +21,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
|
@ -2,15 +2,25 @@ package core;
|
||||
|
||||
import core.entities.RoleEntity;
|
||||
import core.entities.UserRole;
|
||||
import core.entities.timemanager.AdvancedTaskSchedule;
|
||||
import core.repositories.RoleRepository;
|
||||
import core.repositories.UserRepository;
|
||||
import core.services.PropertyService;
|
||||
import core.services.TaskScheduleService;
|
||||
import core.services.ntfy.TaskSchedulingService;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class DemoApplication{
|
||||
|
||||
public static void main(String[] args) {
|
||||
@ -18,19 +28,12 @@ public class DemoApplication{
|
||||
}
|
||||
|
||||
|
||||
/*@Bean
|
||||
public CommandLineRunner init(RoleRepository roleRepository, UserRepository userRepository, PropertyService propertyService) {
|
||||
@Bean
|
||||
public CommandLineRunner init(TaskSchedulingService taskSchedulingService) {
|
||||
return args -> {
|
||||
for (UserRole userRole : UserRole.values()) {
|
||||
if(!roleRepository.existsByName(userRole)) {
|
||||
roleRepository.save(new RoleEntity(userRole));
|
||||
}
|
||||
}
|
||||
|
||||
propertyService.init();
|
||||
|
||||
FirstUserObserver observer = new FirstUserObserver(userRepository);
|
||||
observer.start();
|
||||
taskSchedulingService.scheduleStartReminders();
|
||||
};
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package core.api.controller;
|
||||
|
||||
import core.api.models.auth.SimpleStatusResponse;
|
||||
import core.api.models.users.NtfyInformation;
|
||||
import core.entities.User;
|
||||
import core.repositories.UserRepository;
|
||||
import core.services.UserService;
|
||||
import core.services.ntfy.TaskSchedulingService;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Optional;
|
||||
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class NtfyController {
|
||||
|
||||
@Autowired private UserRepository userRepository;
|
||||
@Autowired private UserService userService;
|
||||
@Autowired private TaskSchedulingService taskSchedulingService;
|
||||
@GetMapping("/ntfy")
|
||||
public ResponseEntity<?> getNtfyInformation() {
|
||||
String username = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
|
||||
Optional<User> userOptional = userRepository.findByUsername(username);
|
||||
if(userOptional.isPresent()) {
|
||||
return ResponseEntity.ok(new NtfyInformation(userOptional.get()));
|
||||
} else {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/ntfy")
|
||||
public ResponseEntity<?> editNtfyInformation(@Valid @RequestBody NtfyInformation ntfyInformation) {
|
||||
String username = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
Optional<User> user = userRepository.findByUsername(username);
|
||||
if(user.isPresent()) {
|
||||
userService.editNtfyInformation(user.get(), ntfyInformation);
|
||||
try {
|
||||
taskSchedulingService.scheduleStartReminders();
|
||||
} catch (SchedulerException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||
} else {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
}
|
||||
}
|
@ -3,15 +3,14 @@ package core.api.controller;
|
||||
|
||||
import core.api.models.auth.SimpleStatusResponse;
|
||||
import core.api.models.timemanager.taskSchedule.*;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleFieldInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.BasicScheduleFieldInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.ScheduleFieldInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.*;
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.entities.timemanager.AdvancedTaskSchedule;
|
||||
import core.entities.timemanager.BasicTaskSchedule;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.services.*;
|
||||
import core.services.ntfy.TaskSchedulingService;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
@ -30,6 +29,7 @@ public class ScheduleController {
|
||||
|
||||
@Autowired private TaskScheduleService taskScheduleService;
|
||||
@Autowired private TaskService taskService;
|
||||
@Autowired private TaskSchedulingService taskSchedulingService;
|
||||
@GetMapping("/schedules")
|
||||
public ResponseEntity<?> loadAllSchedulesOfUser() {
|
||||
String username = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
@ -41,7 +41,7 @@ public class ScheduleController {
|
||||
@GetMapping("/schedules/{taskID}")
|
||||
public ResponseEntity<?> loadAllSchedulesOfTask(@PathVariable long taskID) {
|
||||
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -50,7 +50,14 @@ public class ScheduleController {
|
||||
}
|
||||
|
||||
List<AbstractSchedule> taskSchedules = permissionResult.getResult().getBasicTaskSchedules();
|
||||
return ResponseEntity.ok(taskSchedules.stream().map(AbstractSchedule::toScheduleInfo).toList());
|
||||
List<ScheduleInfo> scheduleInfos = new ArrayList<>();
|
||||
for(AbstractSchedule schedule : taskSchedules) {
|
||||
//Filter completed schedules out
|
||||
if(!schedule.isCompleted()) {
|
||||
scheduleInfos.add(schedule.toScheduleInfo());
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok(scheduleInfos);
|
||||
}
|
||||
|
||||
@PutMapping("/schedules/{taskID}/basic")
|
||||
@ -65,7 +72,7 @@ public class ScheduleController {
|
||||
|
||||
private ResponseEntity<?> createAbstractSchedule(long taskID, ScheduleFieldInfo scheduleFieldInfo) {
|
||||
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -75,10 +82,18 @@ public class ScheduleController {
|
||||
|
||||
if(scheduleFieldInfo instanceof BasicScheduleFieldInfo) {
|
||||
ServiceResult<AbstractSchedule> scheduleResult = taskScheduleService.scheduleBasic(permissionResult.getResult(), (BasicScheduleFieldInfo) scheduleFieldInfo);
|
||||
if(scheduleResult.getExitCode() == ServiceExitCode.INVALID_OPERATION) {
|
||||
return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
return ResponseEntity.ok(scheduleResult.getResult().toScheduleInfo());
|
||||
} else if(scheduleFieldInfo instanceof AdvancedScheduleFieldInfo) {
|
||||
ServiceResult<AbstractSchedule> scheduleResult = taskScheduleService.scheduleAdvanced(permissionResult.getResult(), (AdvancedScheduleFieldInfo) scheduleFieldInfo);
|
||||
return ResponseEntity.ok(scheduleResult.getResult().toScheduleInfo());
|
||||
if(scheduleResult.getResult() != null) {
|
||||
return ResponseEntity.ok(scheduleResult.getResult().toScheduleInfo());
|
||||
} else {
|
||||
return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
} else {
|
||||
return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
@ -96,7 +111,7 @@ public class ScheduleController {
|
||||
|
||||
private ResponseEntity<?> editAbstractSchedule(long scheduleID, ScheduleFieldInfo scheduleFieldInfo) {
|
||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -126,7 +141,7 @@ public class ScheduleController {
|
||||
@DeleteMapping("/schedules/{scheduleID}")
|
||||
public ResponseEntity<?> deleteSchedule(@PathVariable long scheduleID) {
|
||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -148,7 +163,7 @@ public class ScheduleController {
|
||||
@PostMapping("/schedules/{taskID}/now")
|
||||
public ResponseEntity<?> scheduleNow(@PathVariable long taskID) {
|
||||
PermissionResult<Task> permissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -160,6 +175,7 @@ public class ScheduleController {
|
||||
if(scheduleResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
|
||||
return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
|
||||
} else {
|
||||
taskSchedulingService.sendRunningTaskNotification(scheduleResult.getResult());
|
||||
return ResponseEntity.ok(scheduleResult.getResult().toScheduleInfo());
|
||||
}
|
||||
}
|
||||
@ -177,7 +193,7 @@ public class ScheduleController {
|
||||
@PostMapping("/schedules/{scheduleID}/activate")
|
||||
public ResponseEntity<?> activateSchedule(@PathVariable long scheduleID) {
|
||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -186,13 +202,22 @@ public class ScheduleController {
|
||||
}
|
||||
|
||||
ServiceResult<AbstractSchedule> serviceResult = taskScheduleService.activateSchedule(permissionResult.getResult());
|
||||
if(serviceResult.getResult() instanceof AdvancedTaskSchedule) {
|
||||
try {
|
||||
taskSchedulingService.stopStartReminderNotification((AdvancedTaskSchedule) serviceResult.getResult());
|
||||
|
||||
} catch (SchedulerException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
taskSchedulingService.sendRunningTaskNotification(serviceResult.getResult());
|
||||
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()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -207,7 +232,7 @@ public class ScheduleController {
|
||||
@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()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -234,7 +259,7 @@ public class ScheduleController {
|
||||
List<PermissionResult<AbstractSchedule>> permissionResults = new ArrayList<>();
|
||||
for(long scheduleID: scheduleIDs) {
|
||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -253,7 +278,7 @@ public class ScheduleController {
|
||||
@GetMapping("/schedules/{scheduleID}/details")
|
||||
public ResponseEntity<?> loadScheduleDetails(@PathVariable long scheduleID) {
|
||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!permissionResult.isHasPermissions()) {
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -263,4 +288,20 @@ public class ScheduleController {
|
||||
|
||||
return ResponseEntity.ok(permissionResult.getResult().toScheduleInfo());
|
||||
}
|
||||
|
||||
@PostMapping("/schedules/{scheduleID}/stopManual")
|
||||
public ResponseEntity<?> stopManual(@PathVariable long scheduleID, @Valid @RequestBody ManualScheduleStopInfo manualScheduleStopInfo) {
|
||||
PermissionResult<AbstractSchedule> permissionResult = taskScheduleService.getSchedulePermissions(scheduleID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(permissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
if(permissionResult.getExitCode() == ServiceExitCode.MISSING_ENTITY) {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
taskScheduleService.finishScheduleManual(permissionResult.getResult(), manualScheduleStopInfo);
|
||||
|
||||
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,19 @@
|
||||
package core.api.controller;
|
||||
|
||||
import core.api.models.auth.SimpleStatusResponse;
|
||||
import core.api.models.timemanager.history.TaskgroupActivityInfo;
|
||||
import core.api.models.timemanager.history.WorkingStatus;
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.services.TaskScheduleService;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.services.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@RestController
|
||||
@ -23,6 +21,8 @@ import java.util.List;
|
||||
public class StatisticController {
|
||||
|
||||
@Autowired private TaskScheduleService taskScheduleService;
|
||||
@Autowired private StatisticService statisticService;
|
||||
@Autowired private TaskgroupService taskgroupService;
|
||||
|
||||
@GetMapping("/history/workingStatus")
|
||||
public ResponseEntity<?> getWorkingStatus() {
|
||||
@ -39,4 +39,36 @@ public class StatisticController {
|
||||
|
||||
return ResponseEntity.ok(new WorkingStatus(missedSchedules, activeTime));
|
||||
}
|
||||
|
||||
@GetMapping("/statistics/{startingDate}/{endingDate}")
|
||||
public ResponseEntity<?> getTaskgroupActivity(@PathVariable String startingDate, @PathVariable String endingDate){
|
||||
LocalDate starting = LocalDate.parse(startingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
LocalDate ending = LocalDate.parse(endingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
|
||||
var taskgroupActivityInfos = statisticService.calcActivityByUser(null, SecurityContextHolder.getContext().getAuthentication().getName(), starting, ending);
|
||||
List<TaskgroupActivityInfo> outgoingResult = StatisticService.convertInternActivityInfo(taskgroupActivityInfos);
|
||||
return ResponseEntity.ok(outgoingResult);
|
||||
}
|
||||
|
||||
@GetMapping("/statistics/{taskgroupID}/{startingDate}/{endingDate}")
|
||||
public ResponseEntity<?> getTaskgroupActivity(@PathVariable long taskgroupID, @PathVariable String startingDate, @PathVariable String endingDate){
|
||||
LocalDate starting = LocalDate.parse(startingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
LocalDate ending = LocalDate.parse(endingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
String username = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
var permissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, username);
|
||||
if(permissionResult.hasIssue()) {
|
||||
return permissionResult.mapToResponseEntity();
|
||||
}
|
||||
|
||||
var taskgroupActivityInfos = statisticService.calcActivityByUser(permissionResult.getResult(), username, starting, ending);
|
||||
List<TaskgroupActivityInfo> outgoingResult = StatisticService.convertInternActivityInfo(taskgroupActivityInfos);
|
||||
return ResponseEntity.ok(outgoingResult);
|
||||
}
|
||||
|
||||
@GetMapping("/history/schedules/{date}")
|
||||
public ResponseEntity<?> getPastSchedules(@PathVariable String date) {
|
||||
LocalDate dateArg = LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
List<AbstractSchedule> abstractSchedules = taskScheduleService.findSchedulesByDate(SecurityContextHolder.getContext().getAuthentication().getName(), dateArg);
|
||||
return ResponseEntity.ok(abstractSchedules.stream().map(AbstractSchedule::toScheduleInfo).toList());
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,9 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@ -63,7 +65,7 @@ public class TaskController {
|
||||
@GetMapping("/tasks/{taskgroupID}/{status}")
|
||||
public ResponseEntity<?> listTasksOfTaskgroup(@PathVariable long taskgroupID, @PathVariable String status) {
|
||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
||||
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -71,13 +73,17 @@ public class TaskController {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(taskgroupPermissionResult.getResult().getTasks().stream().map(TaskEntityInfo::new));
|
||||
List<Task> tasks = new ArrayList<>();
|
||||
for(Task task : taskgroupPermissionResult.getResult().getTasks()) {
|
||||
if(task.getParent() == null) tasks.add(task);
|
||||
}
|
||||
return ResponseEntity.ok(tasks.stream().map(TaskEntityInfo::new));
|
||||
}
|
||||
|
||||
@PutMapping("/tasks/{taskgroupID}")
|
||||
public ResponseEntity<?> createTask(@PathVariable long taskgroupID, @RequestBody @Valid TaskFieldInfo taskFieldInfo) {
|
||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
||||
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -85,6 +91,10 @@ public class TaskController {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
if(taskFieldInfo.getStartDate() == null) {
|
||||
taskFieldInfo.setStartDate(LocalDate.now());
|
||||
}
|
||||
|
||||
ServiceResult<Task> creationResult = taskService.createTask(taskgroupPermissionResult.getResult(), taskFieldInfo);
|
||||
if(creationResult.getExitCode() == ServiceExitCode.ENTITY_ALREADY_EXIST) {
|
||||
return ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
|
||||
@ -96,7 +106,7 @@ public class TaskController {
|
||||
@PostMapping("/tasks/{taskID}")
|
||||
public ResponseEntity<?> editTask(@PathVariable long taskID, @RequestBody @Valid TaskFieldInfo taskFieldInfo) {
|
||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if (!taskPermissionResult.isHasPermissions()) {
|
||||
if (taskPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -104,7 +114,7 @@ public class TaskController {
|
||||
return ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
if(taskFieldInfo.getStartDate().isAfter(taskFieldInfo.getDeadline())) {
|
||||
if(taskFieldInfo.getStartDate() != null && taskFieldInfo.getDeadline() != null && taskFieldInfo.getStartDate().isAfter(taskFieldInfo.getDeadline())) {
|
||||
return ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -119,7 +129,7 @@ public class TaskController {
|
||||
@DeleteMapping("/tasks/{taskID}")
|
||||
public ResponseEntity<?> deleteTask(@PathVariable long taskID) {
|
||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if (!taskPermissionResult.isHasPermissions()) {
|
||||
if (taskPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -134,7 +144,7 @@ public class TaskController {
|
||||
@GetMapping("/tasks/{taskID}")
|
||||
public ResponseEntity<?> loadTaskDetails(@PathVariable long taskID) {
|
||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if (!taskPermissionResult.isHasPermissions()) {
|
||||
if (taskPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -148,7 +158,7 @@ public class TaskController {
|
||||
@PostMapping("/tasks/{taskID}/finish")
|
||||
public ResponseEntity<?> finishTask(@PathVariable long taskID) {
|
||||
PermissionResult<Task> taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if (!taskPermissionResult.isHasPermissions()) {
|
||||
if (taskPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -159,4 +169,42 @@ public class TaskController {
|
||||
taskService.finishTask(taskPermissionResult.getResult());
|
||||
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||
}
|
||||
|
||||
@PutMapping("/tasks/{taskID}/subtasks")
|
||||
public ResponseEntity<?> onCreateSubTask(@PathVariable long taskID, @Valid @RequestBody TaskFieldInfo taskFieldInfo) {
|
||||
var taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(taskPermissionResult.hasIssue()) {
|
||||
return taskPermissionResult.mapToResponseEntity();
|
||||
}
|
||||
|
||||
var serviceResult = taskService.createSubTask(taskPermissionResult.getResult(), taskFieldInfo);
|
||||
if(serviceResult.hasIssue()) {
|
||||
return serviceResult.mapToResponseEntity();
|
||||
} else {
|
||||
return ResponseEntity.ok(new TaskEntityInfo(serviceResult.getResult()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/tasks/{taskID}/subtasks")
|
||||
public ResponseEntity<?> onListSubtasks(@PathVariable long taskID) {
|
||||
var taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(taskPermissionResult.hasIssue()) {
|
||||
return taskPermissionResult.mapToResponseEntity();
|
||||
}
|
||||
|
||||
Collection<Task> subtasks = taskPermissionResult.getResult().getSubtasks();
|
||||
return ResponseEntity.ok(subtasks.stream().map(TaskEntityInfo::new).toList());
|
||||
}
|
||||
|
||||
@DeleteMapping("/tasks/{taskID}/subtasks")
|
||||
public ResponseEntity<?> onClearSubtasks(@PathVariable long taskID) {
|
||||
var taskPermissionResult = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(taskPermissionResult.hasIssue()) {
|
||||
return taskPermissionResult.mapToResponseEntity();
|
||||
}
|
||||
|
||||
ServiceExitCode result = taskService.clearSubTasks(taskPermissionResult.getResult());
|
||||
return result.mapToResponseEntity();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package core.api.controller;
|
||||
|
||||
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatDayInfo;
|
||||
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatWeekInfo;
|
||||
import core.services.ServiceExitCode;
|
||||
import core.services.ServiceResult;
|
||||
import core.services.TaskSeriesService;
|
||||
import core.services.TaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class TaskSeriesController {
|
||||
|
||||
@Autowired private TaskService taskService;
|
||||
@Autowired private TaskSeriesService taskSeriesService;
|
||||
|
||||
@PostMapping("/tasks/taskseries/weekly")
|
||||
public ResponseEntity<?> onCreateTaskSeries(@Valid @RequestBody TaskRepeatWeekInfo taskRepeatWeekInfo) {
|
||||
ServiceExitCode serviceExitCode = taskSeriesService.createTaskSeries(taskRepeatWeekInfo);
|
||||
return serviceExitCode.mapToResponseEntity();
|
||||
}
|
||||
|
||||
@PostMapping("/tasks/{taskID}/taskseries/daily")
|
||||
public ResponseEntity<?> onCreateTaskSeries(@PathVariable long taskID, @Valid @RequestBody TaskRepeatDayInfo taskRepeatDayInfo) {
|
||||
var taskPermission = taskService.getTaskPermissions(taskID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(taskPermission.hasIssue()) {
|
||||
return taskPermission.mapToResponseEntity();
|
||||
} else {
|
||||
ServiceExitCode serviceExitCode = taskSeriesService.createTaskSeries(taskPermission.getResult(), taskRepeatDayInfo);
|
||||
return serviceExitCode.mapToResponseEntity();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
package core.api.controller;
|
||||
|
||||
import core.api.models.auth.SimpleStatusResponse;
|
||||
import core.api.models.timemanager.taskgroup.RecursiveTaskgroupInfo;
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupDetailInfo;
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupFieldInfo;
|
||||
import core.api.models.timemanager.taskgroup.*;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.services.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -14,7 +11,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@RestController
|
||||
@ -43,7 +39,7 @@ public class TaskgroupController {
|
||||
@PostMapping("/taskgroups/{taskgroupID}")
|
||||
public ResponseEntity<?> editTaskgroup(@PathVariable long taskgroupID, @Valid @RequestBody TaskgroupFieldInfo taskgroupFieldInfo) {
|
||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
||||
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -62,7 +58,7 @@ public class TaskgroupController {
|
||||
@DeleteMapping("/taskgroups/{taskgroupID}")
|
||||
public ResponseEntity<?> deleteTaskgroup(@PathVariable long taskgroupID) {
|
||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if (!taskgroupPermissionResult.isHasPermissions()) {
|
||||
if (taskgroupPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -91,7 +87,7 @@ public class TaskgroupController {
|
||||
@GetMapping("/taskgroups/{taskgroupID}")
|
||||
public ResponseEntity<?> getDetails(@PathVariable long taskgroupID) {
|
||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if(!taskgroupPermissionResult.isHasPermissions()) {
|
||||
if(taskgroupPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -105,7 +101,7 @@ public class TaskgroupController {
|
||||
@DeleteMapping("/taskgroups/{taskgroupID}/clear")
|
||||
public ResponseEntity<?> clearTasks(@PathVariable long taskgroupID) {
|
||||
PermissionResult<Taskgroup> taskgroupPermissionResult = taskgroupService.getTaskgroupByIDAndUsername(taskgroupID, SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
if (!taskgroupPermissionResult.isHasPermissions()) {
|
||||
if (taskgroupPermissionResult.isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
}
|
||||
|
||||
@ -116,4 +112,10 @@ public class TaskgroupController {
|
||||
taskService.clearTasks(taskgroupPermissionResult.getResult());
|
||||
return ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||
}
|
||||
|
||||
@GetMapping("/taskgroups/path")
|
||||
public ResponseEntity<?> getTaskgroupPaths() {
|
||||
List<Taskgroup> taskgroups = taskgroupService.getTaskgroupsByUser(SecurityContextHolder.getContext().getAuthentication().getName());
|
||||
return ResponseEntity.ok(taskgroups.stream().map(TaskgroupPathInfo::new));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package core.api.models.timemanager.history;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class ActivityInfo {
|
||||
|
||||
private LocalDate scheduleDate;
|
||||
private int activeMinutes;
|
||||
|
||||
public ActivityInfo(LocalDate scheduleDate, int workedMinutes) {
|
||||
this.scheduleDate = scheduleDate;
|
||||
this.activeMinutes = workedMinutes;
|
||||
}
|
||||
|
||||
public LocalDate getScheduleDate() {
|
||||
return scheduleDate;
|
||||
}
|
||||
|
||||
public void setScheduleDate(LocalDate scheduleDate) {
|
||||
this.scheduleDate = scheduleDate;
|
||||
}
|
||||
|
||||
public int getActiveMinutes() {
|
||||
return activeMinutes;
|
||||
}
|
||||
|
||||
public void setActiveMinutes(int activeMinutes) {
|
||||
this.activeMinutes = activeMinutes;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package core.api.models.timemanager.history;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.ScheduleInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PastScheduleInfo {
|
||||
|
||||
@JsonProperty
|
||||
private List<ScheduleInfo> mondaySchedules;
|
||||
|
||||
@JsonProperty
|
||||
private List<ScheduleInfo> tuesdaySchedules;
|
||||
|
||||
@JsonProperty
|
||||
private List<ScheduleInfo> wednesdaySchedules;
|
||||
|
||||
@JsonProperty
|
||||
private List<ScheduleInfo> thursdaySchedules;
|
||||
|
||||
@JsonProperty
|
||||
private List<ScheduleInfo> fridaySchedules;
|
||||
|
||||
@JsonProperty
|
||||
private List<ScheduleInfo> saturdaySchedules;
|
||||
|
||||
@JsonProperty
|
||||
private List<ScheduleInfo> sundaySchedules;
|
||||
|
||||
public PastScheduleInfo(List<ScheduleInfo> mondaySchedules, List<ScheduleInfo> tuesdaySchedules,
|
||||
List<ScheduleInfo> wednesdaySchedules, List<ScheduleInfo> thursdaySchedules,
|
||||
List<ScheduleInfo> fridaySchedules, List<ScheduleInfo> saturdaySchedules,
|
||||
List<ScheduleInfo> sundaySchedules) {
|
||||
this.mondaySchedules = mondaySchedules;
|
||||
this.tuesdaySchedules = tuesdaySchedules;
|
||||
this.wednesdaySchedules = wednesdaySchedules;
|
||||
this.thursdaySchedules = thursdaySchedules;
|
||||
this.fridaySchedules = fridaySchedules;
|
||||
this.saturdaySchedules = saturdaySchedules;
|
||||
this.sundaySchedules = sundaySchedules;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package core.api.models.timemanager.history;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class TaskgroupActivityInfo {
|
||||
|
||||
private TaskgroupEntityInfo taskgroup;
|
||||
private List<ActivityInfo> activityInfos;
|
||||
|
||||
public TaskgroupActivityInfo(TaskgroupEntityInfo taskgroup, List<ActivityInfo> activityInfos) {
|
||||
this.taskgroup = taskgroup;
|
||||
this.activityInfos = activityInfos;
|
||||
}
|
||||
|
||||
public TaskgroupEntityInfo getTaskgroup() {
|
||||
return taskgroup;
|
||||
}
|
||||
|
||||
public List<ActivityInfo> getActivityInfos() {
|
||||
return activityInfos;
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package core.api.models.timemanager.taskSchedule;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@ -7,9 +9,11 @@ import java.time.LocalDateTime;
|
||||
public class ForgottenScheduleInfo {
|
||||
|
||||
@NotNull
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@NotNull
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
public ForgottenScheduleInfo(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
|
@ -0,0 +1,15 @@
|
||||
package core.api.models.timemanager.taskSchedule;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class ManualScheduleStopInfo {
|
||||
@NotNull
|
||||
private long duration;
|
||||
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
}
|
@ -2,17 +2,17 @@ package core.api.models.timemanager.taskSchedule;
|
||||
|
||||
public class TaskScheduleStopResponse {
|
||||
|
||||
private int activeTime;
|
||||
private int workTime;
|
||||
|
||||
public TaskScheduleStopResponse(int activeTime) {
|
||||
this.activeTime = activeTime;
|
||||
this.workTime = activeTime;
|
||||
}
|
||||
|
||||
public int getActiveTime() {
|
||||
return activeTime;
|
||||
public int getWorkTime() {
|
||||
return workTime;
|
||||
}
|
||||
|
||||
public void setActiveTime(int activeTime) {
|
||||
this.activeTime = activeTime;
|
||||
public void setWorkTime(int workTime) {
|
||||
this.workTime = workTime;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.time.LocalDate;
|
||||
public class BasicScheduleFieldInfo extends ScheduleFieldInfo{
|
||||
|
||||
@NotNull
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
public BasicScheduleFieldInfo(LocalDate localDate) {
|
||||
|
@ -17,7 +17,7 @@ public abstract class ScheduleInfo {
|
||||
@JsonProperty
|
||||
private LocalDateTime startTime;
|
||||
@JsonProperty
|
||||
private LocalDateTime stopTime;
|
||||
private LocalDateTime finishedTime;
|
||||
@JsonProperty
|
||||
private int activeMinutes;
|
||||
@JsonProperty
|
||||
@ -29,7 +29,7 @@ public abstract class ScheduleInfo {
|
||||
this.scheduleID = scheduleID;
|
||||
this.scheduleType = scheduleType;
|
||||
this.startTime = startTime;
|
||||
this.stopTime = stopTime;
|
||||
this.finishedTime = stopTime;
|
||||
this.activeMinutes = activeMinutes;
|
||||
this.task = new TaskShortInfo(task);
|
||||
this.taskgroupPath = taskgroupPath;
|
||||
|
@ -31,10 +31,13 @@ public class RecursiveTaskgroupInfo {
|
||||
}
|
||||
|
||||
for(Task task : taskgroup.getActiveTasks()) {
|
||||
this.activeTasks.add(new TaskOverviewInfo(task));
|
||||
if(task.getDeadline() != null && task.getDeadline().isBefore(LocalDate.now())) {
|
||||
this.hasOverdueTask = true;
|
||||
if(task.getParent() == null) {
|
||||
this.activeTasks.add(new TaskOverviewInfo(task));
|
||||
if(task.getDeadline() != null && task.getDeadline().isBefore(LocalDate.now())) {
|
||||
this.hasOverdueTask = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.amountActiveTasks = taskgroup.getAmountOfActiveTasks();
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package core.api.models.timemanager.taskgroup;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TaskgroupPathInfo {
|
||||
|
||||
@JsonProperty
|
||||
private String taskgroupPath;
|
||||
|
||||
@JsonProperty
|
||||
private TaskgroupEntityInfo rootTasktroup;
|
||||
|
||||
@JsonProperty
|
||||
private List<TaskgroupEntityInfo> directChildren;
|
||||
public TaskgroupPathInfo(Taskgroup taskgroup) {
|
||||
List<Taskgroup> taskgroupPath = Taskgroup.getAncestorList(taskgroup);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for(Taskgroup taskgroupPathEntity : taskgroupPath) {
|
||||
stringBuilder.append(taskgroupPathEntity.getTaskgroupName());
|
||||
stringBuilder.append("/");
|
||||
}
|
||||
this.taskgroupPath = stringBuilder.substring(0, stringBuilder.length()-1);
|
||||
this.rootTasktroup = new TaskgroupEntityInfo(taskgroup);
|
||||
directChildren = taskgroup.getChildren().stream().map(TaskgroupEntityInfo::new).toList();
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package core.api.models.timemanager.tasks;
|
||||
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.services.TaskSeriesService;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@ -22,9 +23,22 @@ public class TaskEntityInfo {
|
||||
|
||||
private int workTime;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
private boolean hasActiveSchedules;
|
||||
|
||||
private boolean hasPlannedSchedules;
|
||||
private boolean hasTaskSerie;
|
||||
private boolean hasSubtasks;
|
||||
private boolean hasParent;
|
||||
|
||||
public TaskEntityInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
if(task.getTaskSerieItem() != null) {
|
||||
this.taskName = TaskSeriesService.insertNameIndex(task.getTaskSerieItem().getSeriesIndex(), task.getTaskName());
|
||||
} else {
|
||||
this.taskName = task.getTaskName();
|
||||
}
|
||||
this.eta = task.getEta();
|
||||
this.startDate = task.getStartDate();
|
||||
this.deadline = task.getDeadline();
|
||||
@ -33,6 +47,12 @@ public class TaskEntityInfo {
|
||||
}
|
||||
this.finished = task.isFinished();
|
||||
this.workTime = task.getWorkTime();
|
||||
this.finishable = task.isFinishable();
|
||||
this.hasActiveSchedules = task.hasActiveSchedule();
|
||||
this.hasPlannedSchedules = task.hasPlannedSchedules();
|
||||
this.hasTaskSerie = task.getTaskSerieItem() != null;
|
||||
this.hasSubtasks = task.getSubtasks() != null && !task.getSubtasks().isEmpty();
|
||||
this.hasParent = task.getParent() != null;
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -98,4 +118,52 @@ public class TaskEntityInfo {
|
||||
public void setWorkTime(int workTime) {
|
||||
this.workTime = workTime;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
|
||||
public boolean isHasActiveSchedules() {
|
||||
return hasActiveSchedules;
|
||||
}
|
||||
|
||||
public void setHasActiveSchedules(boolean hasActiveSchedules) {
|
||||
this.hasActiveSchedules = hasActiveSchedules;
|
||||
}
|
||||
|
||||
public boolean isHasPlannedSchedules() {
|
||||
return hasPlannedSchedules;
|
||||
}
|
||||
|
||||
public void setHasPlannedSchedules(boolean hasPlannedSchedules) {
|
||||
this.hasPlannedSchedules = hasPlannedSchedules;
|
||||
}
|
||||
|
||||
public boolean isHasTaskSerie() {
|
||||
return hasTaskSerie;
|
||||
}
|
||||
|
||||
public void setHasTaskSerie(boolean hasTaskSerie) {
|
||||
this.hasTaskSerie = hasTaskSerie;
|
||||
}
|
||||
|
||||
public boolean isHasSubtasks() {
|
||||
return hasSubtasks;
|
||||
}
|
||||
|
||||
public void setHasSubtasks(boolean hasSubtasks) {
|
||||
this.hasSubtasks = hasSubtasks;
|
||||
}
|
||||
|
||||
public boolean isHasParent() {
|
||||
return hasParent;
|
||||
}
|
||||
|
||||
public void setHasParent(boolean hasParent) {
|
||||
this.hasParent = hasParent;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package core.api.models.timemanager.tasks;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDate;
|
||||
@ -11,9 +13,15 @@ public class TaskFieldInfo {
|
||||
@Length(max = 255)
|
||||
private String taskName;
|
||||
private int eta;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDate startDate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDate deadline;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
public TaskFieldInfo() {
|
||||
}
|
||||
|
||||
@ -55,4 +63,12 @@ public class TaskFieldInfo {
|
||||
public void setDeadline(LocalDate deadline) {
|
||||
this.deadline = deadline;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package core.api.models.timemanager.tasks;
|
||||
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.services.TaskSeriesService;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class TaskOverviewInfo {
|
||||
|
||||
@ -13,15 +17,24 @@ public class TaskOverviewInfo {
|
||||
private LocalDate limit;
|
||||
private boolean overdue;
|
||||
|
||||
private boolean finishable;
|
||||
private boolean hasSubtasks;
|
||||
|
||||
public TaskOverviewInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
if(task.getTaskSerieItem() != null) {
|
||||
this.taskName = TaskSeriesService.insertNameIndex(task.getTaskSerieItem().getSeriesIndex(), task.getTaskName());
|
||||
} else {
|
||||
this.taskName = task.getTaskName();
|
||||
}
|
||||
this.activeMinutes = task.getWorkTime();
|
||||
this.eta = task.getEta();
|
||||
this.limit = task.getDeadline();
|
||||
if(task.getDeadline() != null) {
|
||||
this.overdue = LocalDate.now().isAfter(task.getDeadline());
|
||||
}
|
||||
this.finishable = task.isFinishable();
|
||||
this.hasSubtasks = !task.getSubtasks().isEmpty();
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -71,4 +84,20 @@ public class TaskOverviewInfo {
|
||||
public void setOverdue(boolean overdue) {
|
||||
this.overdue = overdue;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
|
||||
public boolean isHasSubtasks() {
|
||||
return hasSubtasks;
|
||||
}
|
||||
|
||||
public void setHasSubtasks(boolean hasSubtasks) {
|
||||
this.hasSubtasks = hasSubtasks;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,24 @@
|
||||
package core.api.models.timemanager.tasks;
|
||||
|
||||
import core.entities.timemanager.Task;
|
||||
import core.services.TaskSeriesService;
|
||||
|
||||
public class TaskShortInfo {
|
||||
|
||||
private long taskID;
|
||||
private String taskName;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
public TaskShortInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
if(task.getTaskSerieItem() != null) {
|
||||
this.taskName = TaskSeriesService.insertNameIndex(task.getTaskSerieItem().getSeriesIndex(), task.getTaskName());
|
||||
} else {
|
||||
this.taskName = task.getTaskName();
|
||||
}
|
||||
|
||||
this.finishable = task.isFinishable();
|
||||
}
|
||||
|
||||
public TaskShortInfo(long taskID, String taskName) {
|
||||
@ -32,4 +41,12 @@ public class TaskShortInfo {
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package core.api.models.timemanager.tasks;
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.services.TaskSeriesService;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
@ -27,9 +28,15 @@ public class TaskTaskgroupInfo {
|
||||
|
||||
private List<TaskgroupEntityInfo> taskgroups;
|
||||
|
||||
private boolean finishable;
|
||||
|
||||
public TaskTaskgroupInfo(Task task) {
|
||||
this.taskID = task.getTaskID();
|
||||
this.taskName = task.getTaskName();
|
||||
if(task.getTaskSerieItem() != null) {
|
||||
this.taskName = TaskSeriesService.insertNameIndex(task.getTaskSerieItem().getSeriesIndex(), task.getTaskName());
|
||||
} else {
|
||||
this.taskName = task.getTaskName();
|
||||
}
|
||||
this.eta = task.getEta();
|
||||
this.startDate = task.getStartDate();
|
||||
this.deadline = task.getDeadline();
|
||||
@ -42,6 +49,7 @@ public class TaskTaskgroupInfo {
|
||||
List<Taskgroup> taskgroupList = Taskgroup.getAncestorList(task.getTaskgroup());
|
||||
taskgroupList.add(task.getTaskgroup());
|
||||
this.taskgroups = taskgroupList.stream().map(TaskgroupEntityInfo::new).toList();
|
||||
this.finishable = task.isFinishable();
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
@ -115,4 +123,12 @@ public class TaskTaskgroupInfo {
|
||||
public void setTaskgroups(List<TaskgroupEntityInfo> taskgroups) {
|
||||
this.taskgroups = taskgroups;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||
|
||||
public enum DeadlineStrategy {
|
||||
|
||||
FIX_DEADLINE,
|
||||
DEADLINE_EQUAL_START,
|
||||
DEADLINE_FIT_START
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class TaskRepeatDayInfo {
|
||||
|
||||
private int offset;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDate endingDate;
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public LocalDate getEndingDate() {
|
||||
return endingDate;
|
||||
}
|
||||
|
||||
public void setEndingDate(LocalDate endingDate) {
|
||||
this.endingDate = endingDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||
|
||||
import core.api.models.timemanager.tasks.TaskEntityInfo;
|
||||
import core.entities.timemanager.Task;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
|
||||
public class TaskRepeatWeekDayInfo {
|
||||
private int offset;
|
||||
private long taskID;
|
||||
private DayOfWeek dayOfWeek;
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(int offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public long getTaskID() {
|
||||
return taskID;
|
||||
}
|
||||
|
||||
public void setTaskID(long taskID) {
|
||||
this.taskID = taskID;
|
||||
}
|
||||
|
||||
public DayOfWeek getDayOfWeek() {
|
||||
return dayOfWeek;
|
||||
}
|
||||
|
||||
public void setDayOfWeek(DayOfWeek dayOfWeek) {
|
||||
this.dayOfWeek = dayOfWeek;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package core.api.models.timemanager.tasks.repeatinginfo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import util.Tupel;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class TaskRepeatWeekInfo {
|
||||
|
||||
@Size(min = 1, max = 7)
|
||||
private List<TaskRepeatWeekDayInfo> weekDayInfos;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
private LocalDate endDate;
|
||||
|
||||
public List<TaskRepeatWeekDayInfo> getWeekDayInfos() {
|
||||
return weekDayInfos;
|
||||
}
|
||||
|
||||
public void setWeekDayInfos(List<TaskRepeatWeekDayInfo> weekDayInfos) {
|
||||
this.weekDayInfos = weekDayInfos;
|
||||
}
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package core.api.models.users;
|
||||
|
||||
import core.entities.User;
|
||||
|
||||
public class NtfyInformation {
|
||||
|
||||
private String ntfy_host;
|
||||
private String ntfy_topic;
|
||||
private String ntfy_user;
|
||||
private String ntfy_token;
|
||||
|
||||
public NtfyInformation(User user) {
|
||||
this.ntfy_host = user.getNtfy_host();
|
||||
this.ntfy_topic = user.getNtfy_topic();
|
||||
this.ntfy_user = "****";
|
||||
this.ntfy_token = "****";
|
||||
}
|
||||
|
||||
public NtfyInformation() {
|
||||
}
|
||||
|
||||
public String getNtfy_host() {
|
||||
return ntfy_host;
|
||||
}
|
||||
|
||||
public void setNtfy_host(String ntfy_host) {
|
||||
this.ntfy_host = ntfy_host;
|
||||
}
|
||||
|
||||
public String getNtfy_topic() {
|
||||
return ntfy_topic;
|
||||
}
|
||||
|
||||
public void setNtfy_topic(String ntfy_topic) {
|
||||
this.ntfy_topic = ntfy_topic;
|
||||
}
|
||||
|
||||
public String getNtfy_user() {
|
||||
return ntfy_user;
|
||||
}
|
||||
|
||||
public void setNtfy_user(String ntfy_user) {
|
||||
this.ntfy_user = ntfy_user;
|
||||
}
|
||||
|
||||
public String getNtfy_token() {
|
||||
return ntfy_token;
|
||||
}
|
||||
|
||||
public void setNtfy_token(String ntfy_token) {
|
||||
this.ntfy_token = ntfy_token;
|
||||
}
|
||||
}
|
@ -42,6 +42,11 @@ public class User {
|
||||
inverseJoinColumns = @JoinColumn(name = "role_id"))
|
||||
private Set<RoleEntity> roles = new HashSet<>();
|
||||
|
||||
private String ntfy_host;
|
||||
private String ntfy_topic;
|
||||
private String ntfy_username;
|
||||
private String ntfy_token;
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
@ -98,6 +103,38 @@ public class User {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public String getNtfy_host() {
|
||||
return ntfy_host;
|
||||
}
|
||||
|
||||
public void setNtfy_host(String ntfy_host) {
|
||||
this.ntfy_host = ntfy_host;
|
||||
}
|
||||
|
||||
public String getNtfy_topic() {
|
||||
return ntfy_topic;
|
||||
}
|
||||
|
||||
public void setNtfy_topic(String ntfy_topic) {
|
||||
this.ntfy_topic = ntfy_topic;
|
||||
}
|
||||
|
||||
public String getNtfy_username() {
|
||||
return ntfy_username;
|
||||
}
|
||||
|
||||
public void setNtfy_username(String ntfy_username) {
|
||||
this.ntfy_username = ntfy_username;
|
||||
}
|
||||
|
||||
public String getNtfy_token() {
|
||||
return ntfy_token;
|
||||
}
|
||||
|
||||
public void setNtfy_token(String ntfy_token) {
|
||||
this.ntfy_token = ntfy_token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -93,6 +93,10 @@ public abstract class AbstractSchedule {
|
||||
return startTime != null && stopTime == null;
|
||||
}
|
||||
|
||||
public boolean isCompleted() {
|
||||
return startTime != null && stopTime != null;
|
||||
}
|
||||
|
||||
public int getActiveTime() {
|
||||
if(startTime == null) {
|
||||
return 0;
|
||||
@ -120,4 +124,8 @@ public abstract class AbstractSchedule {
|
||||
return (int) duration.toMinutes();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract AbstractSchedule cloneSchedule();
|
||||
|
||||
public abstract void shiftSchedule(long numberDays);
|
||||
}
|
||||
|
@ -71,4 +71,15 @@ public class AdvancedTaskSchedule extends AbstractSchedule {
|
||||
public boolean isMissed(LocalDateTime timeReference) {
|
||||
return startTime == null && scheduleEnd.toLocalDate().isBefore(timeReference.toLocalDate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractSchedule cloneSchedule() {
|
||||
return new AdvancedTaskSchedule(this.task, this.scheduleStart, this.scheduleEnd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shiftSchedule(long numberDays) {
|
||||
this.scheduleStart = this.scheduleStart.plusDays(numberDays);
|
||||
this.scheduleEnd = this.scheduleEnd.plusDays(numberDays);
|
||||
}
|
||||
}
|
||||
|
@ -52,4 +52,14 @@ public class BasicTaskSchedule extends AbstractSchedule{
|
||||
public boolean isMissed(LocalDateTime timeReference) {
|
||||
return startTime == null && scheduleDate.isBefore(timeReference.toLocalDate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractSchedule cloneSchedule() {
|
||||
return new BasicTaskSchedule(this.task, this.scheduleDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shiftSchedule(long numberDays) {
|
||||
this.scheduleDate = this.scheduleDate.plusDays(numberDays);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
package core.entities.timemanager;
|
||||
|
||||
import core.api.models.timemanager.tasks.TaskFieldInfo;
|
||||
import core.api.models.timemanager.tasks.repeatinginfo.DeadlineStrategy;
|
||||
import util.Tripel;
|
||||
import util.Tupel;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "tasks")
|
||||
@ -20,32 +23,89 @@ public class Task {
|
||||
@JoinColumn(name = "taskgroup_id")
|
||||
private Taskgroup taskgroup;
|
||||
private String taskName;
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate deadline;
|
||||
|
||||
private int eta;
|
||||
|
||||
private boolean finished;
|
||||
|
||||
@OneToMany(mappedBy = "task", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private boolean finishable;
|
||||
@OneToMany(mappedBy = "task", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||
private List<AbstractSchedule> basicTaskSchedules;
|
||||
|
||||
private int workTime;
|
||||
@OneToOne(mappedBy = "task", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private TaskSerieItem taskSerieItem;
|
||||
|
||||
public Task(Taskgroup taskgroup, String taskName, LocalDate startDate, LocalDate deadline, int eta) {
|
||||
this.taskgroup = taskgroup;
|
||||
this.taskName = taskName;
|
||||
this.startDate = startDate;
|
||||
this.deadline = deadline;
|
||||
this.eta = eta;
|
||||
this.finished = false;
|
||||
}
|
||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.REMOVE, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
private Set<Task> subtasks;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "parent")
|
||||
private Task parent;
|
||||
|
||||
public Task() {
|
||||
this.basicTaskSchedules = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Task(Taskgroup taskgroup, TaskFieldInfo taskFieldInfo) {
|
||||
this.taskgroup = taskgroup;
|
||||
this.taskName = taskFieldInfo.getTaskName();
|
||||
this.startDate = taskFieldInfo.getStartDate();
|
||||
this.deadline = taskFieldInfo.getDeadline();
|
||||
this.eta = taskFieldInfo.getEta();
|
||||
this.finished = false;
|
||||
this.finishable = taskFieldInfo.isFinishable();
|
||||
}
|
||||
|
||||
public Tripel<Task, Collection<Task>, Collection<AbstractSchedule>> cloneTask() {
|
||||
Collection<Task> clonedTasks = new ArrayList<>();
|
||||
Collection<AbstractSchedule> clonedSchedules = new ArrayList<>();
|
||||
|
||||
Task clonedTask = new Task();
|
||||
clonedTasks.add(clonedTask);
|
||||
|
||||
clonedTask.setTaskgroup(this.getTaskgroup());
|
||||
clonedTask.setTaskName(this.taskName);
|
||||
clonedTask.setEta(this.eta);
|
||||
clonedTask.setFinished(this.finished);
|
||||
clonedTask.setFinishable(this.finishable);
|
||||
clonedTask.setStartDate(this.startDate);
|
||||
clonedTask.setDeadline(this.deadline);
|
||||
|
||||
for(AbstractSchedule abstractSchedule : this.basicTaskSchedules) {
|
||||
AbstractSchedule clonedSchedule = abstractSchedule.cloneSchedule();
|
||||
clonedSchedules.add(clonedSchedule);
|
||||
clonedTask.getBasicTaskSchedules().clear();
|
||||
clonedTask.getBasicTaskSchedules().add(clonedSchedule);
|
||||
|
||||
clonedSchedule.setTask(clonedTask);
|
||||
}
|
||||
|
||||
Set<Task> clonedSubtasks = new HashSet<>();
|
||||
for(Task task : this.subtasks) {
|
||||
Tripel<Task, Collection<Task>, Collection<AbstractSchedule>> clonedSubtask = task.cloneTask();
|
||||
clonedSubtask.getValue00().setParent(clonedTask);
|
||||
clonedSubtasks.add(clonedSubtask.getValue00());
|
||||
|
||||
clonedTasks.addAll(clonedSubtask.getValue01());
|
||||
clonedSchedules.addAll(clonedSubtask.getValue02());
|
||||
}
|
||||
clonedTask.setSubtasks(clonedSubtasks);
|
||||
return new Tripel<>(clonedTask, clonedTasks, clonedSchedules);
|
||||
}
|
||||
|
||||
public void shiftTask(long offset) {
|
||||
this.setStartDate(this.getStartDate().plusDays(offset));
|
||||
this.setDeadline(this.getDeadline().plusDays(offset));
|
||||
|
||||
for(AbstractSchedule abstractSchedule : this.basicTaskSchedules) {
|
||||
abstractSchedule.shiftSchedule(offset);
|
||||
}
|
||||
|
||||
for(Task subtask: this.subtasks) {
|
||||
subtask.shiftTask(offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long getTaskID() {
|
||||
return taskID;
|
||||
}
|
||||
@ -91,7 +151,7 @@ public class Task {
|
||||
}
|
||||
|
||||
public void finish() {
|
||||
this.finished = true;
|
||||
this.finished = !this.finished;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
@ -118,7 +178,18 @@ public class Task {
|
||||
this.taskID = taskID;
|
||||
}
|
||||
|
||||
public TaskSerieItem getTaskSerieItem() {
|
||||
return taskSerieItem;
|
||||
}
|
||||
|
||||
public void setTaskSerieItem(TaskSerieItem taskSerieItem) {
|
||||
this.taskSerieItem = taskSerieItem;
|
||||
}
|
||||
|
||||
public List<AbstractSchedule> getBasicTaskSchedules() {
|
||||
if(basicTaskSchedules == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return basicTaskSchedules;
|
||||
}
|
||||
|
||||
@ -126,12 +197,33 @@ public class Task {
|
||||
this.basicTaskSchedules = basicTaskSchedules;
|
||||
}
|
||||
|
||||
public void addSubtask(Task subtask) {
|
||||
subtask.setParent(this);
|
||||
this.subtasks.add(subtask);
|
||||
}
|
||||
|
||||
public Set<Task> getSubtasks() {
|
||||
return subtasks;
|
||||
}
|
||||
|
||||
public void setSubtasks(Set<Task> subtasks) {
|
||||
this.subtasks = subtasks;
|
||||
}
|
||||
|
||||
public Task getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(Task parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Task task = (Task) o;
|
||||
return taskID == task.taskID && eta == task.eta && finished == task.finished && workTime == task.workTime && Objects.equals(taskgroup, task.taskgroup) && Objects.equals(taskName, task.taskName) && Objects.equals(startDate, task.startDate) && Objects.equals(deadline, task.deadline);
|
||||
return taskID == task.taskID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -171,4 +263,35 @@ public class Task {
|
||||
}
|
||||
return abstractSchedules;
|
||||
}
|
||||
|
||||
public boolean isFinishable() {
|
||||
return finishable;
|
||||
}
|
||||
|
||||
public void setFinishable(boolean finishable) {
|
||||
this.finishable = finishable;
|
||||
}
|
||||
|
||||
public int calcOverallActivityInfo(LocalDate date) {
|
||||
int activeMinutes = 0;
|
||||
for(AbstractSchedule schedule : getBasicTaskSchedules()) {
|
||||
if(schedule.isCompleted() && schedule.getStartTime().toLocalDate().isEqual(date)) {
|
||||
activeMinutes += schedule.calcActiveMinutes();
|
||||
}
|
||||
}
|
||||
return activeMinutes;
|
||||
}
|
||||
|
||||
public boolean hasPlannedSchedules() {
|
||||
for(AbstractSchedule schedule : getBasicTaskSchedules()) {
|
||||
if(!schedule.isCompleted()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void increaseWorkTime(long minutes) {
|
||||
this.workTime += (int) minutes;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package core.entities.timemanager;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "task_series")
|
||||
public class TaskSerie {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long taskSerieID;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "taskSerie", orphanRemoval = true)
|
||||
List<TaskSerieItem> tasks = new ArrayList<>();
|
||||
|
||||
public long getTaskSerieID() {
|
||||
return taskSerieID;
|
||||
}
|
||||
|
||||
public void setTaskSerieID(long taskSerieID) {
|
||||
this.taskSerieID = taskSerieID;
|
||||
}
|
||||
|
||||
public List<TaskSerieItem> getTasks() {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public void setTasks(List<TaskSerieItem> tasks) {
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
public TaskSerieItem addTask(Task task) {
|
||||
TaskSerieItem taskSerieItem = new TaskSerieItem(this, task, this.tasks.size()+1);
|
||||
this.tasks.add(taskSerieItem);
|
||||
return taskSerieItem;
|
||||
}
|
||||
|
||||
public void addItem(TaskSerieItem taskSerieItem) {
|
||||
this.tasks.add(taskSerieItem);
|
||||
taskSerieItem.setTaskSerie(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package core.entities.timemanager;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "task_series_items")
|
||||
public class TaskSerieItem {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private long itemID;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(referencedColumnName = "taskSerieID")
|
||||
private TaskSerie taskSerie;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "task_id")
|
||||
private Task task;
|
||||
|
||||
|
||||
private int seriesIndex;
|
||||
|
||||
public TaskSerieItem(TaskSerie taskSerie, Task task, int index) {
|
||||
this.taskSerie = taskSerie;
|
||||
this.seriesIndex = index;
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
public TaskSerieItem() {
|
||||
}
|
||||
|
||||
public TaskSerieItem(Task task, int itemIndex) {
|
||||
this.taskSerie = null;
|
||||
this.seriesIndex = itemIndex;
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
public long getItemID() {
|
||||
return itemID;
|
||||
}
|
||||
|
||||
public void setItemID(long itemID) {
|
||||
this.itemID = itemID;
|
||||
}
|
||||
|
||||
public TaskSerie getTaskSerie() {
|
||||
return taskSerie;
|
||||
}
|
||||
|
||||
public void setTaskSerie(TaskSerie taskSerie) {
|
||||
this.taskSerie = taskSerie;
|
||||
}
|
||||
|
||||
public int getSeriesIndex() {
|
||||
return seriesIndex;
|
||||
}
|
||||
|
||||
public void setSeriesIndex(int seriesIndex) {
|
||||
this.seriesIndex = seriesIndex;
|
||||
}
|
||||
|
||||
public Task getTask() {
|
||||
return task;
|
||||
}
|
||||
|
||||
public void setTask(Task task) {
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
TaskSerieItem that = (TaskSerieItem) o;
|
||||
return itemID == that.itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(itemID);
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
package core.entities.timemanager;
|
||||
|
||||
import core.api.models.timemanager.history.TaskgroupActivityInfo;
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
||||
import core.entities.User;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
@Entity
|
||||
@ -22,7 +25,7 @@ public class Taskgroup {
|
||||
@JoinColumn(name = "taskgroupuser", nullable = false)
|
||||
private User user;
|
||||
|
||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@OneToMany(mappedBy = "parent", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||
private Set<Taskgroup> children;
|
||||
|
||||
@ManyToOne
|
||||
@ -30,7 +33,7 @@ public class Taskgroup {
|
||||
private Taskgroup parent;
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "taskgroup", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@OneToMany(mappedBy = "taskgroup", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, orphanRemoval = true)
|
||||
private Set<Task> tasks;
|
||||
|
||||
public Taskgroup(String taskgroupName, User user) {
|
||||
@ -92,11 +95,13 @@ public class Taskgroup {
|
||||
public static List<Taskgroup> getAncestorList(Taskgroup taskgroup) {
|
||||
List<Taskgroup> ancestors = new ArrayList<>();
|
||||
Taskgroup currentTaskgroup = taskgroup;
|
||||
ancestors.add(taskgroup);
|
||||
while(currentTaskgroup.parent != null) {
|
||||
ancestors.add(currentTaskgroup.parent);
|
||||
currentTaskgroup = currentTaskgroup.parent;
|
||||
}
|
||||
//ancestors.add(taskgroup);
|
||||
|
||||
Collections.reverse(ancestors);
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
@ -130,4 +135,6 @@ public class Taskgroup {
|
||||
public int hashCode() {
|
||||
return Objects.hash(taskgroupID);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package core.repositories.timemanager;
|
||||
|
||||
import core.entities.timemanager.AdvancedTaskSchedule;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface AdvancedScheduleRepository extends CrudRepository<AdvancedTaskSchedule, Long> {
|
||||
|
||||
|
||||
}
|
@ -1,10 +1,15 @@
|
||||
package core.repositories.timemanager;
|
||||
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
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.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@ -17,4 +22,12 @@ public interface ScheduleRepository extends CrudRepository<AbstractSchedule, Lon
|
||||
@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);
|
||||
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "DELETE FROM AbstractSchedule a WHERE a.task IN (SELECT t FROM Task t WHERE t.taskgroup = ?1)")
|
||||
void deleteByTaskgroup(Taskgroup taskgroup);
|
||||
|
||||
@Query(value = "SELECT s FROM AbstractSchedule s WHERE s.task.taskgroup.user.username = ?1 AND s.startTime is NOT NULL AND s.stopTime IS NOT NULL")
|
||||
List<AbstractSchedule> getAllFinishedSchedulesByUser(String username);
|
||||
}
|
||||
|
@ -20,10 +20,12 @@ public interface TaskRepository extends CrudRepository<Task, Long> {
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "DELETE FROM Task t WHERE t.taskgroup = ?1")
|
||||
void deleteAllByTaskgroup(Taskgroup taskgroup);
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query(value = "DELETE FROM Task t WHERE t.taskID = ?1")
|
||||
void deleteByTaskID(long taskID);
|
||||
|
||||
@Query(value = "SELECT t FROM Task t WHERE t.taskgroup.user.username = ?1 AND t.deadline is NOT NULL AND t.deadline < ?2 AND t.finished = FALSE")
|
||||
@ -34,4 +36,17 @@ public interface TaskRepository extends CrudRepository<Task, Long> {
|
||||
|
||||
@Query(value = "SELECT t FROM Task t WHERE t.taskgroup.user.username = ?1 AND (t.startDate IS NULL OR t.startDate <= ?2) AND t.finished = FALSE")
|
||||
List<Task> findAllActive(String username, LocalDate now);
|
||||
|
||||
@Query(value = "SELECT t FROM Task t WHERE t.taskgroup = ?1")
|
||||
List<Task> findAllByTaskgroup(Taskgroup taskgroup);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "UPDATE Task t SET t.parent = null WHERE t.taskgroup = ?1")
|
||||
void deleteTaskHierarchyWhereTaskgroup(Taskgroup taskgroup);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "DELETE Task t WHERE t.parent = ?1")
|
||||
void deleteTasksByParent(Task parentTask);
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package core.repositories.timemanager;
|
||||
|
||||
import core.entities.timemanager.TaskSerieItem;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
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;
|
||||
|
||||
@Repository
|
||||
public interface TaskSerieItemRepository extends CrudRepository<TaskSerieItem, Long> {
|
||||
|
||||
@Query(value = "DELETE FROM TaskSerieItem tsi WHERE tsi.task IN (SELECT t FROM Task t WHERE t.taskgroup = ?1)")
|
||||
@Modifying
|
||||
@Transactional
|
||||
void deleteByTaskgroup(Taskgroup taskgroup);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package core.repositories.timemanager;
|
||||
|
||||
import core.entities.timemanager.TaskSerie;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface TaskSeriesRepository extends CrudRepository<TaskSerie, Long> {
|
||||
@Query("SELECT DISTINCT ts FROM TaskSerie ts JOIN ts.tasks tsi JOIN tsi.task t WHERE t.taskgroup = :taskgroup")
|
||||
List<TaskSerie> findByTaskgroup(@Param("taskgroup")Taskgroup taskgroup);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "DELETE FROM TaskSerie ts WHERE ts.tasks.size = 0")
|
||||
void deleteUnreferenced();
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package core.services;
|
||||
|
||||
import core.api.models.auth.SimpleStatusResponse;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
public class PermissionResult <T> extends ServiceResult<T> {
|
||||
|
||||
private boolean hasPermissions;
|
||||
@ -30,11 +33,25 @@ public class PermissionResult <T> extends ServiceResult<T> {
|
||||
this.hasPermissions = hasPermissions;
|
||||
}
|
||||
|
||||
public boolean isHasPermissions() {
|
||||
return hasPermissions;
|
||||
public boolean isNoPermissions() {
|
||||
return !hasPermissions;
|
||||
}
|
||||
|
||||
public void setHasPermissions(boolean hasPermissions) {
|
||||
this.hasPermissions = hasPermissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<?> mapToResponseEntity() {
|
||||
if(isNoPermissions()) {
|
||||
return ResponseEntity.status(403).body(new SimpleStatusResponse("failed"));
|
||||
} else {
|
||||
return super.mapToResponseEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIssue() {
|
||||
return super.hasIssue() || isNoPermissions();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package core.services;
|
||||
|
||||
import core.api.models.auth.SimpleStatusResponse;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
public enum ServiceExitCode {
|
||||
|
||||
OK,
|
||||
@ -7,4 +10,13 @@ public enum ServiceExitCode {
|
||||
MISSING_ENTITY,
|
||||
INVALID_OPERATION,
|
||||
INVALID_PARAMETER;
|
||||
|
||||
public ResponseEntity<SimpleStatusResponse> mapToResponseEntity() {
|
||||
return switch (this) {
|
||||
case OK -> ResponseEntity.ok(new SimpleStatusResponse("success"));
|
||||
case MISSING_ENTITY -> ResponseEntity.status(404).body(new SimpleStatusResponse("failed"));
|
||||
case ENTITY_ALREADY_EXIST -> ResponseEntity.status(409).body(new SimpleStatusResponse("failed"));
|
||||
case INVALID_OPERATION, INVALID_PARAMETER -> ResponseEntity.status(400).body(new SimpleStatusResponse("failed"));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package core.services;
|
||||
|
||||
import core.api.models.auth.SimpleStatusResponse;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
public class ServiceResult <T> {
|
||||
|
||||
private ServiceExitCode exitCode;
|
||||
@ -34,4 +37,12 @@ public class ServiceResult <T> {
|
||||
public void setResult(T result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public boolean hasIssue() {
|
||||
return exitCode != ServiceExitCode.OK;
|
||||
}
|
||||
|
||||
public ResponseEntity<?> mapToResponseEntity() {
|
||||
return exitCode.mapToResponseEntity();
|
||||
}
|
||||
}
|
||||
|
113
backend/src/main/java/core/services/StatisticService.java
Normal file
113
backend/src/main/java/core/services/StatisticService.java
Normal file
@ -0,0 +1,113 @@
|
||||
package core.services;
|
||||
|
||||
import core.api.models.timemanager.history.ActivityInfo;
|
||||
import core.api.models.timemanager.history.TaskgroupActivityInfo;
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupEntityInfo;
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.repositories.timemanager.ScheduleRepository;
|
||||
import core.repositories.timemanager.TaskgroupRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class StatisticService {
|
||||
|
||||
@Autowired private ScheduleRepository scheduleRepository;
|
||||
|
||||
public HashMap<Taskgroup, HashMap<LocalDate, Integer>> calcActivityByUser(Taskgroup taskgroup, String username, LocalDate startinDate, LocalDate endingDate) {
|
||||
HashMap<Taskgroup, HashMap<LocalDate, Integer>> taskgroupActivityInfos = new HashMap<>();
|
||||
List<AbstractSchedule> startedSchedules = scheduleRepository.getAllFinishedSchedulesByUser(username);
|
||||
for(AbstractSchedule schedule : startedSchedules) {
|
||||
if(schedule.getStartTime().toLocalDate().isAfter(endingDate) || schedule.getStopTime().toLocalDate().isBefore(startinDate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Taskgroup topTaskgroup;
|
||||
if(taskgroup == null) {
|
||||
topTaskgroup = findTopTaskgroup(schedule.getTask().getTaskgroup());
|
||||
} else {
|
||||
topTaskgroup = findTaskgroupOfLayer(taskgroup, schedule.getTask().getTaskgroup());
|
||||
if(topTaskgroup == null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<LocalDate, Integer> taskgroupActivity;
|
||||
if(taskgroupActivityInfos.containsKey(topTaskgroup)) {
|
||||
taskgroupActivity = taskgroupActivityInfos.get(topTaskgroup);
|
||||
} else {
|
||||
taskgroupActivity = new HashMap<>();
|
||||
taskgroupActivityInfos.put(topTaskgroup, taskgroupActivity);
|
||||
}
|
||||
|
||||
if(schedule.getStartTime().toLocalDate().isEqual(schedule.getStopTime().toLocalDate())) {
|
||||
insertActivity(taskgroupActivity, schedule.getStartTime().toLocalDate(), schedule.getActiveTime());
|
||||
} else {
|
||||
//Starting Date
|
||||
LocalDateTime startingDayEnd = schedule.getStartTime().toLocalDate().atTime(LocalTime.MAX);
|
||||
Duration startingActivity = Duration.between(schedule.getStartTime(), startingDayEnd);
|
||||
insertActivity(taskgroupActivity, schedule.getStartTime().toLocalDate(), (int) startingActivity.toMinutes());
|
||||
|
||||
//Ending Date
|
||||
LocalDateTime endingDayStart = schedule.getStopTime().toLocalDate().atStartOfDay();
|
||||
Duration endingActivity = Duration.between(endingDayStart, schedule.getStopTime());
|
||||
insertActivity(taskgroupActivity, schedule.getStopTime().toLocalDate(), (int) endingActivity.toMinutes());
|
||||
}
|
||||
}
|
||||
|
||||
return taskgroupActivityInfos;
|
||||
}
|
||||
|
||||
public static List<TaskgroupActivityInfo> convertInternActivityInfo(HashMap<Taskgroup, HashMap<LocalDate, Integer>> taskgroupActivity) {
|
||||
List<TaskgroupActivityInfo> taskgroupActivityInfos = new ArrayList<>();
|
||||
for(Map.Entry<Taskgroup, HashMap<LocalDate, Integer>> entry: taskgroupActivity.entrySet()) {
|
||||
List<ActivityInfo> activityInfos = new ArrayList<>();
|
||||
for(Map.Entry<LocalDate, Integer> dateActivity : entry.getValue().entrySet()) {
|
||||
activityInfos.add(new ActivityInfo(dateActivity.getKey(), dateActivity.getValue()));
|
||||
}
|
||||
taskgroupActivityInfos.add(new TaskgroupActivityInfo(new TaskgroupEntityInfo(entry.getKey()), activityInfos));
|
||||
}
|
||||
return taskgroupActivityInfos;
|
||||
}
|
||||
|
||||
private static void insertActivity(HashMap<LocalDate, Integer> activityInfo, LocalDate date, int deltaActivity) {
|
||||
if(activityInfo.containsKey(date)) {
|
||||
int activity = activityInfo.get(date);
|
||||
activity += deltaActivity;
|
||||
activityInfo.put(date, activity);
|
||||
} else {
|
||||
activityInfo.put(date, deltaActivity);
|
||||
}
|
||||
}
|
||||
|
||||
private Taskgroup findTopTaskgroup(Taskgroup taskgroup) {
|
||||
Taskgroup currentTaskgroup = taskgroup;
|
||||
while(currentTaskgroup.getParent() != null) {
|
||||
currentTaskgroup = currentTaskgroup.getParent();
|
||||
}
|
||||
return currentTaskgroup;
|
||||
}
|
||||
|
||||
private Taskgroup findTaskgroupOfLayer(Taskgroup targetLayer, Taskgroup childTaskgroup) {
|
||||
if(targetLayer.getTaskgroupID() == childTaskgroup.getTaskgroupID()) {
|
||||
return childTaskgroup;
|
||||
}
|
||||
|
||||
Taskgroup currentTaskgroup = childTaskgroup;
|
||||
while (currentTaskgroup.getParent() != null && currentTaskgroup.getParent().getTaskgroupID() != targetLayer.getTaskgroupID()) {
|
||||
currentTaskgroup = currentTaskgroup.getParent();
|
||||
}
|
||||
|
||||
if(currentTaskgroup.getParent() == null) {
|
||||
return null;
|
||||
}
|
||||
return currentTaskgroup;
|
||||
}
|
||||
}
|
@ -1,25 +1,27 @@
|
||||
package core.services;
|
||||
|
||||
import core.api.models.timemanager.history.PastScheduleInfo;
|
||||
import core.api.models.timemanager.taskSchedule.ManualScheduleStopInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleFieldInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.BasicScheduleFieldInfo;
|
||||
import core.api.models.timemanager.taskSchedule.ForgottenScheduleInfo;
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.entities.timemanager.AdvancedTaskSchedule;
|
||||
import core.entities.timemanager.BasicTaskSchedule;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.ScheduleInfo;
|
||||
import core.entities.timemanager.*;
|
||||
import core.repositories.UserRepository;
|
||||
import core.repositories.timemanager.AdvancedScheduleRepository;
|
||||
import core.repositories.timemanager.ScheduleRepository;
|
||||
import core.repositories.timemanager.TaskRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.TemporalUnit;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class TaskScheduleService {
|
||||
@ -28,6 +30,7 @@ public class TaskScheduleService {
|
||||
@Autowired private UserRepository userRepository;
|
||||
@Autowired
|
||||
private TaskRepository taskRepository;
|
||||
@Autowired private AdvancedScheduleRepository advancedScheduleRepository;
|
||||
|
||||
public List<AbstractSchedule> getAllSchedulesOfUser(String username) {
|
||||
return scheduleRepository.findAllByUsername(username);
|
||||
@ -96,6 +99,9 @@ public class TaskScheduleService {
|
||||
}
|
||||
|
||||
public void deleteSchedule(AbstractSchedule schedule) {
|
||||
schedule.getTask().getBasicTaskSchedules().remove(schedule);
|
||||
schedule.setTask(null);
|
||||
scheduleRepository.save(schedule);
|
||||
scheduleRepository.delete(schedule);
|
||||
}
|
||||
|
||||
@ -161,6 +167,9 @@ public class TaskScheduleService {
|
||||
if(schedule.getStartTime() != null && schedule.getStopTime() == null) {
|
||||
schedule.setStopTime(LocalDateTime.now());
|
||||
scheduleRepository.save(schedule);
|
||||
Duration scheduleDuration = Duration.between(schedule.getStartTime(), schedule.getStopTime());
|
||||
schedule.getTask().increaseWorkTime(scheduleDuration.toMinutes());
|
||||
taskRepository.save(schedule.getTask());
|
||||
}
|
||||
|
||||
if(finish) {
|
||||
@ -205,4 +214,50 @@ public class TaskScheduleService {
|
||||
}
|
||||
return activatedSchedules;
|
||||
}
|
||||
|
||||
public void deleteSchedules(List<AbstractSchedule> taskSchedules) {
|
||||
scheduleRepository.deleteAll(taskSchedules);
|
||||
}
|
||||
|
||||
public List<AbstractSchedule> findSchedulesByDate(String username, LocalDate date) {
|
||||
List<AbstractSchedule> allSchedules = scheduleRepository.findAllByUsername(username);
|
||||
return findScheduleByDate(allSchedules, date);
|
||||
}
|
||||
|
||||
public List<AdvancedTaskSchedule> findSchedulesByDate(LocalDate date) {
|
||||
Iterable<AdvancedTaskSchedule> allSchedules = advancedScheduleRepository.findAll();
|
||||
List<AdvancedTaskSchedule> schedulesToday = new ArrayList<>();
|
||||
for(AdvancedTaskSchedule advancedTaskSchedule : allSchedules) {
|
||||
if(advancedTaskSchedule.getScheduleStart().toLocalDate().equals(date) && advancedTaskSchedule.getStartTime() == null &&
|
||||
advancedTaskSchedule.getScheduleStart().isBefore(LocalDateTime.now())) {
|
||||
schedulesToday.add(advancedTaskSchedule);
|
||||
}
|
||||
}
|
||||
return schedulesToday;
|
||||
|
||||
}
|
||||
|
||||
private List<AbstractSchedule> findScheduleByDate(List<AbstractSchedule> schedules, LocalDate date) {
|
||||
List<AbstractSchedule> filteredSchedules = new ArrayList<>();
|
||||
for(AbstractSchedule schedule : schedules) {
|
||||
if(schedule.isCompleted()) {
|
||||
LocalDate startDate = LocalDate.from(schedule.getStartTime());
|
||||
LocalDate endDate = LocalDate.from(schedule.getStopTime());
|
||||
|
||||
if(startDate.isEqual(date) || endDate.isEqual(date)) {
|
||||
filteredSchedules.add(schedule);
|
||||
}
|
||||
}
|
||||
}
|
||||
return filteredSchedules;
|
||||
}
|
||||
|
||||
public void finishScheduleManual(AbstractSchedule schedule, ManualScheduleStopInfo manualScheduleStopInfo) {
|
||||
schedule.setStopTime(schedule.getStartTime().plusMinutes(manualScheduleStopInfo.getDuration()));
|
||||
scheduleRepository.save(schedule);
|
||||
}
|
||||
|
||||
public void deleteSchedulesByTaskgroup(Taskgroup taskgroup) {
|
||||
scheduleRepository.deleteByTaskgroup(taskgroup);
|
||||
}
|
||||
}
|
||||
|
176
backend/src/main/java/core/services/TaskSeriesService.java
Normal file
176
backend/src/main/java/core/services/TaskSeriesService.java
Normal file
@ -0,0 +1,176 @@
|
||||
package core.services;
|
||||
|
||||
import core.api.models.timemanager.tasks.repeatinginfo.DeadlineStrategy;
|
||||
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatDayInfo;
|
||||
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatWeekDayInfo;
|
||||
import core.api.models.timemanager.tasks.repeatinginfo.TaskRepeatWeekInfo;
|
||||
import core.entities.timemanager.*;
|
||||
import core.repositories.timemanager.ScheduleRepository;
|
||||
import core.repositories.timemanager.TaskRepository;
|
||||
import core.repositories.timemanager.TaskSerieItemRepository;
|
||||
import core.repositories.timemanager.TaskSeriesRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import util.Tupel;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class TaskSeriesService {
|
||||
|
||||
@Autowired private TaskRepository taskRepository;
|
||||
@Autowired private TaskSeriesRepository taskSeriesRepository;
|
||||
@Autowired private TaskSerieItemRepository taskSerieItemRepository;
|
||||
@Autowired private ScheduleRepository scheduleRepository;
|
||||
|
||||
|
||||
public ServiceExitCode createTaskSeries(TaskRepeatWeekInfo taskRepeatInfo) {
|
||||
HashMap<Task, Integer> offsetMap = calcWeeklyOffsetMap(taskRepeatInfo);
|
||||
|
||||
TaskSerie taskSerie = new TaskSerie();
|
||||
List<Task> clonedTasks = new ArrayList<>();
|
||||
List<AbstractSchedule> clonedSchedules = new ArrayList<>();
|
||||
int weekDayIndex = 0;
|
||||
for(Map.Entry<Task, Integer> repeatingTaskInfo: offsetMap.entrySet()) {
|
||||
Task rootTask = repeatingTaskInfo.getKey();
|
||||
addRootSubTasksToTaskSerie(taskSerie, rootTask, weekDayIndex);
|
||||
|
||||
int itemIndex = weekDayIndex +1;
|
||||
Tupel<Collection<Task>, Collection<AbstractSchedule>> repeatingResult = repeatTask(rootTask, taskRepeatInfo.getEndDate(), offsetMap, taskSerie, itemIndex);
|
||||
|
||||
clonedTasks.addAll(repeatingResult.getValue00());
|
||||
clonedSchedules.addAll(repeatingResult.getValue01());
|
||||
|
||||
weekDayIndex++;
|
||||
}
|
||||
|
||||
|
||||
taskSeriesRepository.save(taskSerie);
|
||||
taskRepository.saveAll(clonedTasks);
|
||||
taskSerieItemRepository.saveAll(taskSerie.getTasks());
|
||||
scheduleRepository.saveAll(clonedSchedules);
|
||||
|
||||
return ServiceExitCode.OK;
|
||||
}
|
||||
|
||||
private Tupel<Collection<Task>, Collection<AbstractSchedule>> repeatTask(Task rootTask, LocalDate endingDate, HashMap<Task, Integer> offsetMap,TaskSerie taskSerie, int itemIndex) {
|
||||
List<Task> clonedTasks = new ArrayList<>();
|
||||
List<AbstractSchedule> clonedSchedules = new ArrayList<>();
|
||||
|
||||
LocalDate currentDate = rootTask.getStartDate().plusDays(offsetMap.get(rootTask));
|
||||
long index = 1;
|
||||
while(currentDate.isBefore(endingDate)) {
|
||||
var cloneResult = rootTask.cloneTask();
|
||||
Task clonedRootTask = cloneResult.getValue00();
|
||||
clonedTasks.addAll(cloneResult.getValue01());
|
||||
clonedSchedules.addAll(cloneResult.getValue02());
|
||||
|
||||
for(Task clonedTask : cloneResult.getValue01()) {
|
||||
TaskSerieItem item = new TaskSerieItem(clonedTask, itemIndex);
|
||||
taskSerie.addItem(item);
|
||||
}
|
||||
|
||||
clonedRootTask.shiftTask(index * offsetMap.get(rootTask));
|
||||
|
||||
currentDate = currentDate.plusDays(offsetMap.get(rootTask));
|
||||
itemIndex += offsetMap.size();
|
||||
index++;
|
||||
}
|
||||
|
||||
return new Tupel<>(clonedTasks, clonedSchedules);
|
||||
}
|
||||
|
||||
private HashMap<Task, Integer> calcWeeklyOffsetMap(TaskRepeatWeekInfo weekInfo) throws NoSuchElementException {
|
||||
HashMap<Task,Integer> offsetMap = new HashMap<>();
|
||||
weekInfo.getWeekDayInfos().sort(Comparator.comparing(TaskRepeatWeekDayInfo::getDayOfWeek));
|
||||
for(int i=0; i<weekInfo.getWeekDayInfos().size(); i++) {
|
||||
Optional<Task> requestedTask = taskRepository.findById(weekInfo.getWeekDayInfos().get(i).getTaskID());
|
||||
if(requestedTask.isEmpty()) {
|
||||
throw new NoSuchElementException();
|
||||
} else {
|
||||
int offset = weekInfo.getWeekDayInfos().get(i).getOffset()-1;
|
||||
offsetMap.put(requestedTask.get(), offset);
|
||||
}
|
||||
|
||||
}
|
||||
return offsetMap;
|
||||
}
|
||||
|
||||
public ServiceExitCode createTaskSeries(Task rootTask, TaskRepeatDayInfo taskRepeatInfo) {
|
||||
TaskSerie taskSerie = new TaskSerie();
|
||||
addRootSubTasksToTaskSerie(taskSerie, rootTask, 0);
|
||||
|
||||
HashMap<Task, Integer> offsetMap = new HashMap<>();
|
||||
offsetMap.put(rootTask, taskRepeatInfo.getOffset());
|
||||
|
||||
var repeatingResult = repeatTask(rootTask, taskRepeatInfo.getEndingDate(), offsetMap, taskSerie, 1);
|
||||
List<Task> clonedTasks = new ArrayList<>(repeatingResult.getValue00());
|
||||
List<AbstractSchedule> clonedSchedules = new ArrayList<>(repeatingResult.getValue01());
|
||||
|
||||
|
||||
taskSeriesRepository.save(taskSerie);
|
||||
taskRepository.saveAll(clonedTasks);
|
||||
taskSerieItemRepository.saveAll(taskSerie.getTasks());
|
||||
scheduleRepository.saveAll(clonedSchedules);
|
||||
|
||||
return ServiceExitCode.OK;
|
||||
}
|
||||
|
||||
private void addRootSubTasksToTaskSerie(TaskSerie taskSerie, Task rootTask, int index) {
|
||||
Queue<Task> taskQueue = new LinkedList<>(Collections.singletonList(rootTask));
|
||||
while(!taskQueue.isEmpty()) {
|
||||
Task currentTask = taskQueue.poll();
|
||||
|
||||
TaskSerieItem taskSerieItem = new TaskSerieItem(currentTask, index);
|
||||
taskSerie.addItem(taskSerieItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTaskSeriesItem(Task task) {
|
||||
TaskSerieItem item = task.getTaskSerieItem();
|
||||
TaskSerie taskSerie = task.getTaskSerieItem().getTaskSerie();
|
||||
taskSerie.getTasks().remove(item);
|
||||
task.setTaskSerieItem(null);
|
||||
taskSerieItemRepository.delete(item);
|
||||
if(taskSerie.getTasks().isEmpty()) {
|
||||
taskSeriesRepository.deleteUnreferenced();
|
||||
} else if(task.getParent() == null){
|
||||
repearIndexing(taskSerie, item.getSeriesIndex());
|
||||
}
|
||||
}
|
||||
|
||||
private void repearIndexing(TaskSerie taskSerie, int deletedIndex) {
|
||||
taskSerie.getTasks().sort(Comparator.comparingInt(TaskSerieItem::getSeriesIndex));
|
||||
List<TaskSerieItem> updatedItems = new ArrayList<>();
|
||||
|
||||
for(TaskSerieItem taskSerieItem : taskSerie.getTasks()) {
|
||||
if(taskSerieItem.getSeriesIndex() > deletedIndex) {
|
||||
taskSerieItem.setSeriesIndex(taskSerieItem.getSeriesIndex() -1);
|
||||
updatedItems.add(taskSerieItem);
|
||||
}
|
||||
}
|
||||
|
||||
taskSerieItemRepository.saveAll(updatedItems);
|
||||
}
|
||||
|
||||
public void deleteTaskSerieByTaskgroup(Taskgroup taskgroup) {
|
||||
taskSerieItemRepository.deleteByTaskgroup(taskgroup);
|
||||
taskSeriesRepository.deleteUnreferenced();
|
||||
}
|
||||
|
||||
public static String convertIndexToString(int index) {
|
||||
if(index < 10) {
|
||||
return "0" + index;
|
||||
} else {
|
||||
return String.valueOf(index);
|
||||
}
|
||||
}
|
||||
|
||||
public static String insertNameIndex(int seriesIndex, String taskName) {
|
||||
return taskName.replaceAll("\\$\\{i}", convertIndexToString(seriesIndex));
|
||||
}
|
||||
}
|
@ -2,9 +2,12 @@ package core.services;
|
||||
|
||||
import core.api.models.timemanager.tasks.TaskFieldInfo;
|
||||
import core.api.models.timemanager.tasks.TaskScope;
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.repositories.timemanager.TaskRepository;
|
||||
import core.repositories.timemanager.TaskSerieItemRepository;
|
||||
import core.repositories.timemanager.TaskSeriesRepository;
|
||||
import core.repositories.timemanager.TaskgroupRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -19,33 +22,48 @@ public class TaskService {
|
||||
private final TaskScheduleService taskScheduleService;
|
||||
private final TaskgroupRepository taskgroupRepository;
|
||||
|
||||
private final TaskSeriesService taskSeriesService;
|
||||
|
||||
|
||||
public TaskService(@Autowired TaskRepository taskRepository,
|
||||
@Autowired TaskScheduleService taskScheduleService,
|
||||
TaskgroupRepository taskgroupRepository) {
|
||||
@Autowired TaskgroupRepository taskgroupRepository,
|
||||
@Autowired TaskSeriesService taskSeriesService) {
|
||||
this.taskRepository = taskRepository;
|
||||
this.taskScheduleService = taskScheduleService;
|
||||
this.taskgroupRepository = taskgroupRepository;
|
||||
this.taskSeriesService = taskSeriesService;
|
||||
}
|
||||
|
||||
public ServiceResult<Task> createTask(Taskgroup taskgroup, TaskFieldInfo taskFieldInfo) {
|
||||
if(existTaskByName(taskgroup.getTasks(), taskFieldInfo.getTaskName())) {
|
||||
return new ServiceResult<>(ServiceExitCode.ENTITY_ALREADY_EXIST);
|
||||
}
|
||||
|
||||
//Check for invalid date (deadline before start
|
||||
if(taskFieldInfo.getStartDate() != null && taskFieldInfo.getDeadline() != null &&
|
||||
taskFieldInfo.getDeadline().isBefore(taskFieldInfo.getStartDate())) {
|
||||
return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
Task task = new Task(taskgroup, taskFieldInfo.getTaskName(), taskFieldInfo.getStartDate(), taskFieldInfo.getDeadline(), taskFieldInfo.getEta());
|
||||
Task task = new Task(taskgroup, taskFieldInfo);
|
||||
taskgroup.getTasks().add(task);
|
||||
taskRepository.save(task);
|
||||
|
||||
return new ServiceResult<>(task);
|
||||
}
|
||||
|
||||
public ServiceResult<Task> createSubTask(Task parentTask, TaskFieldInfo taskFieldInfo) {
|
||||
if(taskFieldInfo.getStartDate().isBefore(parentTask.getStartDate()) ||
|
||||
taskFieldInfo.getDeadline().isAfter(parentTask.getDeadline()) ||
|
||||
taskFieldInfo.getDeadline().isBefore(taskFieldInfo.getStartDate())) {
|
||||
return new ServiceResult<>(ServiceExitCode.INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
Task task = new Task(parentTask.getTaskgroup(), taskFieldInfo);
|
||||
parentTask.getTaskgroup().getTasks().add(task);
|
||||
parentTask.addSubtask(task);
|
||||
|
||||
taskRepository.save(task);
|
||||
return new ServiceResult<>(task);
|
||||
}
|
||||
|
||||
private boolean existTaskByName(Collection<Task> tasks, String name) {
|
||||
for(Task task : tasks) {
|
||||
if(task.getTaskName().equals(name)) {
|
||||
@ -85,16 +103,18 @@ public class TaskService {
|
||||
}
|
||||
|
||||
public void deleteTask(Task task) {
|
||||
//taskScheduleService.deleteScheduleByTask(task);
|
||||
System.err.println(task.getTaskID());
|
||||
task.getTaskgroup().getTasks().remove(task);
|
||||
taskgroupRepository.save(task.getTaskgroup());
|
||||
task.setTaskgroup(null);
|
||||
taskRepository.save(task);
|
||||
if(task.getTaskSerieItem() != null) {
|
||||
taskSeriesService.deleteTaskSeriesItem(task);
|
||||
}
|
||||
taskRepository.delete(task);
|
||||
}
|
||||
|
||||
public void clearTasks(Taskgroup taskgroup) {
|
||||
taskSeriesService.deleteTaskSerieByTaskgroup(taskgroup);
|
||||
taskScheduleService.deleteSchedulesByTaskgroup(taskgroup);
|
||||
taskRepository.deleteTaskHierarchyWhereTaskgroup(taskgroup);
|
||||
taskRepository.deleteAllByTaskgroup(taskgroup);
|
||||
}
|
||||
|
||||
@ -103,21 +123,20 @@ public class TaskService {
|
||||
task.finish();
|
||||
taskRepository.save(task);
|
||||
|
||||
/*List<BasicTaskSchedule> removedBasicTaskSchedules = new LinkedList<>();
|
||||
for(BasicTaskSchedule basicTaskSchedule : task.getBasicTaskSchedules()) {
|
||||
|
||||
List<AbstractSchedule> removedBasicTaskSchedules = new LinkedList<>();
|
||||
for(AbstractSchedule basicTaskSchedule : task.getBasicTaskSchedules()) {
|
||||
if(basicTaskSchedule.getStartTime() == null) {
|
||||
removedBasicTaskSchedules.add(basicTaskSchedule);
|
||||
} else if(basicTaskSchedule.getFinishedTime() == null) {
|
||||
} else if(basicTaskSchedule.getStopTime() == null) {
|
||||
ServiceResult<?> result = taskScheduleService.stopSchedule(basicTaskSchedule, true);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
||||
for(BasicTaskSchedule deletedTaskSchedule: removedBasicTaskSchedules) {
|
||||
task.getBasicTaskSchedules().remove(deletedTaskSchedule);
|
||||
taskRepository.save(task);
|
||||
taskScheduleService.deleteBasicSchedule(deletedTaskSchedule);
|
||||
}*/
|
||||
task.getBasicTaskSchedules().removeAll(removedBasicTaskSchedules);
|
||||
taskRepository.save(task);
|
||||
taskScheduleService.deleteSchedules(removedBasicTaskSchedules);
|
||||
}
|
||||
|
||||
public List<Task> loadAllTasks(String username, TaskScope scope) {
|
||||
@ -140,4 +159,9 @@ public class TaskService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ServiceExitCode clearSubTasks(Task parentTask) {
|
||||
taskRepository.deleteTasksByParent(parentTask);
|
||||
return ServiceExitCode.OK;
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,12 @@ public class TaskgroupService {
|
||||
|
||||
private final TaskgroupRepository taskgroupRepository;
|
||||
private final UserRepository userRepository;
|
||||
private final TaskService taskService;
|
||||
public TaskgroupService(@Autowired TaskgroupRepository taskgroupRepository,
|
||||
@Autowired UserRepository userRepository) {
|
||||
@Autowired UserRepository userRepository, @Autowired TaskService taskService) {
|
||||
this.taskgroupRepository = taskgroupRepository;
|
||||
this.userRepository = userRepository;
|
||||
this.taskService = taskService;
|
||||
}
|
||||
|
||||
public PermissionResult<Taskgroup> getTaskgroupByIDAndUsername(long taskgroupID, String username) {
|
||||
@ -97,6 +99,7 @@ public class TaskgroupService {
|
||||
}
|
||||
|
||||
public void deleteTaskgroup(Taskgroup taskgroup) {
|
||||
taskService.clearTasks(taskgroup);
|
||||
taskgroupRepository.delete(taskgroup);
|
||||
}
|
||||
|
||||
@ -107,4 +110,8 @@ public class TaskgroupService {
|
||||
public void deleteTaskgroupByUser(User user) {
|
||||
taskgroupRepository.deleteAllByUser(user);
|
||||
}
|
||||
|
||||
public List<Taskgroup> getTaskgroupsByUser(String name) {
|
||||
return taskgroupRepository.findAllByUser(name);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package core.services;
|
||||
import core.api.models.account.AccountDeleteRequest;
|
||||
import core.api.models.account.EmailChangeRequest;
|
||||
import core.api.models.account.PasswordChangeRequest;
|
||||
import core.api.models.users.NtfyInformation;
|
||||
import core.api.models.users.UserAddInfo;
|
||||
import core.api.models.users.UserInfo;
|
||||
import core.api.models.users.UserUpdateInfo;
|
||||
@ -152,4 +153,13 @@ public class UserService {
|
||||
userRepository.deleteByUsername(username);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void editNtfyInformation(User user, NtfyInformation ntfyInformation) {
|
||||
user.setNtfy_host(ntfyInformation.getNtfy_host());
|
||||
user.setNtfy_topic(ntfyInformation.getNtfy_topic());
|
||||
user.setNtfy_username(ntfyInformation.getNtfy_user());
|
||||
user.setNtfy_token(ntfyInformation.getNtfy_token());
|
||||
|
||||
userRepository.save(user);
|
||||
}
|
||||
}
|
||||
|
29
backend/src/main/java/core/services/ntfy/NtfyTask.java
Normal file
29
backend/src/main/java/core/services/ntfy/NtfyTask.java
Normal file
@ -0,0 +1,29 @@
|
||||
package core.services.ntfy;
|
||||
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
public class NtfyTask implements Job {
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
HttpClient httpClient = HttpClient.newHttpClient();
|
||||
|
||||
try {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(new URI("http://localhost:4280/Test"))
|
||||
.POST(HttpRequest.BodyPublishers.ofString(jobExecutionContext.getMergedJobDataMap().getString("data")))
|
||||
.build();
|
||||
|
||||
httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package core.services.ntfy;
|
||||
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
|
||||
public class NtfyTaskStartNotification implements Job {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
HttpClient httpClient = HttpClient.newHttpClient();
|
||||
String msg = "Task " + jobExecutionContext.getMergedJobDataMap().getString("task") + " should have been started by now!";
|
||||
|
||||
|
||||
try {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(new URI(jobExecutionContext.getMergedJobDataMap().getString("ntfy_host") + "/Test"))
|
||||
.POST(HttpRequest.BodyPublishers.ofString(msg))
|
||||
.header("Tags", "warning")
|
||||
.header("Title", "Task Starting Reminder")
|
||||
.header("Actions", "view, Open TimeScheduler, "+jobExecutionContext.getMergedJobDataMap().getString("frontend_domain")+", clear=true")
|
||||
.build();
|
||||
|
||||
httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package core.services.ntfy;
|
||||
|
||||
|
||||
import core.entities.User;
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.entities.timemanager.AdvancedTaskSchedule;
|
||||
import core.repositories.timemanager.ScheduleRepository;
|
||||
import core.repositories.timemanager.TaskRepository;
|
||||
import core.services.TaskScheduleService;
|
||||
import org.quartz.*;
|
||||
import org.quartz.impl.StdSchedulerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TaskSchedulingService {
|
||||
|
||||
@Value("${frontend.domain}")
|
||||
private String frontend_domain;
|
||||
|
||||
@Autowired private TaskScheduleService taskScheduleService;
|
||||
|
||||
private Scheduler scheduler;
|
||||
|
||||
public void scheduleStartingTask(AdvancedTaskSchedule advancedTaskSchedule) throws SchedulerException {
|
||||
scheduler = StdSchedulerFactory.getDefaultScheduler();
|
||||
scheduler.start();
|
||||
|
||||
JobDetail job = JobBuilder.newJob(NtfyTaskStartNotification.class)
|
||||
.withIdentity(String.valueOf(advancedTaskSchedule.getScheduleID()))
|
||||
.build();
|
||||
job.getJobDataMap().put("task", advancedTaskSchedule.getTask().getTaskName());
|
||||
job.getJobDataMap().put("ntfy_host", advancedTaskSchedule.getTask().getTaskgroup().getUser().getNtfy_host());
|
||||
job.getJobDataMap().put("ntfy_topic", advancedTaskSchedule.getTask().getTaskgroup().getUser().getNtfy_topic());
|
||||
job.getJobDataMap().put("frontend_domain", frontend_domain);
|
||||
|
||||
Trigger trigger = TriggerBuilder.newTrigger().startAt(calculateDelayInMillis(advancedTaskSchedule.getScheduleStart())).build();
|
||||
|
||||
scheduler.scheduleJob(job, trigger);
|
||||
}
|
||||
|
||||
public void sendRunningTaskNotification(AbstractSchedule abstractSchedule) {
|
||||
HttpClient httpClient = HttpClient.newHttpClient();
|
||||
User user = abstractSchedule.getTask().getTaskgroup().getUser();
|
||||
if(user.getNtfy_host() != null && user.getNtfy_topic() != null) {
|
||||
try {
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(new URI(user.getNtfy_host()+ "/" + user.getNtfy_topic()))
|
||||
.POST(HttpRequest.BodyPublishers.ofString("Running Task " + abstractSchedule.getTask().getTaskName()))
|
||||
.header("Tags", "heavy_check_mark")
|
||||
.header("Title", "Task Running")
|
||||
.header("Actions", "view, Open TimeScheduler, "+frontend_domain+", clear=true")
|
||||
.build();
|
||||
|
||||
httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Date calculateDelayInMillis(LocalDateTime executionTime) {
|
||||
return Date.from(executionTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 0 * * *")
|
||||
public void scheduleStartReminders() throws SchedulerException {
|
||||
List<AdvancedTaskSchedule> advancedTaskSchedules = taskScheduleService.findSchedulesByDate(LocalDate.now());
|
||||
for(AdvancedTaskSchedule advancedTaskSchedule : advancedTaskSchedules) {
|
||||
if(advancedTaskSchedule.getTask().getTaskgroup().getUser().getNtfy_host() != null) {
|
||||
scheduleStartingTask(advancedTaskSchedule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stopStartReminderNotification(AdvancedTaskSchedule schedule) throws SchedulerException {
|
||||
scheduler.deleteJob(JobKey.jobKey(String.valueOf(schedule.getScheduleID())));
|
||||
}
|
||||
}
|
15
backend/src/main/java/util/Tripel.java
Normal file
15
backend/src/main/java/util/Tripel.java
Normal file
@ -0,0 +1,15 @@
|
||||
package util;
|
||||
|
||||
public class Tripel<A,B,C> extends Tupel<A, B> {
|
||||
|
||||
private final C value02;
|
||||
|
||||
public Tripel(A value00, B value01, C value02) {
|
||||
super(value00, value01);
|
||||
this.value02 = value02;
|
||||
}
|
||||
|
||||
public C getValue02() {
|
||||
return value02;
|
||||
}
|
||||
}
|
20
backend/src/main/java/util/Tupel.java
Normal file
20
backend/src/main/java/util/Tupel.java
Normal file
@ -0,0 +1,20 @@
|
||||
package util;
|
||||
|
||||
public class Tupel <A, B>{
|
||||
|
||||
private final A value00;
|
||||
private final B value01;
|
||||
|
||||
public Tupel(A value00, B value01) {
|
||||
this.value00 = value00;
|
||||
this.value01 = value01;
|
||||
}
|
||||
|
||||
public A getValue00() {
|
||||
return value00;
|
||||
}
|
||||
|
||||
public B getValue01() {
|
||||
return value01;
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ spring.jpa.open-in-view=false
|
||||
|
||||
|
||||
|
||||
|
||||
# Spring Data Rest Setup
|
||||
spring.data.rest.base-path=/api
|
||||
|
||||
@ -43,3 +44,7 @@ demo.webapp.jwtSecret=demoWebappSecretKey
|
||||
demo.webapp.jwtExpirationMS=86400000
|
||||
spring.jackson.time-zone=UTC
|
||||
server.servlet.session.cookie.samesite=None
|
||||
|
||||
ntfy.host=http://localhost:4280
|
||||
ntfy.topic=Test
|
||||
frontend.domain=http://localhost:4200
|
@ -1,13 +0,0 @@
|
||||
package core;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/*@SpringBootTest*/
|
||||
class DemoApplicationTests {
|
||||
|
||||
/*@Test
|
||||
void contextLoads() {
|
||||
}*/
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
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());
|
||||
}
|
||||
}
|
@ -1,321 +0,0 @@
|
||||
package core.schedules;
|
||||
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleFieldInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.AdvancedScheduleInfo;
|
||||
import core.api.models.timemanager.taskSchedule.scheduleInfos.BasicScheduleFieldInfo;
|
||||
import core.api.models.timemanager.taskSchedule.ForgottenScheduleInfo;
|
||||
import core.entities.timemanager.AbstractSchedule;
|
||||
import core.entities.timemanager.AdvancedTaskSchedule;
|
||||
import core.entities.timemanager.BasicTaskSchedule;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.services.ServiceExitCode;
|
||||
import core.services.ServiceResult;
|
||||
import core.services.TaskScheduleService;
|
||||
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);
|
||||
|
||||
//Situation 4: Reschedule already running schedule
|
||||
ServiceResult<AbstractSchedule> result_4 = taskScheduleService.editBasicSchedule(entityManager.find(BasicTaskSchedule.class, 4L),
|
||||
new BasicScheduleFieldInfo(LocalDate.now()));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_4.getExitCode());
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
//Situation 4: Running Advanced Schedule
|
||||
ServiceResult<AbstractSchedule> result_4 = taskScheduleService.scheduleNow(entityManager.find(Task.class, 17L));
|
||||
assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, result_4.getExitCode());
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql"),
|
||||
@Sql("classpath:basicScheduleEntries.sql")
|
||||
})
|
||||
void scheduleAdvanced() {
|
||||
//Situation 1: Schedule finished Task
|
||||
ServiceResult<AbstractSchedule> result_1 = taskScheduleService.scheduleAdvanced(entityManager.find(Task.class, 18L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().plusHours(1L), LocalDateTime.now().plusHours(2L)));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_1.getExitCode());
|
||||
|
||||
//Situation 2: Schedule Start is before today
|
||||
ServiceResult<AbstractSchedule> result_2 = taskScheduleService.scheduleAdvanced(entityManager.find(Task.class, 17L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().minusDays(1L), LocalDateTime.now().plusHours(2L)));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_2.getExitCode());
|
||||
|
||||
//Situation 3: Schedule End is before today
|
||||
ServiceResult<AbstractSchedule> result_3 = taskScheduleService.scheduleAdvanced(entityManager.find(Task.class, 17L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().minusDays(2L), LocalDateTime.now().minusDays(1L)));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_3.getExitCode());
|
||||
|
||||
//Situation 4: Start after stop
|
||||
ServiceResult<AbstractSchedule> result_4 = taskScheduleService.scheduleAdvanced(entityManager.find(Task.class, 17L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().plusHours(2L), LocalDateTime.now().plusHours(1L)));
|
||||
assertEquals(ServiceExitCode.INVALID_PARAMETER, result_4.getExitCode());
|
||||
|
||||
//Situation 5: Valid schedule
|
||||
ServiceResult<AbstractSchedule> result_5 = taskScheduleService.scheduleAdvanced(entityManager.find(Task.class, 17L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now(), LocalDateTime.now().plusHours(1L)));
|
||||
assertEquals(ServiceExitCode.OK, result_5.getExitCode());
|
||||
assertThat(entityManager.find(AdvancedTaskSchedule.class, result_5.getResult().getScheduleID())).isNotNull();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql"),
|
||||
@Sql("classpath:basicScheduleEntries.sql")
|
||||
})
|
||||
void editscheduleAdvanced() {
|
||||
//Situation 1: Schedule finished Task
|
||||
ServiceResult<AbstractSchedule> result_1 = taskScheduleService.editAdvancedSchedule(entityManager.find(AdvancedTaskSchedule.class, 12L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().plusHours(1L), LocalDateTime.now().plusHours(2L)));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_1.getExitCode());
|
||||
|
||||
//Situation 2: Schedule Start is before today
|
||||
ServiceResult<AbstractSchedule> result_2 = taskScheduleService.editAdvancedSchedule(entityManager.find(AdvancedTaskSchedule.class, 11L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().minusDays(1L), LocalDateTime.now().plusHours(2L)));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_2.getExitCode());
|
||||
|
||||
//Situation 3: Schedule End is before today
|
||||
ServiceResult<AbstractSchedule> result_3 = taskScheduleService.editAdvancedSchedule(entityManager.find(AdvancedTaskSchedule.class, 11L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().minusDays(2L), LocalDateTime.now().minusDays(1L)));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_3.getExitCode());
|
||||
|
||||
//Situation 4: Start after stop
|
||||
ServiceResult<AbstractSchedule> result_4 = taskScheduleService.editAdvancedSchedule(entityManager.find(AdvancedTaskSchedule.class, 11L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now().plusHours(2L), LocalDateTime.now().plusHours(1L)));
|
||||
assertEquals(ServiceExitCode.INVALID_PARAMETER, result_4.getExitCode());
|
||||
|
||||
//Situation 5: Valid schedule
|
||||
ServiceResult<AbstractSchedule> result_5 = taskScheduleService.editAdvancedSchedule(entityManager.find(AdvancedTaskSchedule.class, 11L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now(), LocalDateTime.now().plusHours(1L)));
|
||||
assertEquals(ServiceExitCode.OK, result_5.getExitCode());
|
||||
assertThat(entityManager.find(AdvancedTaskSchedule.class, result_5.getResult().getScheduleID())).isNotNull();
|
||||
|
||||
//Situation 6: reschedule already running schedule
|
||||
ServiceResult<AbstractSchedule> result_6 = taskScheduleService.editAdvancedSchedule(entityManager.find(AdvancedTaskSchedule.class, 9L),
|
||||
new AdvancedScheduleFieldInfo(LocalDateTime.now(), LocalDateTime.now().plusHours(1L)));
|
||||
assertEquals(ServiceExitCode.INVALID_OPERATION, result_6.getExitCode());
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
package core.taskgroups;
|
||||
|
||||
import core.entities.User;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.repositories.timemanager.TaskgroupRepository;
|
||||
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.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@DataJpaTest
|
||||
public class TaskgroupRepsitoryTest {
|
||||
|
||||
@Autowired private TaskgroupRepository taskgroupRepository;
|
||||
@Autowired private TestEntityManager testEntityManager;
|
||||
|
||||
@Test
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql")
|
||||
void findAllByUser() {
|
||||
User testUser1 = testEntityManager.find(User.class, 1L);
|
||||
User testUser2 = testEntityManager.find(User.class, 2L);
|
||||
|
||||
List<Taskgroup> result_user2 = taskgroupRepository.findAllByUser(testUser2.getUsername());
|
||||
assertEquals(0, result_user2.size());
|
||||
|
||||
List<Taskgroup> result_user1 = taskgroupRepository.findAllByUser(testUser1.getUsername());
|
||||
assertEquals(8, result_user1.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql")
|
||||
void findAllTopTaskgroupsByUser() {
|
||||
User testUser1 = testEntityManager.find(User.class, 1L);
|
||||
User testUser2 = testEntityManager.find(User.class, 2L);
|
||||
|
||||
//Situation 1: Empty user, no taskgroups
|
||||
assertEquals(0, taskgroupRepository.findAllTopTaskgroupsByUser(testUser2.getUsername()).size());
|
||||
|
||||
//Situation 2: Only top taskgroups are returned
|
||||
List<Taskgroup> topgroups_user1 = taskgroupRepository.findAllTopTaskgroupsByUser(testUser1.getUsername());
|
||||
assertEquals(3, topgroups_user1.size());
|
||||
assertTrue(topgroups_user1.contains(testEntityManager.find(Taskgroup.class, 1L)));
|
||||
assertTrue(topgroups_user1.contains(testEntityManager.find(Taskgroup.class, 2L)));
|
||||
assertTrue(topgroups_user1.contains(testEntityManager.find(Taskgroup.class, 5L)));
|
||||
|
||||
//Situation 3: User with username does not exist
|
||||
assertEquals(0, taskgroupRepository.findAllTopTaskgroupsByUser("Rotzbakke").size());
|
||||
}
|
||||
@Test
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql")
|
||||
void deleteAllByUser() {
|
||||
User testUser1 = testEntityManager.find(User.class, 1L);
|
||||
User testUser2 = testEntityManager.find(User.class, 2L);
|
||||
|
||||
taskgroupRepository.deleteAllByUser(testUser2);
|
||||
for(long i=1; i<=8; i++) {
|
||||
assertThat(testEntityManager.find(Taskgroup.class, i)).isNotNull();
|
||||
}
|
||||
|
||||
taskgroupRepository.deleteAllByUser(testUser1);
|
||||
for(long i=1; i<=8; i++) {
|
||||
assertThat(testEntityManager.find(Taskgroup.class, i)).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql")
|
||||
void delete() {
|
||||
Taskgroup no_children = testEntityManager.find(Taskgroup.class, 1L);
|
||||
Taskgroup taskgroup_with_children = testEntityManager.find(Taskgroup.class, 5L);
|
||||
|
||||
taskgroupRepository.delete(no_children);
|
||||
assertThat(testEntityManager.find(Taskgroup.class, 1L)).isNull();
|
||||
for(long i=2; i<=8; i++) {
|
||||
assertThat(testEntityManager.find(Taskgroup.class, i)).isNotNull();
|
||||
}
|
||||
|
||||
taskgroupRepository.delete(taskgroup_with_children);
|
||||
for(long i=5; i<=8; i++) {
|
||||
assertThat(testEntityManager.find(Taskgroup.class, i)).isNull();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,202 +0,0 @@
|
||||
package core.taskgroups;
|
||||
|
||||
import core.api.models.timemanager.taskgroup.TaskgroupFieldInfo;
|
||||
import core.entities.User;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.repositories.UserRepository;
|
||||
import core.repositories.timemanager.TaskgroupRepository;
|
||||
import core.services.PermissionResult;
|
||||
import core.services.ServiceExitCode;
|
||||
import core.services.ServiceResult;
|
||||
import core.services.TaskgroupService;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
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.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.jdbc.Sql;
|
||||
import org.springframework.test.context.jdbc.SqlGroup;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
@Transactional
|
||||
public class TaskgroupServiceTest {
|
||||
|
||||
@Autowired
|
||||
private TaskgroupRepository taskgroupRepository;
|
||||
@Autowired
|
||||
private TaskgroupService taskgroupService;
|
||||
@Autowired
|
||||
private EntityManager entityManager;
|
||||
|
||||
private static final String username = "Testuser1";
|
||||
private static final String username2 = "Testuser2";
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void getTaskgroupByIDAndUsername() {
|
||||
//Situation 1: correct taskgroup and username
|
||||
assertFalse(taskgroupRepository.findById(1L).isEmpty());
|
||||
|
||||
PermissionResult<Taskgroup> permissionResult = taskgroupService.getTaskgroupByIDAndUsername(1L, username);
|
||||
assertThat(permissionResult).isNotNull();
|
||||
assertTrue(permissionResult.isHasPermissions());
|
||||
assertEquals(ServiceExitCode.OK, permissionResult.getExitCode());
|
||||
assertEquals(taskgroupRepository.findById(1L).get(), permissionResult.getResult());
|
||||
|
||||
//Situation 2: invalid taskgroup
|
||||
PermissionResult<Taskgroup> invalid_group = taskgroupService.getTaskgroupByIDAndUsername(-1L, username);
|
||||
assertThat(invalid_group).isNotNull();
|
||||
assertEquals(ServiceExitCode.MISSING_ENTITY, invalid_group.getExitCode());
|
||||
assertFalse(invalid_group.isHasPermissions());
|
||||
|
||||
//Situation 3: invalid user
|
||||
PermissionResult<Taskgroup> invalid_user = taskgroupService.getTaskgroupByIDAndUsername(1L, "Rotzbakke");
|
||||
assertThat(invalid_user).isNotNull();
|
||||
assertEquals(ServiceExitCode.OK, invalid_user.getExitCode());
|
||||
assertFalse(invalid_user.isHasPermissions());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void addTaskgroup() {
|
||||
TaskgroupFieldInfo taskgroupFieldInfo = new TaskgroupFieldInfo("Taskgroup", -1);
|
||||
//Situation 1: No such user
|
||||
assertThrows(NoSuchElementException.class, () -> taskgroupService.addTaskgroup(taskgroupFieldInfo, "Rotzbakke"));
|
||||
|
||||
//Situation 2: Taskgroup already exists
|
||||
Taskgroup taskgroup = taskgroupRepository.findById(1L).get();
|
||||
ServiceResult<Taskgroup> creationResult = taskgroupService.addTaskgroup(new TaskgroupFieldInfo(taskgroup.getTaskgroupName(), -1), username);
|
||||
assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, creationResult.getExitCode());
|
||||
assertThat(creationResult.getResult()).isNull();
|
||||
|
||||
//Situation 3: Taskgroup does not exist, no parent
|
||||
ServiceResult<Taskgroup> creationResult_3 = taskgroupService.addTaskgroup(taskgroupFieldInfo, username);
|
||||
assertEquals(ServiceExitCode.OK, creationResult_3.getExitCode());
|
||||
assertTrue(taskgroupRepository.existsById(creationResult_3.getResult().getTaskgroupID()));
|
||||
|
||||
//Situation 4: Taskgroup does not exist, with parent; invalid parent (no existent)
|
||||
ServiceResult<Taskgroup> creationResult_4 = taskgroupService.addTaskgroup(new TaskgroupFieldInfo("Situation 4", 100L), username);
|
||||
assertEquals(ServiceExitCode.MISSING_ENTITY, creationResult_4.getExitCode());
|
||||
|
||||
//Situation 5: Taskgroup does not exist, parent exist
|
||||
ServiceResult<Taskgroup> creationResult_5 = taskgroupService.addTaskgroup(new TaskgroupFieldInfo("Situation 5", 2L), username);
|
||||
assertEquals(ServiceExitCode.OK, creationResult_5.getExitCode());
|
||||
assertTrue(taskgroupRepository.existsById(creationResult_5.getResult().getTaskgroupID()));
|
||||
|
||||
//Situation 6: taskgroup exist on another user
|
||||
ServiceResult<Taskgroup> creationResult_6 = taskgroupService.addTaskgroup(new TaskgroupFieldInfo(taskgroup.getTaskgroupName(), -1), username2);
|
||||
assertEquals(ServiceExitCode.OK, creationResult_6.getExitCode());
|
||||
assertTrue(taskgroupRepository.existsById(creationResult_6.getResult().getTaskgroupID()));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void editTaskgroup() {
|
||||
Taskgroup taskgroup = taskgroupRepository.findById(1L).get();
|
||||
//Situation 1: Nothing changed
|
||||
ServiceExitCode exitCode_1 = taskgroupService.editTaskgroup(taskgroup, new TaskgroupFieldInfo(taskgroup.getTaskgroupName(),-1));
|
||||
assertEquals(ServiceExitCode.OK, exitCode_1);
|
||||
|
||||
//Situation 2: Name is already taken
|
||||
ServiceExitCode exitCode_2 = taskgroupService.editTaskgroup(taskgroup, new TaskgroupFieldInfo("Taskgroup 1", -1));
|
||||
assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, exitCode_2);
|
||||
|
||||
//Situation 3: All fine
|
||||
ServiceExitCode exitCode_3 = taskgroupService.editTaskgroup(taskgroup, new TaskgroupFieldInfo("Situation 3", -1));
|
||||
assertEquals(ServiceExitCode.OK, exitCode_3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void deleteTaskgroup() {
|
||||
taskgroupService.deleteTaskgroup(entityManager.find(Taskgroup.class, 1L));
|
||||
assertThat(entityManager.find(Taskgroup.class, 1L)).isNull();
|
||||
|
||||
taskgroupService.deleteTaskgroup(entityManager.find(Taskgroup.class, 2L));
|
||||
assertThat(entityManager.find(Taskgroup.class, 2L)).isNull();
|
||||
assertThat(entityManager.find(Taskgroup.class, 3L)).isNull();
|
||||
for(long i=1; i<=14; i++) {
|
||||
assertThat(entityManager.find(Task.class, i)).isNull();
|
||||
}
|
||||
|
||||
taskgroupService.deleteTaskgroup(entityManager.find(Taskgroup.class, 5L));
|
||||
assertThat(entityManager.find(Taskgroup.class, 5L)).isNull();
|
||||
assertThat(entityManager.find(Taskgroup.class, 6L)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void getTopTaskgroupsByUser() {
|
||||
//Situation 1: User without taskgroups
|
||||
List<Taskgroup> taskgroups_user2 = taskgroupService.getTopTaskgroupsByUser(username2);
|
||||
assertEquals(0, taskgroups_user2.size());
|
||||
|
||||
|
||||
//Situation 2: user with taskgroups
|
||||
List<Taskgroup> taskgroups_user1 = taskgroupService.getTopTaskgroupsByUser(username);
|
||||
assertEquals(3, taskgroups_user1.size());
|
||||
assertTrue(taskgroups_user1.contains(entityManager.find(Taskgroup.class, 1L)));
|
||||
assertTrue(taskgroups_user1.contains(entityManager.find(Taskgroup.class, 2L)));
|
||||
assertTrue(taskgroups_user1.contains(entityManager.find(Taskgroup.class, 5L)));
|
||||
|
||||
//Situation 3: No existent username
|
||||
assertEquals(0, taskgroupService.getTopTaskgroupsByUser("Rotzbakke").size());
|
||||
}
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void deleteTaskgroupByUser() {
|
||||
User referenceUser1 = entityManager.find(User.class, 1L);
|
||||
User referenceUser2 = entityManager.find(User.class, 2L);
|
||||
|
||||
taskgroupService.deleteTaskgroupByUser(referenceUser2);
|
||||
for(long i=1; i<=8; i++) {
|
||||
assertThat(entityManager.find(Taskgroup.class, i)).isNotNull();
|
||||
}
|
||||
|
||||
taskgroupService.deleteTaskgroupByUser(referenceUser1);
|
||||
for(long i=1; i<=8; i++) {
|
||||
assertThat(entityManager.find(Taskgroup.class, i)).isNull();
|
||||
}
|
||||
for(long i=1; i<=14; i++) {
|
||||
assertThat(entityManager.find(Task.class, i)).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
package core.tasks;
|
||||
|
||||
import core.entities.User;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.repositories.timemanager.TaskRepository;
|
||||
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.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@DataJpaTest
|
||||
public class TaskRepositoryTest {
|
||||
|
||||
@Autowired private TaskRepository taskRepository;
|
||||
@Autowired private TestEntityManager testEntityManager;
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void findAllByUser() {
|
||||
User testUser1 = testEntityManager.find(User.class, 1L);
|
||||
User testUser2 = testEntityManager.find(User.class, 2L);
|
||||
|
||||
//Situation 1: Non existent user
|
||||
assertEquals(0, taskRepository.findAllByUser("Rotzbakke", true).size());
|
||||
assertEquals(0, taskRepository.findAllByUser("Rotzbakke", false).size());
|
||||
|
||||
//Situation 2: User with no tasks at all
|
||||
assertEquals(0, taskRepository.findAllByUser(testUser2.getUsername(), false).size());
|
||||
assertEquals(0, taskRepository.findAllByUser(testUser2.getUsername(), true).size());
|
||||
|
||||
//Situation 3: User with finished and unfinished tasks
|
||||
List<Task> tasks_user1_false = taskRepository.findAllByUser(testUser1.getUsername(), false);
|
||||
List<Task> tasks_user1_true = taskRepository.findAllByUser(testUser1.getUsername(), true);
|
||||
assertEquals(7, tasks_user1_true.size());
|
||||
assertEquals(8, tasks_user1_false.size());
|
||||
|
||||
assertTrue(tasks_user1_false.contains(testEntityManager.find(Task.class, 1L)));
|
||||
assertTrue(tasks_user1_false.contains(testEntityManager.find(Task.class, 3L)));
|
||||
assertTrue(tasks_user1_false.contains(testEntityManager.find(Task.class, 5L)));
|
||||
assertTrue(tasks_user1_false.contains(testEntityManager.find(Task.class, 7L)));
|
||||
assertTrue(tasks_user1_false.contains(testEntityManager.find(Task.class, 9L)));
|
||||
assertTrue(tasks_user1_false.contains(testEntityManager.find(Task.class, 11L)));
|
||||
assertTrue(tasks_user1_false.contains(testEntityManager.find(Task.class, 12L)));
|
||||
|
||||
assertTrue(tasks_user1_true.contains(testEntityManager.find(Task.class, 2L)));
|
||||
assertTrue(tasks_user1_true.contains(testEntityManager.find(Task.class, 4L)));
|
||||
assertTrue(tasks_user1_true.contains(testEntityManager.find(Task.class, 6L)));
|
||||
assertTrue(tasks_user1_true.contains(testEntityManager.find(Task.class, 8L)));
|
||||
assertTrue(tasks_user1_true.contains(testEntityManager.find(Task.class, 10L)));
|
||||
assertTrue(tasks_user1_true.contains(testEntityManager.find(Task.class, 13L)));
|
||||
assertTrue(tasks_user1_true.contains(testEntityManager.find(Task.class, 14L)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void deleteAllByTaskgroup() {
|
||||
Taskgroup taskgroup_no_tasks = testEntityManager.find(Taskgroup.class, 1L);
|
||||
taskRepository.deleteAllByTaskgroup(taskgroup_no_tasks);
|
||||
|
||||
for(long i=1; i<=14; i++) {
|
||||
assertThat(testEntityManager.find(Task.class, i)).isNotNull();
|
||||
}
|
||||
|
||||
Taskgroup taskgroup_with_task = testEntityManager.find(Taskgroup.class, 2L);
|
||||
taskRepository.deleteAllByTaskgroup(taskgroup_with_task);
|
||||
for(long i=1; i<=14; i++) {
|
||||
Task task = testEntityManager.find(Task.class, i);
|
||||
assertThat(task).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void deleteByTaskID() {
|
||||
taskRepository.deleteByTaskID(-1);
|
||||
for(long i=1; i<=14; i++) {
|
||||
assertThat(testEntityManager.find(Task.class, i)).isNotNull();
|
||||
}
|
||||
|
||||
taskRepository.deleteByTaskID(1);
|
||||
assertThat(testEntityManager.find(Task.class, 1L)).isNull();
|
||||
for(long i=2; i<=14; i++) {
|
||||
assertThat(testEntityManager.find(Task.class, i)).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void findAllOverdue() {
|
||||
User testuser1 = testEntityManager.find(User.class, 1L);
|
||||
LocalDate referenceDate = LocalDate.of(2023, 10, 11);
|
||||
|
||||
List<Task> overdue = taskRepository.findAllOverdue(testuser1.getUsername(), referenceDate);
|
||||
assertEquals(2, overdue.size());
|
||||
assertTrue(overdue.contains(testEntityManager.find(Task.class, 3L)));
|
||||
assertTrue(overdue.contains(testEntityManager.find(Task.class, 5L)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void findAllUpcoming() {
|
||||
User testuser1 = testEntityManager.find(User.class, 1L);
|
||||
LocalDate referenceDate = LocalDate.of(2023, 10, 11);
|
||||
|
||||
List<Task> upcoming = taskRepository.findAllUpcoming(testuser1.getUsername(), referenceDate);
|
||||
assertEquals(2, upcoming.size());
|
||||
assertTrue(upcoming.contains(testEntityManager.find(Task.class, 7L)));
|
||||
assertTrue(upcoming.contains(testEntityManager.find(Task.class, 9L)));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void findAllActive() {
|
||||
User testuser1 = testEntityManager.find(User.class, 1L);
|
||||
LocalDate referenceDate = LocalDate.of(2023, 10, 11);
|
||||
|
||||
List<Task> active = taskRepository.findAllActive(testuser1.getUsername(), referenceDate);
|
||||
//1,3,5,11,12
|
||||
assertEquals(6, active.size());
|
||||
assertTrue(active.contains(testEntityManager.find(Task.class, 1L)));
|
||||
assertTrue(active.contains(testEntityManager.find(Task.class, 3L)));
|
||||
assertTrue(active.contains(testEntityManager.find(Task.class, 5L)));
|
||||
assertTrue(active.contains(testEntityManager.find(Task.class, 11L)));
|
||||
assertTrue(active.contains(testEntityManager.find(Task.class, 12L)));
|
||||
}
|
||||
|
||||
}
|
@ -1,278 +0,0 @@
|
||||
package core.tasks;
|
||||
|
||||
import core.api.models.timemanager.tasks.TaskFieldInfo;
|
||||
import core.api.models.timemanager.tasks.TaskScope;
|
||||
import core.entities.timemanager.Task;
|
||||
import core.entities.timemanager.Taskgroup;
|
||||
import core.repositories.timemanager.TaskRepository;
|
||||
import core.repositories.timemanager.TaskgroupRepository;
|
||||
import core.services.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
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.util.List;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
@Transactional
|
||||
public class TaskServiceTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private EntityManager entityManager;
|
||||
|
||||
private static final String username = "Testuser1";
|
||||
private static final String username2 = "Testuser2";
|
||||
@Autowired
|
||||
private TaskRepository taskRepository;
|
||||
@Autowired
|
||||
private TaskgroupRepository taskgroupRepository;
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void createTask() {
|
||||
//Situation 1: Task with that name already exists in a taskgroup
|
||||
TaskFieldInfo taskFieldInfo_1 = new TaskFieldInfo(entityManager.find(Task.class, 1L).getTaskName(), 0, null, null);
|
||||
ServiceResult<Task> situation_1 = taskService.createTask(entityManager.find(Taskgroup.class, 2L), taskFieldInfo_1);
|
||||
assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, situation_1.getExitCode());
|
||||
|
||||
//Situation 2: Task with that name exists in another taskgroup
|
||||
TaskFieldInfo taskFieldInfo_2 = new TaskFieldInfo(entityManager.find(Task.class, 1L).getTaskName(), 0, null, null);
|
||||
ServiceResult<Task> result_2 = taskService.createTask(entityManager.find(Taskgroup.class, 1L), taskFieldInfo_2);
|
||||
assertEquals(ServiceExitCode.OK, result_2.getExitCode());
|
||||
assertThat(entityManager.find(Task.class, result_2.getResult().getTaskID())).isNotNull();
|
||||
|
||||
//Situation 3: Normal, everything fine
|
||||
TaskFieldInfo taskFieldInfo_3 = new TaskFieldInfo("Situation 3", 0, null, null);
|
||||
ServiceResult<Task> result_3 = taskService.createTask(entityManager.find(Taskgroup.class, 1L), taskFieldInfo_3);
|
||||
assertEquals(ServiceExitCode.OK, result_3.getExitCode());
|
||||
assertThat(entityManager.find(Task.class, result_3.getResult().getTaskID())).isNotNull();
|
||||
|
||||
//Robustness - Test for invalid dates
|
||||
//Situation 4: Deadline, no start
|
||||
TaskFieldInfo taskFieldInfo_4 = new TaskFieldInfo("Situation 4", 0, null, LocalDate.now());
|
||||
ServiceResult<Task> result_4 = taskService.createTask(entityManager.find(Taskgroup.class, 1L), taskFieldInfo_4);
|
||||
assertEquals(ServiceExitCode.OK, result_4.getExitCode());
|
||||
assertThat(entityManager.find(Task.class, result_4.getResult().getTaskID())).isNotNull();
|
||||
|
||||
//Situation 5: Start but no deadline
|
||||
TaskFieldInfo taskFieldInfo_5 = new TaskFieldInfo("Situation 5", 0, LocalDate.now(),null);
|
||||
ServiceResult<Task> result_5 = taskService.createTask(entityManager.find(Taskgroup.class, 1L), taskFieldInfo_5);
|
||||
assertEquals(ServiceExitCode.OK, result_5.getExitCode());
|
||||
assertThat(entityManager.find(Task.class, result_5.getResult().getTaskID())).isNotNull();
|
||||
|
||||
//Situation 6: Deadline before start (invalid)
|
||||
TaskFieldInfo taskFieldInfo_6 = new TaskFieldInfo("Situation 6", 0, LocalDate.now(),LocalDate.of(2010, 3, 20));
|
||||
ServiceResult<Task> result_6= taskService.createTask(entityManager.find(Taskgroup.class, 1L), taskFieldInfo_6);
|
||||
assertEquals(ServiceExitCode.INVALID_PARAMETER, result_6.getExitCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void getTaskPermissions() {
|
||||
//Situation 1: correct task and username
|
||||
PermissionResult<Task> permissionResult_1 = taskService.getTaskPermissions(1L, username);
|
||||
assertEquals(ServiceExitCode.OK, permissionResult_1.getExitCode());
|
||||
assertTrue(permissionResult_1.isHasPermissions());
|
||||
assertEquals(entityManager.find(Task.class, 1L), permissionResult_1.getResult());
|
||||
|
||||
//Situation 2: invalid taskgroup
|
||||
PermissionResult<Task> permissionResult_2 = taskService.getTaskPermissions(200L, username);
|
||||
assertEquals(ServiceExitCode.MISSING_ENTITY, permissionResult_2.getExitCode());
|
||||
assertFalse(permissionResult_2.isHasPermissions());
|
||||
assertThat(permissionResult_2.getResult()).isNull();
|
||||
|
||||
//Situation 3: invalid user
|
||||
PermissionResult<Task> permissionResult_3 = taskService.getTaskPermissions(1L, username2);
|
||||
assertEquals(ServiceExitCode.OK, permissionResult_3.getExitCode());
|
||||
assertFalse(permissionResult_2.isHasPermissions());
|
||||
assertEquals(entityManager.find(Task.class, 1L), permissionResult_3.getResult());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void editTask() {
|
||||
//Situation 1: Nothing is updated
|
||||
Task task_1 = entityManager.find(Task.class, 1L);
|
||||
TaskFieldInfo taskFieldInfo_1 = new TaskFieldInfo(entityManager.find(Task.class, 1L).getTaskName(), 0, null, null);
|
||||
ServiceResult<Task> result_1 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_1);
|
||||
assertEquals(ServiceExitCode.OK, result_1.getExitCode());
|
||||
assertEquals(task_1, result_1.getResult());
|
||||
|
||||
//Situation 2: Name is updated to name that already exists within the taskgroup
|
||||
Task task_2 = entityManager.find(Task.class, 1L);
|
||||
TaskFieldInfo taskFieldInfo_2 = new TaskFieldInfo(entityManager.find(Task.class, 2L).getTaskName(), 0, null, null);
|
||||
ServiceResult<Task> result_2 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_2);
|
||||
task_2.setTaskName(entityManager.find(Task.class, 2L).getTaskName());
|
||||
assertEquals(ServiceExitCode.ENTITY_ALREADY_EXIST, result_2.getExitCode());
|
||||
assertNotEquals(task_2, result_2.getResult());
|
||||
|
||||
//Situation 3: Name is updated to nonexistend Name
|
||||
Task task_3 = entityManager.find(Task.class, 1L);
|
||||
TaskFieldInfo taskFieldInfo_3 = new TaskFieldInfo("Situation 3", 0, null, null);
|
||||
ServiceResult<Task> result_3 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_3);
|
||||
task_3.setTaskName("Situation 3");
|
||||
assertEquals(ServiceExitCode.OK, result_3.getExitCode());
|
||||
assertEquals(task_3, result_3.getResult());
|
||||
|
||||
//Situation 4: eta is updated
|
||||
Task task_4 = entityManager.find(Task.class, 1L);
|
||||
TaskFieldInfo taskFieldInfo_4 = new TaskFieldInfo(task_4.getTaskName(), 90, null, null);
|
||||
ServiceResult<Task> result_4 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_4);
|
||||
task_4.setEta(90);
|
||||
assertEquals(ServiceExitCode.OK, result_4.getExitCode());
|
||||
assertEquals(task_4, result_4.getResult());
|
||||
|
||||
//Situation 5: deadline and start is updated in a valid way
|
||||
Task task_5 = entityManager.find(Task.class, 1L);
|
||||
TaskFieldInfo taskFieldInfo_5 = new TaskFieldInfo(task_5.getTaskName(), task_5.getEta(), LocalDate.of(2023, 4, 9), LocalDate.of(2023,5,9));
|
||||
ServiceResult<Task> result_5 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_5);
|
||||
task_5.setStartDate(LocalDate.of(2023,4,9));
|
||||
task_5.setDeadline(LocalDate.of(2023,5,9));
|
||||
assertEquals(ServiceExitCode.OK, result_5.getExitCode());
|
||||
assertEquals(task_5, result_5.getResult());
|
||||
|
||||
//Situation 6: Deadline and start are updated in a not valid way
|
||||
Task task_6 = entityManager.find(Task.class, 1L);
|
||||
TaskFieldInfo taskFieldInfo_6 = new TaskFieldInfo(task_5.getTaskName(), task_5.getEta(), LocalDate.of(2023, 5, 9), LocalDate.of(2023,4,9));
|
||||
ServiceResult<Task> result_6 = taskService.editTask(entityManager.find(Task.class, 1L), taskFieldInfo_6);
|
||||
task_6.setStartDate(LocalDate.of(2023,5,9));
|
||||
task_6.setDeadline(LocalDate.of(2023,4,9));
|
||||
assertEquals(ServiceExitCode.INVALID_PARAMETER, result_6.getExitCode());
|
||||
assertNotEquals(task_6, result_6.getResult());
|
||||
|
||||
//Situation 10 Startdate = null;
|
||||
Task task_10 = entityManager.find(Task.class, 5L);
|
||||
TaskFieldInfo taskFieldInfo_10 = new TaskFieldInfo(task_10.getTaskName(), task_10.getEta(),null, task_10.getDeadline());
|
||||
ServiceResult<Task> result_10 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_10);
|
||||
task_10.setStartDate(null);
|
||||
assertEquals(ServiceExitCode.OK, result_10.getExitCode());
|
||||
assertEquals(task_10, result_10.getResult());
|
||||
|
||||
//Situation 11 Deadline = null
|
||||
Task task_11 = entityManager.find(Task.class, 5L);
|
||||
TaskFieldInfo taskFieldInfo_11 = new TaskFieldInfo(task_11.getTaskName(), task_11.getEta(),task_11.getStartDate(), null);
|
||||
ServiceResult<Task> result_11 = taskService.editTask(entityManager.find(Task.class, 5L), taskFieldInfo_11);
|
||||
task_11.setDeadline(null);
|
||||
assertEquals(ServiceExitCode.OK, result_11.getExitCode());
|
||||
assertEquals(task_11, result_11.getResult());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void deleteTask() {
|
||||
for(long i=1; i<=15; i++) {
|
||||
taskService.deleteTask(entityManager.find(Task.class, i));
|
||||
assertThat(entityManager.find(Task.class, i)).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void clearTasks() {
|
||||
//Situation 1: Delete from taskgroup with no tasks
|
||||
taskService.clearTasks(entityManager.find(Taskgroup.class, 1L));
|
||||
for(long i=1; i<=15; i++) {
|
||||
assertThat(entityManager.find(Task.class, i)).isNotNull();
|
||||
}
|
||||
//Situation 2: Delete from taskgroup with tasks
|
||||
taskService.clearTasks(entityManager.find(Taskgroup.class, 2L));
|
||||
for(long i=1; i<=15; i++) {
|
||||
assertThat(entityManager.find(Task.class, i)).isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void finishTask() {
|
||||
taskService.finishTask(entityManager.find(Task.class, 1L));
|
||||
assertTrue(entityManager.find(Task.class, 1L).isFinished());
|
||||
|
||||
taskService.finishTask(entityManager.find(Task.class, 2L));
|
||||
assertTrue(entityManager.find(Task.class, 1L).isFinished());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SqlGroup({
|
||||
@Sql("classpath:taskgroupRepositoryTestEntries.sql"),
|
||||
@Sql("classpath:taskRepositoryEntries.sql")
|
||||
})
|
||||
void loadAllTasks() {
|
||||
//Situation 1: No tasks existing
|
||||
List<Task> result_1 = taskService.loadAllTasks(username2, TaskScope.UNFINISHED);
|
||||
assertEquals(0, result_1.size());
|
||||
|
||||
//Situation 2: Tasks existing, Unfinished#
|
||||
List<Task> result_2 = taskService.loadAllTasks(username, TaskScope.UNFINISHED);
|
||||
assertEquals(8, result_2.size());
|
||||
assertTrue(result_2.contains(entityManager.find(Task.class, 1L)));
|
||||
assertTrue(result_2.contains(entityManager.find(Task.class, 3L)));
|
||||
assertTrue(result_2.contains(entityManager.find(Task.class, 5L)));
|
||||
assertTrue(result_2.contains(entityManager.find(Task.class, 7L)));
|
||||
assertTrue(result_2.contains(entityManager.find(Task.class, 9L)));
|
||||
assertTrue(result_2.contains(entityManager.find(Task.class, 11L)));
|
||||
assertTrue(result_2.contains(entityManager.find(Task.class, 12L)));
|
||||
|
||||
//Situation 3: Finished tasks
|
||||
List<Task> result_3 = taskService.loadAllTasks(username, TaskScope.FINISHED);
|
||||
assertEquals(7, result_3.size());
|
||||
assertTrue(result_3.contains(entityManager.find(Task.class, 2L)));
|
||||
assertTrue(result_3.contains(entityManager.find(Task.class, 4L)));
|
||||
assertTrue(result_3.contains(entityManager.find(Task.class, 6L)));
|
||||
assertTrue(result_3.contains(entityManager.find(Task.class, 8L)));
|
||||
assertTrue(result_3.contains(entityManager.find(Task.class, 10L)));
|
||||
assertTrue(result_3.contains(entityManager.find(Task.class, 13L)));
|
||||
assertTrue(result_3.contains(entityManager.find(Task.class, 14L)));
|
||||
|
||||
//overdue
|
||||
List<Task> result_4 = taskService.loadAllTasks(username, TaskScope.OVERDUE);
|
||||
assertEquals(2, result_4.size());
|
||||
assertTrue(result_4.contains(entityManager.find(Task.class, 3L)));
|
||||
assertTrue(result_4.contains(entityManager.find(Task.class, 5L)));
|
||||
|
||||
//upcoming
|
||||
List<Task> result_5 = taskService.loadAllTasks(username, TaskScope.UPCOMING);
|
||||
assertEquals(2, result_5.size());
|
||||
assertTrue(result_5.contains(entityManager.find(Task.class, 7L)));
|
||||
assertTrue(result_5.contains(entityManager.find(Task.class, 9L)));
|
||||
//Active
|
||||
List<Task> result_6 = taskService.loadAllTasks(username, TaskScope.ACTIVE);
|
||||
assertEquals(6, result_6.size());
|
||||
assertTrue(result_6.contains(entityManager.find(Task.class, 1L)));
|
||||
assertTrue(result_6.contains(entityManager.find(Task.class, 3L)));
|
||||
assertTrue(result_6.contains(entityManager.find(Task.class, 5L)));
|
||||
assertTrue(result_6.contains(entityManager.find(Task.class, 11L)));
|
||||
assertTrue(result_6.contains(entityManager.find(Task.class, 12L)));
|
||||
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
package core.users;
|
||||
|
||||
import core.entities.User;
|
||||
import core.repositories.UserRepository;
|
||||
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.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.jdbc.Sql;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@DataJpaTest
|
||||
@ExtendWith(SpringExtension.class)
|
||||
public class UserRepositoryTests {
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private TestEntityManager testEntityManager;
|
||||
|
||||
@Test
|
||||
@Sql("classpath:userRepisotoryTestEntries.sql")
|
||||
void test_findByUsername() {
|
||||
//Situation 1: User with name "FawKes100" is present
|
||||
User referenceUser = testEntityManager.find(User.class, 1L);
|
||||
Optional<User> findResult = userRepository.findByUsername(referenceUser.getUsername());
|
||||
assertTrue(findResult.isPresent());
|
||||
assertEquals(referenceUser,findResult.get());
|
||||
|
||||
//Situation 2: No user with the required name is present
|
||||
findResult = userRepository.findByUsername("fawkes1001");
|
||||
assertFalse(findResult.isPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Sql("classpath:userRepisotoryTestEntries.sql")
|
||||
void test_existsByMail() {
|
||||
User referenceUser = testEntityManager.find(User.class, 1L);
|
||||
//Situation 1: invalid email format should not matter
|
||||
assertFalse(userRepository.existsByEmail("FawKes100"));
|
||||
|
||||
//Situation 2: No user exists with such a mail
|
||||
assertFalse(userRepository.existsByEmail("mail@fawkes100.de"));
|
||||
|
||||
//Situation 3: User with this mail exists
|
||||
assertTrue(userRepository.existsByEmail(referenceUser.getEmail()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Sql("classpath:userRepisotoryTestEntries.sql")
|
||||
void test_existsByUsername() {
|
||||
User referenceUser = testEntityManager.find(User.class, 1L);
|
||||
//Situation 1: No such user
|
||||
assertFalse(userRepository.existsByUsername("FawKes100"));
|
||||
|
||||
//Situation 3: User with this name exists
|
||||
assertTrue(userRepository.existsByUsername(referenceUser.getUsername()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Sql("classpath:userRepisotoryTestEntries.sql")
|
||||
void test_deleteUserByName() {
|
||||
User referenceUser1 = testEntityManager.find(User.class, 1L);
|
||||
User referenceUser2 = testEntityManager.find(User.class, 2L);
|
||||
|
||||
userRepository.deleteByUsername(referenceUser2.getUsername());
|
||||
|
||||
assertThat(testEntityManager.find(User.class, referenceUser2.getId())).isNull();
|
||||
assertThat(testEntityManager.find(User.class, referenceUser1.getId())).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Sql("classpath:userRepisotoryTestEntries.sql")
|
||||
void test_countUsers() {
|
||||
assertEquals(2, userRepository.countUsers());
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +1,23 @@
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (1, NULL, 0, NULL, 'Task 1', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (2, NULL, 0, NULL, 'Task 2', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (3, '2022-03-20', 0, NULL, 'Task 3', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (1, NULL, 0, NULL, 'Task 1', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (2, NULL, 0, NULL, 'Task 2', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (3, '2022-03-20', 0, NULL, 'Task 3', 2, false, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (4, '2022-03-20', 0, NULL, 'Task 4', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (5, '2022-03-20', 0, '2021-03-20', 'Task 5', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (6, '2022-03-20', 0, '2021-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (4, '2022-03-20', 0, NULL, 'Task 4', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (5, '2022-03-20', 0, '2021-03-20', 'Task 5', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (6, '2022-03-20', 0, '2021-03-20', 'Task 6', 2, true, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (7, NULL, 0, '2043-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (8, NULL, 0, '2043-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (9, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (10, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (7, NULL, 0, '2043-03-20', 'Task 6', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (8, NULL, 0, '2043-03-20', 'Task 6', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (9, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (10, '2044-03-20', 0, '2043-03-20', 'Task 6', 2, true, 0, true);
|
||||
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (11, NULL, 0, '2022-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (12, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (11, NULL, 0, '2022-03-20', 'Task 6', 2, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (12, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, false, 0, true);
|
||||
|
||||
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 (15, NULL, 0, NULL, 'Task 15', 2, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (13, NULL, 0, '2022-03-20', 'Task 6', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (14, '2044-03-20', 0, '2022-03-20', 'Task 6', 2, true, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (15, NULL, 0, NULL, 'Task 15', 2, false, 0, true);
|
||||
|
||||
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);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (17, NULL, 0, NULL, 'Task 17', 9, false, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time) VALUES (18, NULL, 0, NULL, 'Task 17', 10, true, 0);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (16, NULL, 0, NULL, 'Task 15', 9, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (17, NULL, 0, NULL, 'Task 17', 9, false, 0, true);
|
||||
INSERT INTO tasks (taskid, deadline, eta, start_date, task_name, taskgroup_id, finished, work_time, finishable) VALUES (18, NULL, 0, NULL, 'Task 17', 10, true, 0, true);
|
@ -7,10 +7,13 @@ services:
|
||||
container_name: timemanager-db
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: edkvcjReDxJ9Z8hq
|
||||
ports:
|
||||
- "3306:3306"
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
#build:
|
||||
#context: ./backend
|
||||
#dockerfile: Dockerfile
|
||||
image: git.fawkes100.de/sebastian/timemanager/timemanager-backend:latest
|
||||
links:
|
||||
- "db:app_db"
|
||||
environment:
|
||||
@ -21,10 +24,14 @@ services:
|
||||
depends_on:
|
||||
- "db"
|
||||
restart: always
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
#build:
|
||||
#context: ./frontend
|
||||
#dockerfile: Dockerfile
|
||||
image: git.fawkes100.de/sebastian/timemanager/timemanager-frontend:latest
|
||||
restart: always
|
||||
links:
|
||||
- backend:backend
|
||||
|
@ -31,7 +31,9 @@
|
||||
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
"scripts": [
|
||||
"node_modules/apexcharts/dist/apexcharts.min.js"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
@ -100,7 +102,9 @@
|
||||
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
"scripts": [
|
||||
"node_modules/apexcharts/dist/apexcharts.min.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
frontend/openapitools.json
Normal file
7
frontend/openapitools.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"spaces": 2,
|
||||
"generator-cli": {
|
||||
"version": "7.1.0"
|
||||
}
|
||||
}
|
159
frontend/package-lock.json
generated
159
frontend/package-lock.json
generated
@ -22,10 +22,13 @@
|
||||
"@angular/platform-browser-dynamic": "^16.2.7",
|
||||
"@angular/router": "^16.2.7",
|
||||
"angular-calendar": "^0.31.0",
|
||||
"apexcharts": "^3.44.0",
|
||||
"date-fns": "^2.29.3",
|
||||
"luxon": "^3.4.3",
|
||||
"moment": "^2.29.4",
|
||||
"ng-apexcharts": "^1.8.0",
|
||||
"ngx-material-timepicker": "^13.1.1",
|
||||
"ngx-slider-v2": "^16.0.2",
|
||||
"rxjs": "~7.5.0",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.13.3"
|
||||
@ -4738,6 +4741,11 @@
|
||||
"integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@yr/monotone-cubic-spline": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@yr/monotone-cubic-spline/-/monotone-cubic-spline-1.0.3.tgz",
|
||||
"integrity": "sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA=="
|
||||
},
|
||||
"node_modules/abab": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
|
||||
@ -5036,6 +5044,20 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/apexcharts": {
|
||||
"version": "3.44.0",
|
||||
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.44.0.tgz",
|
||||
"integrity": "sha512-u7Xzrbcxc2yWznN78Jh5NMCYVAsWDfBjRl5ea++rVzFAqjU2hLz4RgKIFwYOBDRQtW1e/Qz8azJTqIJ1+Vu9Qg==",
|
||||
"dependencies": {
|
||||
"@yr/monotone-cubic-spline": "^1.0.3",
|
||||
"svg.draggable.js": "^2.2.2",
|
||||
"svg.easing.js": "^2.0.0",
|
||||
"svg.filter.js": "^2.0.2",
|
||||
"svg.pathmorphing.js": "^0.1.3",
|
||||
"svg.resize.js": "^1.4.3",
|
||||
"svg.select.js": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/aproba": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
|
||||
@ -6334,12 +6356,25 @@
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/detect-it": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/detect-it/-/detect-it-4.0.1.tgz",
|
||||
"integrity": "sha512-dg5YBTJYvogK1+dA2mBUDKzOWfYZtHVba89SyZUhc4+e3i2tzgjANFg5lDRCd3UOtRcw00vUTMK8LELcMdicug=="
|
||||
},
|
||||
"node_modules/detect-node": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
|
||||
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/detect-passive-events": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/detect-passive-events/-/detect-passive-events-2.0.3.tgz",
|
||||
"integrity": "sha512-QN/1X65Axis6a9D8qg8Py9cwY/fkWAmAH/edTbmLMcv4m5dboLJ7LcAi8CfaCON2tjk904KwKX/HTdsHC6yeRg==",
|
||||
"dependencies": {
|
||||
"detect-it": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/di": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz",
|
||||
@ -7185,9 +7220,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.3",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
||||
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
|
||||
"version": "1.15.6",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@ -8068,9 +8103,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ip": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
|
||||
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
|
||||
"integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
@ -9753,6 +9788,20 @@
|
||||
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ng-apexcharts": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/ng-apexcharts/-/ng-apexcharts-1.8.0.tgz",
|
||||
"integrity": "sha512-NwJuMLHoLm52LSzM08RXV6oOOTyUYREAV53WHVGs+L2qi8UWbxCz19hX0kk+F/xFLEhhuiLegO3T1v30jLbKSQ==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/common": ">=13.0.0",
|
||||
"@angular/core": ">=13.0.0",
|
||||
"apexcharts": "^3.41.0",
|
||||
"rxjs": "^6.5.3 || ^7.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ngx-material-timepicker": {
|
||||
"version": "13.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ngx-material-timepicker/-/ngx-material-timepicker-13.1.1.tgz",
|
||||
@ -9765,6 +9814,21 @@
|
||||
"luxon": ">= 1.24.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ngx-slider-v2": {
|
||||
"version": "16.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ngx-slider-v2/-/ngx-slider-v2-16.0.2.tgz",
|
||||
"integrity": "sha512-Lpl7SlErL+tJJvTRZYdyZoXTThKN8Ro1z3vscJQ1O5azHXwvbv3pnTcsOwY4ltfaP+dpzY27KL1QXyDr6QMaxQ==",
|
||||
"dependencies": {
|
||||
"detect-passive-events": "^2.0.3",
|
||||
"rxjs": "^7.4.0",
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^16.0.0",
|
||||
"@angular/core": "^16.0.0",
|
||||
"@angular/forms": "^16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nice-napi": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz",
|
||||
@ -12181,6 +12245,89 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/svg.draggable.js": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/svg.draggable.js/-/svg.draggable.js-2.2.2.tgz",
|
||||
"integrity": "sha512-JzNHBc2fLQMzYCZ90KZHN2ohXL0BQJGQimK1kGk6AvSeibuKcIdDX9Kr0dT9+UJ5O8nYA0RB839Lhvk4CY4MZw==",
|
||||
"dependencies": {
|
||||
"svg.js": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svg.easing.js": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/svg.easing.js/-/svg.easing.js-2.0.0.tgz",
|
||||
"integrity": "sha512-//ctPdJMGy22YoYGV+3HEfHbm6/69LJUTAqI2/5qBvaNHZ9uUFVC82B0Pl299HzgH13rKrBgi4+XyXXyVWWthA==",
|
||||
"dependencies": {
|
||||
"svg.js": ">=2.3.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svg.filter.js": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/svg.filter.js/-/svg.filter.js-2.0.2.tgz",
|
||||
"integrity": "sha512-xkGBwU+dKBzqg5PtilaTb0EYPqPfJ9Q6saVldX+5vCRy31P6TlRCP3U9NxH3HEufkKkpNgdTLBJnmhDHeTqAkw==",
|
||||
"dependencies": {
|
||||
"svg.js": "^2.2.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svg.js": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/svg.js/-/svg.js-2.7.1.tgz",
|
||||
"integrity": "sha512-ycbxpizEQktk3FYvn/8BH+6/EuWXg7ZpQREJvgacqn46gIddG24tNNe4Son6omdXCnSOaApnpZw6MPCBA1dODA=="
|
||||
},
|
||||
"node_modules/svg.pathmorphing.js": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/svg.pathmorphing.js/-/svg.pathmorphing.js-0.1.3.tgz",
|
||||
"integrity": "sha512-49HWI9X4XQR/JG1qXkSDV8xViuTLIWm/B/7YuQELV5KMOPtXjiwH4XPJvr/ghEDibmLQ9Oc22dpWpG0vUDDNww==",
|
||||
"dependencies": {
|
||||
"svg.js": "^2.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svg.resize.js": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/svg.resize.js/-/svg.resize.js-1.4.3.tgz",
|
||||
"integrity": "sha512-9k5sXJuPKp+mVzXNvxz7U0uC9oVMQrrf7cFsETznzUDDm0x8+77dtZkWdMfRlmbkEEYvUn9btKuZ3n41oNA+uw==",
|
||||
"dependencies": {
|
||||
"svg.js": "^2.6.5",
|
||||
"svg.select.js": "^2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svg.resize.js/node_modules/svg.select.js": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/svg.select.js/-/svg.select.js-2.1.2.tgz",
|
||||
"integrity": "sha512-tH6ABEyJsAOVAhwcCjF8mw4crjXSI1aa7j2VQR8ZuJ37H2MBUbyeqYr5nEO7sSN3cy9AR9DUwNg0t/962HlDbQ==",
|
||||
"dependencies": {
|
||||
"svg.js": "^2.2.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svg.select.js": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/svg.select.js/-/svg.select.js-3.0.1.tgz",
|
||||
"integrity": "sha512-h5IS/hKkuVCbKSieR9uQCj9w+zLHoPh+ce19bBYyqF53g6mnPB8sAtIbe1s9dh2S2fCmYX2xel1Ln3PJBbK4kw==",
|
||||
"dependencies": {
|
||||
"svg.js": "^2.6.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/symbol-observable": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-4.0.0.tgz",
|
||||
|
@ -24,10 +24,13 @@
|
||||
"@angular/platform-browser-dynamic": "^16.2.7",
|
||||
"@angular/router": "^16.2.7",
|
||||
"angular-calendar": "^0.31.0",
|
||||
"apexcharts": "^3.44.0",
|
||||
"date-fns": "^2.29.3",
|
||||
"luxon": "^3.4.3",
|
||||
"moment": "^2.29.4",
|
||||
"ng-apexcharts": "^1.8.0",
|
||||
"ngx-material-timepicker": "^13.1.1",
|
||||
"ngx-slider-v2": "^16.0.2",
|
||||
"rxjs": "~7.5.0",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.13.3"
|
||||
|
@ -5,16 +5,19 @@ api/account.service.ts
|
||||
api/api.ts
|
||||
api/history.service.ts
|
||||
api/login.service.ts
|
||||
api/ntfy.service.ts
|
||||
api/properties.service.ts
|
||||
api/schedule.service.ts
|
||||
api/task.service.ts
|
||||
api/taskgroup.service.ts
|
||||
api/taskseries.service.ts
|
||||
api/users.service.ts
|
||||
configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/accountDeleteRequest.ts
|
||||
model/activityInfo.ts
|
||||
model/advancedScheduleFieldInfo.ts
|
||||
model/advancedScheduleInfo.ts
|
||||
model/advancedScheduleInfoAllOf.ts
|
||||
@ -30,7 +33,9 @@ model/inlineResponse403.ts
|
||||
model/inlineResponse409.ts
|
||||
model/loginRequest.ts
|
||||
model/loginResponse.ts
|
||||
model/manualScheduleStopInfo.ts
|
||||
model/models.ts
|
||||
model/ntfyInformation.ts
|
||||
model/passwordChangeRequest.ts
|
||||
model/propertiesInfo.ts
|
||||
model/propertyInfo.ts
|
||||
@ -44,12 +49,17 @@ model/simpleStatusResponse.ts
|
||||
model/taskEntityInfo.ts
|
||||
model/taskFieldInfo.ts
|
||||
model/taskOverviewInfo.ts
|
||||
model/taskRepeatDayInfo.ts
|
||||
model/taskRepeatWeekDayInfo.ts
|
||||
model/taskRepeatWeekInfo.ts
|
||||
model/taskScheduleStopResponse.ts
|
||||
model/taskShortInfo.ts
|
||||
model/taskTaskgroupInfo.ts
|
||||
model/taskgroupActivityInfo.ts
|
||||
model/taskgroupDetailInfo.ts
|
||||
model/taskgroupEntityInfo.ts
|
||||
model/taskgroupFieldInfo.ts
|
||||
model/taskgroupPathInfo.ts
|
||||
model/userAddInfo.ts
|
||||
model/userInfo.ts
|
||||
model/userUpdateInfo.ts
|
||||
|
@ -5,10 +5,12 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { AccountService } from './api/account.service';
|
||||
import { HistoryService } from './api/history.service';
|
||||
import { LoginService } from './api/login.service';
|
||||
import { NtfyService } from './api/ntfy.service';
|
||||
import { PropertiesService } from './api/properties.service';
|
||||
import { ScheduleService } from './api/schedule.service';
|
||||
import { TaskService } from './api/task.service';
|
||||
import { TaskgroupService } from './api/taskgroup.service';
|
||||
import { TaskseriesService } from './api/taskseries.service';
|
||||
import { UsersService } from './api/users.service';
|
||||
|
||||
@NgModule({
|
||||
|
@ -4,6 +4,8 @@ export * from './history.service';
|
||||
import { HistoryService } from './history.service';
|
||||
export * from './login.service';
|
||||
import { LoginService } from './login.service';
|
||||
export * from './ntfy.service';
|
||||
import { NtfyService } from './ntfy.service';
|
||||
export * from './properties.service';
|
||||
import { PropertiesService } from './properties.service';
|
||||
export * from './schedule.service';
|
||||
@ -12,6 +14,8 @@ export * from './task.service';
|
||||
import { TaskService } from './task.service';
|
||||
export * from './taskgroup.service';
|
||||
import { TaskgroupService } from './taskgroup.service';
|
||||
export * from './taskseries.service';
|
||||
import { TaskseriesService } from './taskseries.service';
|
||||
export * from './users.service';
|
||||
import { UsersService } from './users.service';
|
||||
export const APIS = [AccountService, HistoryService, LoginService, PropertiesService, ScheduleService, TaskService, TaskgroupService, UsersService];
|
||||
export const APIS = [AccountService, HistoryService, LoginService, NtfyService, PropertiesService, ScheduleService, TaskService, TaskgroupService, TaskseriesService, UsersService];
|
||||
|
@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams,
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { ScheduleInfo } from '../model/models';
|
||||
import { ScheduleStatus } from '../model/models';
|
||||
import { SimpleStatusResponse } from '../model/models';
|
||||
import { TaskgroupActivityInfo } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
@ -86,6 +88,65 @@ export class HistoryService {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* List past schedules
|
||||
* Get schedules of the past
|
||||
* @param date date
|
||||
* @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 historySchedulesDateGet(date: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<ScheduleInfo>>;
|
||||
public historySchedulesDateGet(date: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<ScheduleInfo>>>;
|
||||
public historySchedulesDateGet(date: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<ScheduleInfo>>>;
|
||||
public historySchedulesDateGet(date: string, 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 historySchedulesDateGet.');
|
||||
}
|
||||
|
||||
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}/history/schedules/${encodeURIComponent(String(date))}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get number of active minutes
|
||||
* get number of worked minutes today
|
||||
@ -141,4 +202,130 @@ export class HistoryService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param startingDate starting date
|
||||
* @param endingDate starting date
|
||||
* @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 statisticsStartingDateEndingDateGet(startingDate: string, endingDate: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<TaskgroupActivityInfo>>;
|
||||
public statisticsStartingDateEndingDateGet(startingDate: string, endingDate: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<TaskgroupActivityInfo>>>;
|
||||
public statisticsStartingDateEndingDateGet(startingDate: string, endingDate: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<TaskgroupActivityInfo>>>;
|
||||
public statisticsStartingDateEndingDateGet(startingDate: string, endingDate: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
if (startingDate === null || startingDate === undefined) {
|
||||
throw new Error('Required parameter startingDate was null or undefined when calling statisticsStartingDateEndingDateGet.');
|
||||
}
|
||||
if (endingDate === null || endingDate === undefined) {
|
||||
throw new Error('Required parameter endingDate was null or undefined when calling statisticsStartingDateEndingDateGet.');
|
||||
}
|
||||
|
||||
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<TaskgroupActivityInfo>>(`${this.configuration.basePath}/statistics/${encodeURIComponent(String(startingDate))}/${encodeURIComponent(String(endingDate))}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskgroupID internal id of taskgroup
|
||||
* @param startingDate starting date
|
||||
* @param endingDate starting date
|
||||
* @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 statisticsTaskgroupIDStartingDateEndingDateGet(taskgroupID: number, startingDate: string, endingDate: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<TaskgroupActivityInfo>>;
|
||||
public statisticsTaskgroupIDStartingDateEndingDateGet(taskgroupID: number, startingDate: string, endingDate: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<TaskgroupActivityInfo>>>;
|
||||
public statisticsTaskgroupIDStartingDateEndingDateGet(taskgroupID: number, startingDate: string, endingDate: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<TaskgroupActivityInfo>>>;
|
||||
public statisticsTaskgroupIDStartingDateEndingDateGet(taskgroupID: number, startingDate: string, endingDate: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
if (taskgroupID === null || taskgroupID === undefined) {
|
||||
throw new Error('Required parameter taskgroupID was null or undefined when calling statisticsTaskgroupIDStartingDateEndingDateGet.');
|
||||
}
|
||||
if (startingDate === null || startingDate === undefined) {
|
||||
throw new Error('Required parameter startingDate was null or undefined when calling statisticsTaskgroupIDStartingDateEndingDateGet.');
|
||||
}
|
||||
if (endingDate === null || endingDate === undefined) {
|
||||
throw new Error('Required parameter endingDate was null or undefined when calling statisticsTaskgroupIDStartingDateEndingDateGet.');
|
||||
}
|
||||
|
||||
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<TaskgroupActivityInfo>>(`${this.configuration.basePath}/statistics/${encodeURIComponent(String(taskgroupID))}/${encodeURIComponent(String(startingDate))}/${encodeURIComponent(String(endingDate))}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
210
frontend/src/api/api/ntfy.service.ts
Normal file
210
frontend/src/api/api/ntfy.service.ts
Normal file
@ -0,0 +1,210 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { NtfyInformation } from '../model/models';
|
||||
import { SimpleStatusResponse } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NtfyService {
|
||||
|
||||
protected basePath = 'http://127.0.0.1:8080/api';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ntfy information
|
||||
* Get ntfy information
|
||||
* @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 ntfyGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<NtfyInformation>;
|
||||
public ntfyGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<NtfyInformation>>;
|
||||
public ntfyGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<NtfyInformation>>;
|
||||
public ntfyGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarCredential: string | undefined;
|
||||
// authentication (API_TOKEN) required
|
||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||
if (localVarCredential) {
|
||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||
}
|
||||
|
||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||
if (localVarHttpContext === undefined) {
|
||||
localVarHttpContext = new HttpContext();
|
||||
}
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' = 'json';
|
||||
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<NtfyInformation>(`${this.configuration.basePath}/ntfy`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit ntfy information
|
||||
* Edit ntfy information
|
||||
* @param ntfyInformation
|
||||
* @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 ntfyPost(ntfyInformation?: NtfyInformation, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
|
||||
public ntfyPost(ntfyInformation?: NtfyInformation, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
|
||||
public ntfyPost(ntfyInformation?: NtfyInformation, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
|
||||
public ntfyPost(ntfyInformation?: NtfyInformation, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarCredential: string | undefined;
|
||||
// authentication (API_TOKEN) required
|
||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||
if (localVarCredential) {
|
||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||
}
|
||||
|
||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||
if (localVarHttpContext === undefined) {
|
||||
localVarHttpContext = new HttpContext();
|
||||
}
|
||||
|
||||
|
||||
// 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.post<SimpleStatusResponse>(`${this.configuration.basePath}/ntfy`,
|
||||
ntfyInformation,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -21,6 +21,7 @@ import { Observable } from 'rxjs';
|
||||
import { AdvancedScheduleFieldInfo } from '../model/models';
|
||||
import { BasicScheduleFieldInfo } from '../model/models';
|
||||
import { ForgottenActivityRequest } from '../model/models';
|
||||
import { ManualScheduleStopInfo } from '../model/models';
|
||||
import { ScheduleActivateInfo } from '../model/models';
|
||||
import { ScheduleInfo } from '../model/models';
|
||||
import { SimpleStatusResponse } from '../model/models';
|
||||
@ -699,6 +700,76 @@ export class ScheduleService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* load schedule
|
||||
* gets details of schedule
|
||||
* @param scheduleID internal id of schedule
|
||||
* @param manualScheduleStopInfo
|
||||
* @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 schedulesScheduleIDStopManualPost(scheduleID: number, manualScheduleStopInfo?: ManualScheduleStopInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<ScheduleInfo>;
|
||||
public schedulesScheduleIDStopManualPost(scheduleID: number, manualScheduleStopInfo?: ManualScheduleStopInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<ScheduleInfo>>;
|
||||
public schedulesScheduleIDStopManualPost(scheduleID: number, manualScheduleStopInfo?: ManualScheduleStopInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<ScheduleInfo>>;
|
||||
public schedulesScheduleIDStopManualPost(scheduleID: number, manualScheduleStopInfo?: ManualScheduleStopInfo, 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 schedulesScheduleIDStopManualPost.');
|
||||
}
|
||||
|
||||
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.post<ScheduleInfo>(`${this.configuration.basePath}/schedules/${encodeURIComponent(String(scheduleID))}/stopManual`,
|
||||
manualScheduleStopInfo,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* deletes multiple schedules
|
||||
* deletes multiple schedules at once
|
||||
|
@ -401,6 +401,190 @@ export class TaskService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 tasksTaskIDSubtasksDelete(taskID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
|
||||
public tasksTaskIDSubtasksDelete(taskID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
|
||||
public tasksTaskIDSubtasksDelete(taskID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
|
||||
public tasksTaskIDSubtasksDelete(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 tasksTaskIDSubtasksDelete.');
|
||||
}
|
||||
|
||||
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}/tasks/${encodeURIComponent(String(taskID))}/subtasks`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 tasksTaskIDSubtasksGet(taskID: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<TaskEntityInfo>>;
|
||||
public tasksTaskIDSubtasksGet(taskID: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<TaskEntityInfo>>>;
|
||||
public tasksTaskIDSubtasksGet(taskID: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<TaskEntityInfo>>>;
|
||||
public tasksTaskIDSubtasksGet(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 tasksTaskIDSubtasksGet.');
|
||||
}
|
||||
|
||||
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<TaskEntityInfo>>(`${this.configuration.basePath}/tasks/${encodeURIComponent(String(taskID))}/subtasks`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Subtask
|
||||
* Create Subtask
|
||||
* @param taskID internal id of task
|
||||
* @param taskFieldInfo
|
||||
* @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 tasksTaskIDSubtasksPut(taskID: number, taskFieldInfo?: TaskFieldInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<TaskEntityInfo>;
|
||||
public tasksTaskIDSubtasksPut(taskID: number, taskFieldInfo?: TaskFieldInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<TaskEntityInfo>>;
|
||||
public tasksTaskIDSubtasksPut(taskID: number, taskFieldInfo?: TaskFieldInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<TaskEntityInfo>>;
|
||||
public tasksTaskIDSubtasksPut(taskID: number, taskFieldInfo?: TaskFieldInfo, 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 tasksTaskIDSubtasksPut.');
|
||||
}
|
||||
|
||||
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<TaskEntityInfo>(`${this.configuration.basePath}/tasks/${encodeURIComponent(String(taskID))}/subtasks`,
|
||||
taskFieldInfo,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a new task
|
||||
* creates tasks
|
||||
|
@ -25,6 +25,7 @@ import { SimpleStatusResponse } from '../model/models';
|
||||
import { TaskgroupDetailInfo } from '../model/models';
|
||||
import { TaskgroupEntityInfo } from '../model/models';
|
||||
import { TaskgroupFieldInfo } from '../model/models';
|
||||
import { TaskgroupPathInfo } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
@ -201,6 +202,61 @@ export class TaskgroupService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* lists all taskgrouppaths
|
||||
* lists all taskgroup-paths
|
||||
* @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 taskgroupsPathGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Array<TaskgroupPathInfo>>;
|
||||
public taskgroupsPathGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Array<TaskgroupPathInfo>>>;
|
||||
public taskgroupsPathGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Array<TaskgroupPathInfo>>>;
|
||||
public taskgroupsPathGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarCredential: string | undefined;
|
||||
// authentication (API_TOKEN) required
|
||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||
if (localVarCredential) {
|
||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||
}
|
||||
|
||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||
if (localVarHttpContext === undefined) {
|
||||
localVarHttpContext = new HttpContext();
|
||||
}
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' = 'json';
|
||||
if(localVarHttpHeaderAcceptSelected && localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<Array<TaskgroupPathInfo>>(`${this.configuration.basePath}/taskgroups/path`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* creates taskgroup
|
||||
* creates taskgroup
|
||||
|
226
frontend/src/api/api/taskseries.service.ts
Normal file
226
frontend/src/api/api/taskseries.service.ts
Normal file
@ -0,0 +1,226 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { SimpleStatusResponse } from '../model/models';
|
||||
import { TaskRepeatDayInfo } from '../model/models';
|
||||
import { TaskRepeatWeekInfo } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskseriesService {
|
||||
|
||||
protected basePath = 'http://127.0.0.1:8080/api';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* daily repeating task creation
|
||||
* Creates a daily repeating task
|
||||
* @param taskID internal id of taskgroup
|
||||
* @param taskRepeatDayInfo
|
||||
* @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 tasksTaskIDTaskseriesDailyPost(taskID: number, taskRepeatDayInfo?: TaskRepeatDayInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
|
||||
public tasksTaskIDTaskseriesDailyPost(taskID: number, taskRepeatDayInfo?: TaskRepeatDayInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
|
||||
public tasksTaskIDTaskseriesDailyPost(taskID: number, taskRepeatDayInfo?: TaskRepeatDayInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
|
||||
public tasksTaskIDTaskseriesDailyPost(taskID: number, taskRepeatDayInfo?: TaskRepeatDayInfo, 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 tasksTaskIDTaskseriesDailyPost.');
|
||||
}
|
||||
|
||||
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.post<SimpleStatusResponse>(`${this.configuration.basePath}/tasks/${encodeURIComponent(String(taskID))}/taskseries/daily`,
|
||||
taskRepeatDayInfo,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* daily repeating task creation
|
||||
* Creates a daily repeating task
|
||||
* @param taskRepeatWeekInfo
|
||||
* @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 tasksTaskseriesWeeklyPost(taskRepeatWeekInfo?: TaskRepeatWeekInfo, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<SimpleStatusResponse>;
|
||||
public tasksTaskseriesWeeklyPost(taskRepeatWeekInfo?: TaskRepeatWeekInfo, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<SimpleStatusResponse>>;
|
||||
public tasksTaskseriesWeeklyPost(taskRepeatWeekInfo?: TaskRepeatWeekInfo, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<SimpleStatusResponse>>;
|
||||
public tasksTaskseriesWeeklyPost(taskRepeatWeekInfo?: TaskRepeatWeekInfo, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarCredential: string | undefined;
|
||||
// authentication (API_TOKEN) required
|
||||
localVarCredential = this.configuration.lookupCredential('API_TOKEN');
|
||||
if (localVarCredential) {
|
||||
localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + localVarCredential);
|
||||
}
|
||||
|
||||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (localVarHttpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
let localVarHttpContext: HttpContext | undefined = options && options.context;
|
||||
if (localVarHttpContext === undefined) {
|
||||
localVarHttpContext = new HttpContext();
|
||||
}
|
||||
|
||||
|
||||
// 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.post<SimpleStatusResponse>(`${this.configuration.basePath}/tasks/taskseries/weekly`,
|
||||
taskRepeatWeekInfo,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
21
frontend/src/api/model/activityInfo.ts
Normal file
21
frontend/src/api/model/activityInfo.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 ActivityInfo {
|
||||
date: string;
|
||||
/**
|
||||
* Number of minutes the task was active
|
||||
*/
|
||||
activeMinutes: number;
|
||||
}
|
||||
|
20
frontend/src/api/model/manualScheduleStopInfo.ts
Normal file
20
frontend/src/api/model/manualScheduleStopInfo.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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 ManualScheduleStopInfo {
|
||||
/**
|
||||
* duration in minutes
|
||||
*/
|
||||
duration: number;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
export * from './accountDeleteRequest';
|
||||
export * from './activityInfo';
|
||||
export * from './advancedScheduleFieldInfo';
|
||||
export * from './advancedScheduleInfo';
|
||||
export * from './advancedScheduleInfoAllOf';
|
||||
@ -14,6 +15,8 @@ export * from './inlineResponse403';
|
||||
export * from './inlineResponse409';
|
||||
export * from './loginRequest';
|
||||
export * from './loginResponse';
|
||||
export * from './manualScheduleStopInfo';
|
||||
export * from './ntfyInformation';
|
||||
export * from './passwordChangeRequest';
|
||||
export * from './propertiesInfo';
|
||||
export * from './propertyInfo';
|
||||
@ -27,12 +30,17 @@ export * from './simpleStatusResponse';
|
||||
export * from './taskEntityInfo';
|
||||
export * from './taskFieldInfo';
|
||||
export * from './taskOverviewInfo';
|
||||
export * from './taskRepeatDayInfo';
|
||||
export * from './taskRepeatWeekDayInfo';
|
||||
export * from './taskRepeatWeekInfo';
|
||||
export * from './taskScheduleStopResponse';
|
||||
export * from './taskShortInfo';
|
||||
export * from './taskTaskgroupInfo';
|
||||
export * from './taskgroupActivityInfo';
|
||||
export * from './taskgroupDetailInfo';
|
||||
export * from './taskgroupEntityInfo';
|
||||
export * from './taskgroupFieldInfo';
|
||||
export * from './taskgroupPathInfo';
|
||||
export * from './userAddInfo';
|
||||
export * from './userInfo';
|
||||
export * from './userUpdateInfo';
|
||||
|
32
frontend/src/api/model/ntfyInformation.ts
Normal file
32
frontend/src/api/model/ntfyInformation.ts
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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 NtfyInformation {
|
||||
/**
|
||||
* host of ntfy service
|
||||
*/
|
||||
ntfy_host: string;
|
||||
/**
|
||||
* topic of ntfy service
|
||||
*/
|
||||
ntfy_topic: string;
|
||||
/**
|
||||
* username of ntfy account for publishing news
|
||||
*/
|
||||
ntfy_user?: string;
|
||||
/**
|
||||
* token to ntfy useraccount
|
||||
*/
|
||||
ntfy_token?: string;
|
||||
}
|
||||
|
24
frontend/src/api/model/pastScheduleInfo.ts
Normal file
24
frontend/src/api/model/pastScheduleInfo.ts
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 { ScheduleInfo } from './scheduleInfo';
|
||||
|
||||
|
||||
export interface PastScheduleInfo {
|
||||
MONDAY: Array<ScheduleInfo>;
|
||||
TUESDAY: Array<ScheduleInfo>;
|
||||
WEDNESDAY: Array<ScheduleInfo>;
|
||||
THURSDAY: Array<ScheduleInfo>;
|
||||
FRIDAY: Array<ScheduleInfo>;
|
||||
SATURDAY: Array<ScheduleInfo>;
|
||||
SUNDAY: Array<ScheduleInfo>;
|
||||
}
|
||||
|
@ -44,5 +44,29 @@ export interface TaskEntityInfo {
|
||||
* number in minutes that was already worked on this task
|
||||
*/
|
||||
workTime: number;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
/**
|
||||
* determines whether the task has active schedules
|
||||
*/
|
||||
hasActiveSchedules: boolean;
|
||||
/**
|
||||
* determines whether the task has schedules that can be started
|
||||
*/
|
||||
hasPlannedSchedules: boolean;
|
||||
/**
|
||||
* determines whether the task is associated with a taskserie
|
||||
*/
|
||||
hasTaskSerie: boolean;
|
||||
/**
|
||||
* determines whether a task has subtasks
|
||||
*/
|
||||
hasSubtasks: boolean;
|
||||
/**
|
||||
* determines whether a task is a top task or Not
|
||||
*/
|
||||
hasParent: boolean;
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,14 @@ export interface TaskFieldInfo {
|
||||
/**
|
||||
* date from which the task can be started
|
||||
*/
|
||||
startDate: string;
|
||||
startDate?: string;
|
||||
/**
|
||||
* date until the task has to be finished
|
||||
*/
|
||||
deadline: string;
|
||||
deadline?: string;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
|
||||
|
||||
|
||||
export interface TaskOverviewInfo {
|
||||
@ -36,5 +37,14 @@ export interface TaskOverviewInfo {
|
||||
* number in minutes that was already worked on this task
|
||||
*/
|
||||
activeTime?: number;
|
||||
taskgroupPath: Array<TaskgroupEntityInfo>;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
/**
|
||||
* determines whether the task has subtasks
|
||||
*/
|
||||
hasSubtasks: boolean;
|
||||
}
|
||||
|
||||
|
24
frontend/src/api/model/taskRepeatDayInfo.ts
Normal file
24
frontend/src/api/model/taskRepeatDayInfo.ts
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 TaskRepeatDayInfo {
|
||||
/**
|
||||
* number repeating days
|
||||
*/
|
||||
offset: number;
|
||||
/**
|
||||
* Date until the tasks repeat
|
||||
*/
|
||||
endingDate: string;
|
||||
}
|
||||
|
41
frontend/src/api/model/taskRepeatWeekDayInfo.ts
Normal file
41
frontend/src/api/model/taskRepeatWeekDayInfo.ts
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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 TaskRepeatWeekDayInfo {
|
||||
/**
|
||||
* number repeating days
|
||||
*/
|
||||
offset: number;
|
||||
/**
|
||||
* internal identifier of task
|
||||
*/
|
||||
taskID: number;
|
||||
/**
|
||||
* day of week
|
||||
*/
|
||||
dayOfWeek: TaskRepeatWeekDayInfo.DayOfWeekEnum;
|
||||
}
|
||||
export namespace TaskRepeatWeekDayInfo {
|
||||
export type DayOfWeekEnum = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY';
|
||||
export const DayOfWeekEnum = {
|
||||
Monday: 'MONDAY' as DayOfWeekEnum,
|
||||
Tuesday: 'TUESDAY' as DayOfWeekEnum,
|
||||
Wednesday: 'WEDNESDAY' as DayOfWeekEnum,
|
||||
Thursday: 'THURSDAY' as DayOfWeekEnum,
|
||||
Friday: 'FRIDAY' as DayOfWeekEnum,
|
||||
Saturday: 'SATURDAY' as DayOfWeekEnum,
|
||||
Sunday: 'SUNDAY' as DayOfWeekEnum
|
||||
};
|
||||
}
|
||||
|
||||
|
22
frontend/src/api/model/taskRepeatWeekInfo.ts
Normal file
22
frontend/src/api/model/taskRepeatWeekInfo.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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 { TaskRepeatWeekDayInfo } from './taskRepeatWeekDayInfo';
|
||||
|
||||
|
||||
export interface TaskRepeatWeekInfo {
|
||||
/**
|
||||
* Date until the tasks repeat
|
||||
*/
|
||||
endDate: string;
|
||||
weekDayInfos: Array<TaskRepeatWeekDayInfo>;
|
||||
}
|
||||
|
@ -20,5 +20,9 @@ export interface TaskShortInfo {
|
||||
* name of task
|
||||
*/
|
||||
taskName: string;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
}
|
||||
|
||||
|
@ -46,5 +46,9 @@ export interface TaskTaskgroupInfo {
|
||||
*/
|
||||
workTime: number;
|
||||
taskgroups: Array<TaskgroupEntityInfo>;
|
||||
/**
|
||||
* determines whether the task can be finished
|
||||
*/
|
||||
finishable: boolean;
|
||||
}
|
||||
|
||||
|
20
frontend/src/api/model/taskgroupActivityInfo.ts
Normal file
20
frontend/src/api/model/taskgroupActivityInfo.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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 { ActivityInfo } from './activityInfo';
|
||||
import { TaskgroupEntityInfo } from './taskgroupEntityInfo';
|
||||
|
||||
|
||||
export interface TaskgroupActivityInfo {
|
||||
taskgroup: TaskgroupEntityInfo;
|
||||
activityInfos: Array<ActivityInfo>;
|
||||
}
|
||||
|
23
frontend/src/api/model/taskgroupPathInfo.ts
Normal file
23
frontend/src/api/model/taskgroupPathInfo.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 { TaskgroupEntityInfo } from './taskgroupEntityInfo';
|
||||
|
||||
|
||||
export interface TaskgroupPathInfo {
|
||||
/**
|
||||
* TaskgroupPath
|
||||
*/
|
||||
taskgroupPath: string;
|
||||
directChildren: Array<TaskgroupEntityInfo>;
|
||||
rootTasktroup: TaskgroupEntityInfo;
|
||||
}
|
||||
|
@ -93,7 +93,8 @@ export class ActiveTaskOverviewComponent implements OnInit{
|
||||
editTask(editedTask: TaskTaskgroupInfo) {
|
||||
const taskEditorInfo: TaskEditorData = {
|
||||
task: editedTask,
|
||||
taskgroupID: editedTask.taskgroups[editedTask.taskgroups.length-1].taskgroupID
|
||||
taskgroupID: editedTask.taskgroups[editedTask.taskgroups.length-1].taskgroupID,
|
||||
parentTask: undefined
|
||||
};
|
||||
this.dialog.open(TaskEditorComponent, {data: taskEditorInfo, width: "600px"})
|
||||
}
|
||||
|
@ -11,6 +11,13 @@ import {MissedSchedulesComponent} from "./missed-schedules/missed-schedules.comp
|
||||
import {OverdueTaskOverviewComponent} from "./overdue-task-overview/overdue-task-overview.component";
|
||||
import {UpcomingTaskOverviewComponent} from "./upcoming-task-overview/upcoming-task-overview.component";
|
||||
import {ActiveTaskOverviewComponent} from "./active-task-overview/active-task-overview.component";
|
||||
import {DraggableSchedulerComponent} from "./schedules/draggable-scheduler/draggable-scheduler.component";
|
||||
import {
|
||||
ForgottenTaskStartDialogComponent
|
||||
} from "./dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component";
|
||||
import {TaskgroupActivityComponent} from "./statistics/taskgroup-activity/taskgroup-activity.component";
|
||||
import {ScheduleHistoryComponent} from "./statistics/schedule-history/schedule-history.component";
|
||||
import {UpcomingDeadlinesOverviewComponent} from "./upcoming-deadlines-overview/upcoming-deadlines-overview.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{path: '', component: MainComponent},
|
||||
@ -24,7 +31,12 @@ const routes: Routes = [
|
||||
{path: 'reschedule', component: MissedSchedulesComponent},
|
||||
{path: 'overdue', component: OverdueTaskOverviewComponent},
|
||||
{path: 'upcoming', component: UpcomingTaskOverviewComponent},
|
||||
{path: 'active', component: ActiveTaskOverviewComponent}
|
||||
{path: 'active', component: ActiveTaskOverviewComponent},
|
||||
{path: 'scheduler', component: DraggableSchedulerComponent},
|
||||
{path: 'forgotten', component: ForgottenTaskStartDialogComponent},
|
||||
{path: 'statistics/taskgroup-activity', component: TaskgroupActivityComponent},
|
||||
{path: 'statistics/schedule-history', component: ScheduleHistoryComponent},
|
||||
{path: 'deadlines', component: UpcomingDeadlinesOverviewComponent}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@ -2,12 +2,22 @@
|
||||
<span>TimeManager</span>
|
||||
|
||||
<button mat-button aria-label="Organize" *ngIf="authService.hasKey" [matMenuTriggerFor]="organizeMenu">Organize ▾</button>
|
||||
<button mat-button aria-label="Statistics" *ngIf="authService.hasKey" [matMenuTriggerFor]="statisticsMenu">Statistics ▾</button>
|
||||
<mat-menu #organizeMenu=matMenu>
|
||||
<button mat-menu-item routerLink="taskgroups/" aria-label="Task groups">Taskgroups</button>
|
||||
<button mat-menu-item routerLink="scheduler/" aria-label="Task groups">Scheduler</button>
|
||||
<mat-divider></mat-divider>
|
||||
<button mat-menu-item routerLink="active/" aria-label="Missed Schedules">Active Tasks</button>
|
||||
<button mat-menu-item routerLink="upcoming/" aria-label="Upcoming Tasks">Upcoming Tasks</button>
|
||||
<button mat-menu-item routerLink="overdue/" aria-label="Overdue Tasks">Overdue Tasks</button>
|
||||
<button mat-menu-item routerLink="reschedule/" aria-label="Missed Schedules">Missed Schedules</button>
|
||||
<mat-divider></mat-divider>
|
||||
<button mat-menu-item routerLink="deadlines" aria-label="Upcoming Deadlines">Deadlines</button>
|
||||
</mat-menu>
|
||||
|
||||
<mat-menu #statisticsMenu=matMenu>
|
||||
<button mat-menu-item routerLink="statistics/taskgroup-activity">Activity</button>
|
||||
<button mat-menu-item routerLink="statistics/schedule-history">History</button>
|
||||
</mat-menu>
|
||||
<span class="example-spacer"></span>
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user