Compare commits

...

54 Commits

Author SHA1 Message Date
StephanRichter 6193b727bd Merge branch 'module/projects' into dev
Build Docker Image / Docker-Build (push) Successful in 3m5s
Build Docker Image / Clean-Registry (push) Successful in 3s
2026-05-07 18:26:44 +02:00
StephanRichter f35882c967 bugfix: moving of tasks in tree now works as intended
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-07 18:26:37 +02:00
StephanRichter 1d1520534c Merge branch 'module/notes' into dev
Build Docker Image / Docker-Build (push) Successful in 3m7s
Build Docker Image / Clean-Registry (push) Successful in 2s
2026-05-06 09:26:13 +02:00
StephanRichter fe57749d9c improving note lsit
Build Docker Image / Docker-Build (push) Successful in 2m39s
Build Docker Image / Clean-Registry (push) Successful in 3s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-06 09:25:45 +02:00
StephanRichter 883b90faa7 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 3m0s
Build Docker Image / Clean-Registry (push) Successful in 3s
2026-05-06 08:43:22 +02:00
StephanRichter d3f9ca2c5d Merge commit '2adba956debba2792a3e88ebb70226071949ef0a' into accounting
Build Docker Image / Docker-Build (push) Successful in 2m33s
Build Docker Image / Clean-Registry (push) Successful in 3s
2026-05-06 08:43:04 +02:00
StephanRichter fe18cb8dc2 implemented security measures for account management
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-06 08:37:24 +02:00
StephanRichter 20f47055f6 minor css fix
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-06 08:20:37 +02:00
StephanRichter c6caf7aacc improving messages
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-06 08:20:37 +02:00
StephanRichter cc3a3a23a2 implemented proper messages for accounting events
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-06 08:20:37 +02:00
StephanRichter cfd5362b1d implemented message on transaction creation/update
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-06 08:20:37 +02:00
StephanRichter ca24ada1fd implemented transaction propagation via event bus
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-06 08:20:37 +02:00
StephanRichter a8a4ab0985 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m55s
Build Docker Image / Clean-Registry (push) Successful in 3s
2026-05-05 22:56:26 +02:00
StephanRichter bc9df18307 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m51s
Build Docker Image / Clean-Registry (push) Successful in 4s
2026-05-05 20:34:54 +02:00
StephanRichter a8e3122152 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 3m23s
Build Docker Image / Clean-Registry (push) Successful in 4s
2026-05-05 10:01:16 +02:00
StephanRichter dc1a5f4e94 Merge branch 'bugfix/markdown-edit' into dev
Build Docker Image / Docker-Build (push) Successful in 3m0s
Build Docker Image / Clean-Registry (push) Successful in 4s
2026-05-05 08:27:19 +02:00
StephanRichter 80311c8493 fixed css class
Build Docker Image / Docker-Build (push) Successful in 2m31s
Build Docker Image / Clean-Registry (push) Successful in 3s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-05-05 08:27:06 +02:00
StephanRichter 80153ada13 Merge branch 'main' into dev
Build Docker Image / Docker-Build (push) Successful in 2m33s
Build Docker Image / Clean-Registry (push) Successful in 4s
2026-05-04 20:58:39 +02:00
StephanRichter 9bf9fba9df Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m35s
Build Docker Image / Clean-Registry (push) Successful in 4s
2026-05-04 15:28:02 +02:00
StephanRichter 01d56ca451 Merge branch 'main' into dev
Build Docker Image / Docker-Build (push) Successful in 2m51s
Build Docker Image / Clean-Registry (push) Successful in 3s
2026-05-04 15:13:49 +02:00
StephanRichter b4af8d1876 Merge branch 'bugfix/empty-markdown' into dev
Build Docker Image / Docker-Build (push) Successful in 2m57s
Build Docker Image / Clean-Registry (push) Successful in 3s
2026-05-04 14:39:04 +02:00
StephanRichter 69c8d0fe9c Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 3m8s
Build Docker Image / Clean-Registry (push) Successful in 4s
2026-05-03 14:02:04 +02:00
StephanRichter bf1a6684a7 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m36s
Build Docker Image / Clean-Registry (push) Successful in 4s
2026-04-25 20:15:10 +02:00
StephanRichter 5a47ebae2b Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m28s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-25 10:12:09 +02:00
StephanRichter 9d62f15b8f Merge branch 'improvement/autocomplete' into dev 2026-04-24 11:45:39 +02:00
StephanRichter 5524ea7878 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m31s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-23 23:25:19 +02:00
StephanRichter 3d1850b2d2 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m32s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-23 20:17:25 +02:00
StephanRichter 02283d57ba Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m1s
Build Docker Image / Clean-Registry (push) Successful in 5s
2026-04-23 16:03:21 +02:00
StephanRichter 1768a48e5e Merge branch 'improvemnet/autocomplete-delay' into dev
Build Docker Image / Docker-Build (push) Successful in 2m27s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-23 15:54:18 +02:00
StephanRichter 1cdf825bcb Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m5s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-23 11:10:21 +02:00
StephanRichter 71c86e512d Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m32s
Build Docker Image / Clean-Registry (push) Successful in 5s
2026-04-23 10:37:56 +02:00
StephanRichter 9d8013bc33 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m26s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-22 08:38:09 +02:00
StephanRichter 05733d3b7a improved autocomplete
Build Docker Image / Docker-Build (push) Successful in 2m25s
Build Docker Image / Clean-Registry (push) Successful in 6s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-04-21 09:30:48 +02:00
StephanRichter 71c071bbdd Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m30s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-21 08:27:45 +02:00
StephanRichter 1241fee61d Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m6s
Build Docker Image / Clean-Registry (push) Successful in 5s
2026-04-20 23:04:31 +02:00
StephanRichter d64cb886c9 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m12s
Build Docker Image / Clean-Registry (push) Successful in 5s
2026-04-20 22:38:58 +02:00
StephanRichter ac8149e6bb Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m1s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-20 22:23:05 +02:00
StephanRichter 493b61465b Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m11s
Build Docker Image / Clean-Registry (push) Successful in 5s
2026-04-20 21:55:23 +02:00
StephanRichter df372e9cfd Merge branch 'accounting' into dev 2026-04-20 08:25:39 +02:00
StephanRichter ff58f3ae82 Merge branch 'bugfix/trim-tags' into dev
Build Docker Image / Docker-Build (push) Successful in 2m19s
Build Docker Image / Clean-Registry (push) Successful in 5s
2026-04-19 11:07:54 +02:00
StephanRichter b71db96b47 improved build workflow
Build Docker Image / Docker-Build (push) Successful in 1m56s
Build Docker Image / Clean-Registry (push) Successful in 5s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-04-19 10:45:58 +02:00
StephanRichter 02434419f4 Merge branch 'bugfix/trim-tags' into dev
Build Docker Image / Docker-Build (push) Successful in 2m14s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-04-19 10:40:09 +02:00
StephanRichter bd096dc61f Merge branch 'bugfix/trim-tags' into dev
Build Docker Image / Docker-Build (push) Successful in 2m18s
Build Docker Image / Clean-Registry (push) Successful in -18s
2026-04-18 15:44:37 +02:00
StephanRichter 9f286f3121 Merge branch 'bugfix/trim-tags' into dev
Build Docker Image / Docker-Build (push) Successful in 1m53s
Build Docker Image / Clean-Registry (push) Successful in -18s
2026-04-18 15:28:30 +02:00
StephanRichter 2211f4f39d Merge branch 'bugfix/tag-header' into dev
Build Docker Image / Docker-Build (push) Successful in 3m1s
Build Docker Image / Clean-Registry (push) Successful in -18s
2026-04-18 15:08:02 +02:00
StephanRichter a6b988df3a Merge branch 'accounting' into dev 2026-04-18 15:05:10 +02:00
StephanRichter 1316d3fb1e Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m15s
Build Docker Image / Clean-Registry (push) Successful in -18s
2026-04-15 18:16:37 +02:00
StephanRichter 99fa75a980 Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m17s
Build Docker Image / Clean-Registry (push) Successful in -16s
2026-04-14 23:22:35 +02:00
StephanRichter 6fc590d795 Merge branch 'accounting' into dev 2026-04-14 22:54:44 +02:00
StephanRichter 7afc804586 added menu symbol for accounting
Build Docker Image / Docker-Build (push) Successful in 1m59s
Build Docker Image / Clean-Registry (push) Successful in -17s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-04-14 22:54:03 +02:00
StephanRichter f40692dd3d Merge branch 'accounting' into dev
Build Docker Image / Docker-Build (push) Successful in 2m23s
Build Docker Image / Clean-Registry (push) Successful in -16s
2026-04-14 22:49:23 +02:00
StephanRichter 1c91699bf5 Merge branch 'module/wiki' into dev
Build Docker Image / Docker-Build (push) Successful in 3m18s
Build Docker Image / Clean-Registry (push) Successful in -15s
2026-04-09 09:12:22 +02:00
StephanRichter 9f5e1e0853 Merge branch 'main' into dev 2026-04-01 18:14:24 +02:00
StephanRichter 55dfea65b0 Merge branch 'bugfix/wiki-css' into dev
Build Docker Image / Docker-Build (push) Successful in 2m34s
Build Docker Image / Clean-Registry (push) Successful in -12s
2026-03-30 23:59:17 +02:00
12 changed files with 64 additions and 83 deletions
+2
View File
@@ -53,8 +53,10 @@ jobs:
run: |
TAGS="$(curl -s -u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASS }}" https://${{ secrets.REGISTRY_PATH }}/v2/umbrella/tags/list | jq -r ".tags[]")"
COUNT=$(echo "$TAGS" | wc -l)
echo found $COUNT tags: $TAGS
if [ $COUNT -gt 10 ]; then
REMAIN=$((COUNT - 10))
echo $REMAIN tags will be kept!
echo "$TAGS" | head -n $REMAIN > /tmp/old_tags
else
echo less than 10 tags, skipping cleanup
@@ -3,6 +3,7 @@ package de.srsoftware.umbrella.accounting;
import de.srsoftware.umbrella.core.model.Account;
import de.srsoftware.umbrella.core.model.Transaction;
import de.srsoftware.umbrella.core.model.UmbrellaUser;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
@@ -13,6 +14,8 @@ public interface AccountDb {
void dropTransactionTag(long transactionId, String tag);
Collection<UmbrellaUser> getMembers(long accountId);
Optional<Transaction> lastTransaction(long accountId, String source, String dest, double amount);
Collection<Account> listAccounts(long userId);
@@ -7,11 +7,9 @@ import static de.srsoftware.umbrella.core.ConnectionProvider.connect;
import static de.srsoftware.umbrella.core.ModuleRegistry.tagService;
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
import static de.srsoftware.umbrella.core.constants.Path.*;
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.invalidField;
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.missingField;
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
import static de.srsoftware.umbrella.messagebus.events.Event.EventType.CREATE;
import static java.lang.System.Logger.Level.WARNING;
import com.sun.net.httpserver.HttpExchange;
import de.srsoftware.configuration.Configuration;
@@ -55,6 +53,7 @@ public class AccountingModule extends BaseHandler implements AccountingService {
case TRANSACTION -> {
try {
var transaction = accountDb.loadTransaction(Long.parseLong(path.pop()));
if (!accountDb.getMembers(transaction.accountId()).contains(user.get())) throw forbidden("You are not allowed to access account {id}",Field.ID,transaction.accountId());
yield dropTransaction(transaction, user.get(), path, ex);
} catch (NumberFormatException ignored) {
yield super.doDelete(path,ex);
@@ -128,6 +127,7 @@ public class AccountingModule extends BaseHandler implements AccountingService {
default -> {
try {
var accountId = Long.parseLong(head);
if (!accountDb.getMembers(accountId).contains(user.get())) throw forbidden("You are not allowed to access account {id}",Field.ID,accountId);
yield postToAccount(accountId,path,user.get(),ex);
} catch (NumberFormatException ignored) {
yield super.doPost(path,ex);
@@ -156,7 +156,6 @@ public class AccountingModule extends BaseHandler implements AccountingService {
}
private boolean dropTransactionTag(UmbrellaUser user, Transaction transaction, HttpExchange ex) throws IOException {
LOG.log(WARNING,"Missing permission check in AccountModule.dropTransactionTag!");
var json = json(ex);
if (!json.has(Field.TAG)) throw missingField(Field.TAG);
var tag = json.getString(Field.TAG);
@@ -186,7 +185,7 @@ public class AccountingModule extends BaseHandler implements AccountingService {
}
private boolean getAccount(UmbrellaUser user, long accountId, HttpExchange ex) throws IOException {
LOG.log(WARNING,"Missing authorization check in AccountingModule.getAccount(…)!");
if (!accountDb.getMembers(accountId).contains(user)) throw forbidden("You are not allowed to access account {id}",Field.ID,accountId);
return sendContent(ex, loadAccount(accountId));
}
@@ -225,7 +224,7 @@ public class AccountingModule extends BaseHandler implements AccountingService {
private boolean patchTransaction(UmbrellaUser user, long transactionId, HttpExchange ex) throws IOException {
var transaction = accountDb.loadTransaction(transactionId);
LOG.log(WARNING,"Missing permission check in patchTransaction(…)!");
if (!accountDb.getMembers(transaction.accountId()).contains(user)) throw forbidden("You are not allowed to access account {id}",Field.ID,transaction.accountId());
var oldData = transaction.toMap();
var json = json(ex);
if (json.has(Field.AMOUNT)) transaction.amount(json.getDouble(Field.AMOUNT));
@@ -337,7 +336,6 @@ public class AccountingModule extends BaseHandler implements AccountingService {
}
private boolean postSearchTags(long accountId, UmbrellaUser user, HttpExchange ex) throws IOException {
LOG.log(WARNING,"Missing authorization check in AccountingModule.getAccount(…)!");
var key = body(ex);
if (!key.trim().startsWith("{")) { // search tags that contain value of body
var tags = accountDb.searchTagsContaining(key, accountId);
@@ -7,6 +7,7 @@ import static de.srsoftware.tools.jdbc.Condition.*;
import static de.srsoftware.tools.jdbc.Query.*;
import static de.srsoftware.tools.jdbc.Query.SelectQuery.ALL;
import static de.srsoftware.umbrella.accounting.Constants.*;
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
import static de.srsoftware.umbrella.core.constants.Field.*;
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
import static de.srsoftware.umbrella.core.model.Translatable.t;
@@ -19,6 +20,7 @@ import de.srsoftware.umbrella.core.constants.Field;
import de.srsoftware.umbrella.core.constants.Text;
import de.srsoftware.umbrella.core.model.Account;
import de.srsoftware.umbrella.core.model.Transaction;
import de.srsoftware.umbrella.core.model.UmbrellaUser;
import java.sql.Connection;
import java.sql.SQLException;
import java.time.ZoneOffset;
@@ -146,6 +148,27 @@ public class SqliteDb extends BaseDb implements AccountDb {
}
}
@Override
public Collection<UmbrellaUser> getMembers(long accountId) {
try {
var userIds = new HashSet<Long>();
var rs = select("DISTINCT "+ SOURCE).from(TABLE_TRANSACTIONS).where(ACCOUNT,equal(accountId)).exec(db);
while (rs.next()) try {
userIds.add(Long.parseLong(rs.getString(1)));
} catch (NumberFormatException ignored) {}
rs.close();
rs = select("DISTINCT "+ DESTINATION).from(TABLE_TRANSACTIONS).where(ACCOUNT,equal(accountId)).exec(db);
while (rs.next()) try {
userIds.add(Long.parseLong(rs.getString(1)));
} catch (NumberFormatException ignored) {}
rs.close();
var us = userService();
return userIds.stream().map(us::loadUser).toList();
} catch (SQLException e) {
throw failedToLoadMembers(Text.ACCOUNT);
}
}
@Override
public Optional<Transaction> lastTransaction(long accountId, String source, String dest, double amount) {
try {
@@ -155,7 +155,7 @@
{/if}
{:else}
<Display classes={{editable}} markdown={value} {onclick} {oncontextmenu} title={t('right_click_to_edit')} wrapper={type} />
{#if !value.display}
{#if !value.rendered}
<button onclick={oncontextmenu}>{t('add_object',{object:t('content')})}</button>
{/if}
{/if}
+2 -1
View File
@@ -33,6 +33,7 @@
authors = {...authors, ...data.authors};
loader.offset += loader.limit;
loader.active = false;
console.log({authors});
yikes();
if (Object.keys(data.notes).length) onscroll(null); // when notes were received, check whether they fill up the page
@@ -78,4 +79,4 @@
</svelte:head>
<svelte:window {onscroll} />
<List {notes} />
<List {notes} {authors} />
+1
View File
@@ -64,6 +64,7 @@
<legend class="entity" onclick={() => goToEntity(note)}>{title(note)}</legend>
{/if}
<legend class="time">
{#if !module} {authors[note.user_id].name} {/if}
{note.timestamp.replace('T',' ')}
{#if user.id == note.user_id}
<button class="symbol" onclick={() => drop(note.id)}></button>
+2 -6
View File
@@ -2,7 +2,7 @@
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { api, get } from '../../urls.svelte.js';
import { api, get, post } from '../../urls.svelte.js';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte.js';
import { user } from '../../user.svelte.js';
@@ -104,11 +104,7 @@
async function saveTask(){
const url = api('task/add');
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify(task)
});
const resp = await post(url,task);
if (resp.ok) {
localStorage.removeItem(`task/${task.id}/description`);
if (!assignee) { // if assignee is set, this form was opened within an external context. hence we don`t want to navigate somewhere else!
+6 -23
View File
@@ -3,7 +3,7 @@
import { useTinyRouter } from 'svelte-tiny-router';
import { dragged } from './dragndrop.svelte';
import { api } from '../../urls.svelte';
import { api, drop, patch, post } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte';
import { timetrack } from '../../user.svelte';
@@ -47,10 +47,7 @@
async function deleteTask(){
if (confirm(t('confirm_delete',{element:task.name}))){
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'DELETE'
});
const resp = await drop(url);
if (resp.ok){
deleted = true;
} else {
@@ -70,11 +67,7 @@
ev.stopPropagation();
if (dragged.element.id == task.id) return;
const url = api(`task/${dragged.element.id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'PATCH',
body : JSON.stringify({ parent_task_id : task.id})
});
const resp = await patch(url, { parent_task_id : task.id});
if (resp.ok) {
yikes();
} else {
@@ -90,11 +83,7 @@
show_closed : show_closed
};
if (task.show_closed) data.show_closed = true;
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
const resp = await post(url,data);
if (resp.ok){
children = await resp.json();
yikes();
@@ -112,11 +101,7 @@
async function patchTask(changeset){
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'PATCH',
body : JSON.stringify(changeset)
});
const resp = await patch(url,changeset);
if (resp.ok){
task = await resp.json();
return true;
@@ -145,9 +130,7 @@
if (children && lastEvent && lastEvent.task) {
if (lastEvent.event == 'delete' || lastEvent.task.parent_task_id != task.id){
delete children[lastEvent.task.id];
} else {
children[lastEvent.task.id] = lastEvent.task;
}
} else children[lastEvent.task.id] = lastEvent.task;
}
});
+8 -18
View File
@@ -2,7 +2,7 @@
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { api } from '../../urls.svelte';
import { api, get, patch, post } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte';
@@ -17,7 +17,7 @@
async function add(new_task_id){
let url = api(`task/${new_task_id}`);
let resp = await fetch(url,{ credentials : 'include' });
let resp = await get(url);
if (resp.ok){
yikes();
let newTask = await resp.json();
@@ -27,7 +27,7 @@
}
task.required_tasks_ids.push(new_task_id);
requiredTasks[new_task_id] = newTask;
await patch();
await update();
delete candidates[new_task_id];
} else {
error(resp);
@@ -59,17 +59,11 @@
async function loadTasks(){
if (!task || !task.required_tasks_ids || !task.required_tasks_ids.length) return;
const url = api('task/list');
const res = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify({ids:task.required_tasks_ids})
});
const res = await post(url,{ids:task.required_tasks_ids});
if (res.ok){
yikes();
requiredTasks = await res.json();
} else {
error(resp);
}
} else error(resp);
}
function oninput(){
@@ -84,19 +78,15 @@
return false;
}
async function patch(){
async function update(){
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'PATCH',
body : JSON.stringify({required_tasks_ids:task.required_tasks_ids})
});
const resp = await patch(url,{required_tasks_ids:task.required_tasks_ids});
if (!resp.ok) error(resp);
}
async function unlink(required_task){
task.required_tasks_ids = task.required_tasks_ids.filter(item => item != required_task.id);
patch();
update();
delete requiredTasks[required_task.id];
}
+1 -1
View File
@@ -8,7 +8,7 @@
</script>
<ul>
{#each sortedTasks as task}
{#each sortedTasks as task (task.id)}
<ListTask {states} {task} {lastEvent} siblings={tasks} {est_time} show_closed={show_closed || task.show_closed} />
{/each}
</ul>
+10 -26
View File
@@ -2,7 +2,7 @@
import { onDestroy } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { api, eventStream } from '../../urls.svelte';
import { api, eventStream, get, patch, post } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte';
import { timetrack } from '../../user.svelte.js';
@@ -99,32 +99,24 @@
parent_task_id : +task.id,
show_closed : show_closed
};
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body:JSON.stringify(data)
});
const resp = await post(url,data);
if (resp.ok){
yikes();
children = await resp.json();
} else {
error(resp);
}
} else error(resp);
}
async function loadParent(){
const url = api(`task/${task.parent_task_id}`);
const resp = await fetch(url,{credentials:'include'});
const resp = await get(url);
if (resp.ok){
task.parent = await resp.json();
} else {
error(resp);
}
} else error(resp);
}
async function loadTask(){
const url = api(`task/${id}`);
const resp = await fetch(url,{credentials:'include'});
const resp = await get(url);
if (resp.ok){
yikes();
task = await resp.json();
@@ -132,20 +124,16 @@
loadChildren();
if (task.project_id) loadProject();
if (task.parent_task_id) loadParent();
} else {
error(resp);
}
} else error(resp);
}
async function loadProject(){
const url = api(`project/${task.project_id}`);
const resp = await fetch(url,{credentials:'include'});
const resp = await get(url);
if (resp.ok){
project = await resp.json();
yikes();
} else {
error(await resp.text());
}
} else error(await resp.text());
}
function showClosed(){
@@ -169,11 +157,7 @@
async function update(data){
const url = api(`task/${id}`);
const resp = await fetch(url,{
credentials : 'include',
method : 'PATCH',
body : JSON.stringify(data)
});
const resp = await patch(url,data);
if (resp.ok){
yikes();
let json = await resp.json();