feat: layered authorization and the participant-facing redesign #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/layered-authorization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This branch grew well past its first commit. It now carries the layered authorization model, the participant-facing redesign built on it, the course and webinar work that preceded that, and a set of rules and fixes found while walking the product as each persona.
Authorization and reporting
Course, material, and webinar
Redesign (20 Sep)
Rules and fixes found while walking the product (21 Sep)
start_date, server and client: the outline locks every item, the material endpoints refuse a participant, article bodies are withheld from the list, and the course page says when instead of what is next. Documented indocs/training-lifecycle.md.Developer experience
/prand/shipskills.Validation
go build ./... && go vet ./... && go test ./...insidenix develop— green (21 Sep).web:tsc --noEmit,eslint, andvitest run(33 files, 171 tests) — green.Commits (116)
Full list, newest first
🤖 Generated with Claude Code
Participant catalog now shows a 4-column card grid (16:9 covers with CoverFallback, kind/status pills, org tags) with enrollment status overlay per card: Lanjutkan·N%, Terdaftar, Selesai, Daftar, Tonton. Controls: kind chips with counts (Semua·N, Pelatihan·N, Webinar·N, Ber-JP), search, sort (terbaru/deadline/JP), filter button. Active filters shown as removable chips. Mobile: horizontal card rows, sticky controls, bottom sheet filter with sort radios, rumpun/penyelenggara/status chip toggles, and "Tampilkan N pelatihan" preview count. Pagination: load-more (12 per page), hidden when total ≤ 12. Admin catalog ("Kelola pelatihan") unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>Enrollment enrichment: - Enrich enrollment response with participant type, email, NIP, organization ID and name (joined from participants/users/organizations) - Add rejection_reason and rejection_note fields to enrollment - Add last_activity_at timestamp, updated on every MarkActivity call - PUT /enrollments/:id/reject now accepts {reason, note} body - POST /enrollments/bulk-approve for batch approval (up to 50) Certificate and training: - Add verification_url to certificate response (computed from token) - Add current_enrollments count to training response Dashboard: - Add completed_this_month and completed_last_month to stats (enables "+N vs last month" delta in admin summary cards) Webinar: - GET /api/webinars/mine returns upcoming sessions for enrolled trainings Session management: - DELETE /api/auth/sessions invalidates all existing tokens by setting logged_out_all_at; the /auth/me handler checks JWT iat against it - Actor now carries IssuedAt from the JWT claims Participant profile: - PUT /api/participants/:id/avatar for photo upload (JPEG/PNG, 5MB) - GET /api/participants/:id/avatar to serve the photo - has_avatar boolean in participant response Admin notes (new package adminnote): - GET/POST /api/users/:id/notes, DELETE /api/users/:id/notes/:noteId - Admin-only, stores free-text notes on participant profiles Notification preferences (new package notification): - GET/PUT /api/notifications/preferences - Per-user email toggles (enrollment, certificate, reminder) Organization abbreviation: - Add abbreviation field to organizations table, Organization struct, OrgRef, and all queries that return them - Migration 053 backfills from name (first word when all-caps) Migrations: 052_backend_enrichment.sql, 053_organization_abbreviation.sql TypeScript types updated to match all new fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>The profile's Pelatihan tab asked /api/participants/{id}/enrollments, an endpoint the server does not have, swallowed the error, and matched on a status word ("active") the server never sends — so it was always empty and the stat cards always read zero. It now narrows the admin's enrolment list to the one participant, fills organisation, JP, and deadline from the training list, and uses the enrolment's own status words. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>feat: add layered organization authorizationto feat: layered authorization and the participant-facing redesignSaving a phone number from Profil erased the participant's NIP, unit kerja, jabatan, and every biodata field, and with the NIP gone the ASN verification was reset too: PUT /api/participants/{id} overwrote every column, and the contact form sends only the phone. An update is now partial. An optional field that is absent or null keeps its stored value and an empty string clears it; the verification reset compares against the same expression, so a field left out never counts as a change. The admin's edit form and the contact form send "" to clear, since leaving a field out now means "keep it". The instansi pair is checked against the row the update produces rather than the request alone, so clearing only the name can no longer strand a category without one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>