Compare commits

...

4 Commits

Author SHA1 Message Date
StephanRichter 7ac76087e7 preparing for journal with timestamps
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-06-17 15:14:23 +02:00
StephanRichter 1d7b47aaa0 made project page the entrypoint
Build Docker Image / Docker-Build (push) Successful in 2m39s
Build Docker Image / Clean-Registry (push) Successful in 5s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-06-17 15:07:44 +02:00
StephanRichter f49b44cd56 Merge branch 'bugfix/pipeline'
Build Docker Image / Clean-Registry (push) Successful in 6s
Build Docker Image / Docker-Build (push) Failing after 14m18s
2026-06-17 09:21:55 +02:00
StephanRichter bcc1182dea improved time table: now updating started time when starting new time track
Build Docker Image / Docker-Build (push) Successful in 2m25s
Build Docker Image / Clean-Registry (push) Failing after 10m18s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-06-17 09:14:57 +02:00
4 changed files with 32 additions and 13 deletions
+1 -1
View File
@@ -90,7 +90,7 @@
{#if messages.warning}
<span class="warn">{@html messages.warning}</span>
{/if}
<Route path="/" component={User} />
<Route path="/" component={ProjectList} />
<Route path="/account/:id" component={Account} />
<Route path="/accounting" component={Accounts} />
<Route path="/accounting/new" component={NewAccount} />
+11 -3
View File
@@ -1,7 +1,7 @@
<script>
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { api, drop, patch, post } from '../../urls.svelte.js';
import { api, drop, get, patch, post } from '../../urls.svelte.js';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte.js';
import { timetrack } from '../../user.svelte.js';
@@ -41,10 +41,18 @@
});
async function addTime(task_id){
const url = api(`time/track_task/${task_id}`);
const resp = await post(url,now()); // create new time or return time with assigned tasks
let url = api(`time/track_task/${task_id}`);
let resp = await post(url,now()); // create new time or return time with assigned tasks
if (resp.ok) {
const track = await resp.json();
if (timetrack.running){
url = api(`time/${timetrack.running.id}`);
resp = await get(url);
if (resp.ok){
let previous = await resp.json();
times[previous.id] = previous;
}
}
timetrack.running = track;
} else {
error(resp);
@@ -13,6 +13,8 @@ import de.srsoftware.umbrella.core.BaseDb;
import de.srsoftware.umbrella.messagebus.events.Event;
import java.sql.Connection;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
public class SqliteDb extends BaseDb implements JournalDb{
public SqliteDb(Connection connection) {
@@ -33,13 +35,14 @@ public class SqliteDb extends BaseDb implements JournalDb{
var sql = """
CREATE TABLE IF NOT EXISTS {0} (
{1} INTEGER PRIMARY KEY,
{2} INTEGER,
{3} VARCHAR(255) NOT NULL,
{4} VARCHAR(16) NOT NULL,
{5} TEXT
{2} LONG NOT NULL,
{3} INTEGER,
{4} VARCHAR(255) NOT NULL,
{5} VARCHAR(16) NOT NULL,
{6} TEXT
);
""";
sql = format(sql,TABLE_JOURNAL,ID,USER_ID,MODULE,ACTION,DESCRIPTION);
sql = format(sql,TABLE_JOURNAL,ID,TIMESTAMP,USER_ID,MODULE,ACTION,DESCRIPTION);
try {
db.prepareStatement(sql).execute();
} catch (SQLException e) {
@@ -50,8 +53,9 @@ public class SqliteDb extends BaseDb implements JournalDb{
@Override
public void logEvent(Event<?> event) {
try {
insertInto(TABLE_JOURNAL,USER_ID,MODULE,ACTION,DESCRIPTION)
.values(event.initiator().id(), event.module(), event.eventType(), event.describe())
var timestamp = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC);
insertInto(TABLE_JOURNAL,TIMESTAMP,USER_ID,MODULE,ACTION,DESCRIPTION)
.values(timestamp,event.initiator().id(), event.module(), event.eventType(), event.describe())
.execute(db).close();
} catch (SQLException e) {
throw databaseException(ERROR_WRITE_EVENT,event.eventType(),event.initiator().name());
@@ -79,8 +79,15 @@ public class TimeModule extends BaseHandler implements TimeService {
if (user.isEmpty()) return unauthorized(ex);
var head = path.pop();
return switch (head) {
case STARTED -> getStartedTime(user.get(),ex);
case null, default -> super.doGet(path,ex);
case STARTED -> getStartedTime(user.get(),ex);
case null -> super.doGet(path,ex);
default -> {
try {
yield sendContent(ex,timeDb.load(Long.parseLong(head)));
} catch (NumberFormatException ignored) {
yield super.doGet(path,ex);
}
}
};
} catch (UmbrellaException e){
return send(ex,e);