74 Commits

Author SHA1 Message Date
Bas van Rossem
70ac27ec8e style: align oxfmt to trailing-comma 'all' and normalize code
All checks were successful
Build and Push Docker Image / build (push) Successful in 28s
The repo was authored prettier-style (trailing-comma 'all') but .oxfmtrc.json
was set to 'es5', so every formatted file diverged. Switch the config to 'all'
to match the existing code, ignore docs/** and **/drizzle/** (prose + generated
snapshots the formatter should not own), and reformat the source tree once for
consistency. No behavioural change; all suites green (api 60, worker 28, admin 21).
2026-06-17 21:36:18 +02:00
Bas van Rossem
1807f2b6d6 docs: pause-accounting + reorder session log
Finalize the pause-accounting + reorderable-handelingen + login-tab-fix
feature: session log (goal/work/verification/outcome), a one-line roadmap
status note, and an oxfmt pass over the changed files that strips a stray
trailing comma after the last call argument in the worker Stopwatch (es5
trailing-comma style) — pure formatting, tests stay green.
2026-06-17 21:24:16 +02:00
Bas van Rossem
e48df48376 feat(admin): reorder handelingen with up/down arrows 2026-06-17 21:18:07 +02:00
Bas van Rossem
0b0a6bd073 feat(admin): show paused sessions in live view; reset to live on logout
- Live cards freeze the worked timer at paused_at and show an amber
  "Gepauzeerd" badge plus a "Pauze H:MM:SS" total when paused.
- AuthContext.signOut resets the path to / so the next admin login lands
  on Live rather than the tab it logged out from.
2026-06-17 21:14:15 +02:00
Bas van Rossem
a7c8925b3c feat(deploy): build + serve worker and admin as static nginx images
All checks were successful
Build and Push Docker Image / build (push) Successful in 53s
- per-app Dockerfiles (vite build → nginx) + SPA nginx.conf
- Gitea workflow pushes 3 images; frontends bake VITE_API_URL
- docker-compose.prod.yml (registry images, solelog_network) + .env.prod.example
- docker-compose.yml runs the full stack locally; add .dockerignore
2026-06-17 21:11:32 +02:00
Bas van Rossem
1765f4036c fix(worker): show paused time in history; reset to stopwatch on logout 2026-06-17 21:10:01 +02:00
Bas van Rossem
ce396ecf2d feat(worker): server-authoritative pause/resume on the stopwatch 2026-06-17 21:06:10 +02:00
Bas van Rossem
56e0162230 feat(api): orderable activities + admin reorder endpoint 2026-06-17 20:58:06 +02:00
Bas van Rossem
974ecb120d feat(api): server-authoritative pause/resume + worked-time stop + CSV paused
Add user-scoped POST /api/sessions/:id/pause and /resume endpoints,
mirroring the stop handler's ownership/lookup and 401/404/409 guards.
Pause sets paused_at (status stays active); resume folds the open span
into paused_seconds and clears paused_at.

Change stop to fold any open pause span into paused_seconds, then set
duration_seconds = max(0, round((end-start)/1000) - paused_seconds) so
saved duration is worked time, and clear paused_at.

Add a "Paused Duration" column to /api/export (after "Total Duration")
using formatDuration(paused_seconds).

Products affected: SoleLog backend (apps/api)
2026-06-17 20:54:42 +02:00
Bas van Rossem
0d82b6efbc feat(shared,api): add pause + sort_order columns and contracts
Adds server-side pause accounting and activity ordering primitives.
- WorkSession contract gains paused_seconds (number) and paused_at (ISO string | null).
- Activity contract gains sort_order (number); new ReorderActivitiesInput zod.
- work_sessions += paused_seconds (int NOT NULL DEFAULT 0) + paused_at (timestamp_ms nullable).
- activities += sort_order (int NOT NULL DEFAULT 0).
- toWorkSession / toActivity map the new fields; generated migration 0003.

The new fields are additive; existing api/worker/admin tests stay green.

Products affected: SoleLog backend (apps/api), shared contracts (packages/shared)
2026-06-17 20:49:56 +02:00
Bas van Rossem
eae9a53a26 fix(docker): drop COPY .yarn/ — dir is gitignored, absent in CI builds
All checks were successful
Build and Push Docker Image / build (push) Successful in 37s
2026-06-17 20:45:53 +02:00
Bas van Rossem
cbfcb4a414 docs: spec + plan for pause accounting, reorder, login-tab fix 2026-06-17 20:43:19 +02:00
Bas van Rossem
660cbe50c8 ci(docker): build and push image to Gitea registry on push to main
Some checks failed
Build and Push Docker Image / build (push) Failing after 28s
2026-06-17 20:42:58 +02:00
Bas van Rossem
76ad235c9f docs(admin): phase 3a session log + roadmap status 2026-06-17 19:17:20 +02:00
Bas van Rossem
c0d9d21991 feat(admin): activity management (handelingen CRUD) 2026-06-17 19:11:50 +02:00
Bas van Rossem
67dd0d398f feat(admin): live active-work view (5s refresh) 2026-06-17 19:07:36 +02:00
Bas van Rossem
286e2d29db feat(admin): sidebar shell + routing 2026-06-17 19:03:35 +02:00
Bas van Rossem
77659edf8e feat(admin): bearer auth with admin-only gate + login screen 2026-06-17 18:59:43 +02:00
Bas van Rossem
682a9dce44 feat(admin): scaffold Vite+React admin workspace 2026-06-17 18:56:28 +02:00
Bas van Rossem
02b7522b87 feat(api): include role in /api/me + allow admin origin in CORS
Add `role: Role` to the shared `PublicUser` contract and return it from
`GET /api/me` (defaulting to 'worker' when the session user has no role).
This lets the planned admin app gate access by role.

Also add the admin dev origin `http://localhost:5174` to the default
`WEB_ORIGINS` (env.ts) and to `.env.example`, so the admin SPA on :5174 can
reach the API at :3000 cross-origin (drives both hono/cors and better-auth
trustedOrigins).
2026-06-17 18:53:39 +02:00
Bas van Rossem
bb0a0b2a57 docs(admin): fold admin-origin CORS into phase 3a Task 1 2026-06-17 18:49:16 +02:00
Bas van Rossem
7cdc88e824 docs(admin): phase 3a spec + implementation plan 2026-06-17 18:46:11 +02:00
Bas van Rossem
6fce7a7197 docs(roadmap): fold activity-management UI port into Phase 3 scope 2026-06-17 18:29:40 +02:00
Bas van Rossem
7d7af335dd docs: log Phase 2 follow-up (worker logout + Account screen) 2026-06-17 18:24:07 +02:00
Bas van Rossem
1631c1698d feat(worker): add logout + replace admin-only settings with Account screen
The Instellingen tab was activity management, which Phase 2 made admin-only —
workers saw add/edit/delete controls that all 403. Replace it with an Account
tab showing the signed-in name/email (via /api/me) and an Uitloggen button
(wires the existing AuthContext signOut). Activity management belongs to the
Phase 3 admin app, so the worker client drops the Settings screen and its
now-unused activity-mutation hooks (useActivities read stays).

Products affected: SoleLog worker client (apps/worker).
2026-06-17 18:23:42 +02:00
Bas van Rossem
3d8524c827 docs: Phase 2 accounts & roles — roadmap, README, session log 2026-06-17 18:04:19 +02:00
Bas van Rossem
7d200eb8fc feat(worker): login-only client (admin creates users) 2026-06-17 17:53:20 +02:00
Bas van Rossem
bd2d859e92 feat(api): seed dev admin + worker via admin createUser 2026-06-17 17:50:18 +02:00
Bas van Rossem
dc8f550665 feat(api): admin-only cross-user work-session views (/api/admin/sessions) 2026-06-17 17:47:17 +02:00
Bas van Rossem
f2cc0973c7 feat(api): role-aware session helper + admin-only activity writes 2026-06-17 17:43:37 +02:00
Bas van Rossem
c73fa0f898 feat(api): add better-auth admin plugin + close public sign-up (migration 0002) 2026-06-17 17:36:26 +02:00
Bas van Rossem
f6bd8eb036 test(api): centralize auth helpers on server-side createUser 2026-06-17 17:29:46 +02:00
Bas van Rossem
8bfdfb736e feat(shared): add Role enum + admin user fields on WorkSession contract 2026-06-17 17:23:20 +02:00
Bas van Rossem
decb158044 docs: session log for cleanup + Phase 1 (web client) 2026-06-17 17:06:28 +02:00
Bas van Rossem
ec2bb7eec9 feat(api): seed a dev login account (worker@solelog.local) for testing
db:seed now also creates a ready-made dev account via better-auth (properly
hashed), idempotent, and SKIPPED when NODE_ENV=production so no known-password
account ships to prod. Credentials: worker@solelog.local / werkplaats123.
Documented in the worker README. API tests 37/37 green; verified live (sign-in
returns a bearer token; /api/me returns the user).
2026-06-17 17:05:56 +02:00
Bas van Rossem
34c48d6353 feat(api): drive CORS + trusted origins from CORS_ORIGINS env
Phone/LAN testing previously required editing both app.ts (cors origin) and
auth.ts (better-auth trustedOrigins). Now both read env.WEB_ORIGINS, parsed from
a comma-separated CORS_ORIGINS env var (default http://localhost:5173). To test
from a phone, set CORS_ORIGINS to include the LAN origin and restart the API — no
code edit. Documented in .env.example. Also fixed the worker README (db:migrate
creates ./data/app.db, not ./.tmp; phone step now uses CORS_ORIGINS). API tests
36/36 green; typecheck clean.
2026-06-17 16:50:21 +02:00
Bas van Rossem
bd8e8aff2a docs(worker): run instructions and Phase 1 verification 2026-06-17 16:37:28 +02:00
Bas van Rossem
134e01a2e8 feat(worker): Geschiedenis screen with session list and CSV export 2026-06-17 16:30:34 +02:00
Bas van Rossem
5af5a9c2bb feat(worker): server-authoritative Stopwatch screen with active-session recovery 2026-06-17 16:24:56 +02:00
Bas van Rossem
1ecad6bbb4 feat(worker): Instellingen screen — activities CRUD per zooltype 2026-06-17 16:17:37 +02:00
Bas van Rossem
75679256cd feat(worker): auth gate, Dutch login screen, router and 3-tab shell 2026-06-17 16:11:18 +02:00
Bas van Rossem
3511fd8a89 feat(worker): scaffold Vite+React PWA with token storage and typed API client 2026-06-17 16:03:41 +02:00
Bas van Rossem
35f9aa5574 feat(api): seed reference activities and enable CORS for the worker SPA 2026-06-17 15:54:52 +02:00
Bas van Rossem
85184d3287 feat(api): user-scoped CSV export matching legacy format 2026-06-17 15:49:20 +02:00
Bas van Rossem
b067bb65b0 feat(api): session history and active-session recovery endpoints 2026-06-17 15:45:08 +02:00
Bas van Rossem
940b06fd91 feat(api): server-authoritative session start/stop/discard with ownership scoping 2026-06-17 15:40:07 +02:00
Bas van Rossem
5e61b7720d feat(api): user-scoped activities CRUD with shared auth helper 2026-06-17 15:34:42 +02:00
Bas van Rossem
57809985fd feat(api): add activities + work_sessions domain schema and shared contracts 2026-06-17 15:29:14 +02:00
Bas van Rossem
40a2512dfd docs(plan): Phase 1 worker-timing plan (web client, replaces Expo plan) 2026-06-17 15:26:23 +02:00
Bas van Rossem
27ae67449b docs(plan): Phase 1 worker-timing implementation plan 2026-06-17 15:07:43 +02:00