Unify time tracking on server-backed entries with updateRunning.

Consolidates dashboard and invoice timers onto shared time-entry APIs so clock-in state, invoice linking, and clock-out flow stay consistent across surfaces.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-17 22:36:39 -04:00
co-authored by Cursor
parent 81a0ce33a4
commit 5c28b33e9f
15 changed files with 730 additions and 373 deletions
+4 -1
View File
@@ -1,5 +1,5 @@
import { relations, sql } from "drizzle-orm";
import { index, pgTableCreator } from "drizzle-orm/pg-core";
import { index, pgTableCreator, uniqueIndex } from "drizzle-orm/pg-core";
/**
* This is an example of how to use the multi-project schema feature of Drizzle ORM. Use the same
@@ -720,6 +720,9 @@ export const timeEntries = createTable(
index("time_entry_client_id_idx").on(t.clientId),
index("time_entry_started_at_idx").on(t.startedAt),
index("time_entry_ended_at_idx").on(t.endedAt),
uniqueIndex("time_entry_one_running_per_user_idx")
.on(t.createdById)
.where(sql`${t.endedAt} is null`),
],
);