Skip to content

My Day & Owner-Scoped Views

Views are system-defined, read-only collections of Tasks aggregated across the Lists a user owns or is a Member of, respecting the authorization boundary (Product Brief §5.1/§5.2). “My Day” is the curated daily-focus view.

The My Day data path — repository, local-day boundary, client reconciler, and outbox mutations:

flowchart LR
  REPO["createMyDayRepository(db)<br/>(db/repositories/my-day.ts)"] --> TBL[("myDayEntries<br/>(D1)")]
  SYNC["addToMyDay() / removeFromMyDay()<br/>(lib/offline/sync.ts)"] --> DEX[("Dexie db.myDay<br/>(optimistic)")]
  SYNC -->|"enqueue myday.add / myday.remove"| API{{"Worker API"}}
  API --> REPO
  RECON["reconcileMyDay()"] --> DEX
  API --> RECON
  LT["localTodayISO()<br/>(lib/date/local-today.ts)"] --> RECON
  NOTIFY["notifyUsers()<br/>(owner-scoped signals)"] --> SYNC
  • Backed by the myDayEntries table and createMyDayRepository(db) (src/db/repositories/my-day.ts). Entries are per-user “Add to My Day” picks.
  • Resets each calendar day at local midnight: Tasks are removed from the My Day view, never deleted from their source Lists; the user re-adds them (Product Brief §5.2 “View rules”).
  • Client-side, My Day membership reconciles via reconcileMyDay(...) (see Sync-Core Reconcilers); the outbox carries myday.add / myday.remove mutations.

Adding a Task to My Day is an optimistic, owner-scoped write:

sequenceDiagram
  participant U as User
  participant SYNC as addToMyDay()
  participant LT as localTodayISO()
  participant DEX as Dexie db.myDay
  participant API as Worker API
  participant REPO as createMyDayRepository
  U->>SYNC: "Add to My Day" (taskId)
  SYNC->>LT: localTodayISO()
  LT-->>SYNC: addedOn (local YYYY-MM-DD)
  SYNC->>DEX: put {taskId, addedOn, _sync: pending}
  SYNC->>API: enqueue myday.add + replayOutbox()
  API->>REPO: upsert(userId, taskId, addedOn)
  API-->>DEX: reconcileMyDay() on ACK

“My Day”, “Important” (starred), “Planned” (has due date), “Assigned to me” (current user is assignee), and “Tasks” (full set). Views aggregate across owned + member Lists and never show Tasks from Lists the user can’t access. My Day and “Assigned to me” are owner-scoped — their change signals notify only the acting user (see notifyUsers in DB Schema & Notify-Affected), unlike list-scoped surfaces.

Related: DB Schema & Notify-Affected (recipient computation), Sync-Core Reconcilers (reconcileMyDay).