feat: Add pause/resume functionality to time tracking
Add pausedAt and pausedDuration columns to time_entries table. New pause/resume endpoints with audit logging. Duration calculations now correctly exclude paused time across start, stop, auto-stop, and edit flows. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2
src/db/migrations/0010_add_timer_pause.sql
Normal file
2
src/db/migrations/0010_add_timer_pause.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE "time_entries" ADD COLUMN IF NOT EXISTS "paused_at" timestamp;
|
||||
ALTER TABLE "time_entries" ADD COLUMN IF NOT EXISTS "paused_duration" integer NOT NULL DEFAULT 0;
|
||||
@@ -282,6 +282,8 @@ export const timeEntries = pgTable('time_entries', {
|
||||
description: text('description'), // popis práce
|
||||
isRunning: boolean('is_running').default(false).notNull(), // či práve beží
|
||||
isEdited: boolean('is_edited').default(false).notNull(), // či bol editovaný
|
||||
pausedAt: timestamp('paused_at'), // kedy bola aktuálna pauza spustená (null ak nepauznutý)
|
||||
pausedDuration: integer('paused_duration').default(0).notNull(), // celkový čas pauzy v sekundách
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user