Repository navigation
Slice 1 (Module 03): Doctor profile read/update + specialization column #19
Copy link
Copy link
Open
Labels
afkEligible for the main agent loopEligible for the main agent looppriority:1Priority 1 — bugs default herePriority 1 — bugs default hereqa-readyPR opened, awaiting human QAPR opened, awaiting human QAsliceVertical tracer-bullet sliceVertical tracer-bullet slice
Description
What to build
Add the specialization column to the doctors table and ship the read + partial-update endpoints for a doctor's own profile. The doctor dashboard gains a small read-only display of name + specialization so the slice is verifiable end-to-end. No edit form ships in this module — the PATCH endpoint exists for Module 03's API contract but the UI for editing is explicitly out of scope.
- Drizzle migration:
ALTER TABLE doctors ADD COLUMN specialization text(nullable).pnpm db:pushapplies cleanly to the existing local DB. - Fill in
doctorContractwithgetProfileandupdateProfilets-rest entries. GET /doctors/me/profile→ 200{ userId, firstName, lastName, specialization }behindrequireAuth()+requireRole(['doctor']).PATCH /doctors/me/profile→ 200 with the full updated profile; accepts any combination offirstName,lastName,specialization; empty body{}is a no-op returning the current profile; bumpsupdated_at.- Use case + repository following the layered architecture; structured INFO log on every profile update (acting user id, fields changed).
- Doctor dashboard shows specialization beneath the welcome line (read-only text; "—" or similar when null). No form.
Acceptance criteria
-
GET /doctors/me/profilereturns the authenticated doctor's profile; returns 401 without JWT and 403 with a patient JWT. -
PATCH /doctors/me/profilewith{ specialization: "Cardiology" }updates only that field and returns the new profile. -
PATCH /doctors/me/profilewith{}returns the current profile unchanged (no-op). -
PATCH /doctors/me/profilewith{ firstName, lastName, specialization }updates all three and bumpsupdated_at. - All profile endpoints reject non-doctor JWTs with 403.
- The doctor dashboard displays the doctor's specialization (including the empty/null state).
-
pnpm verifyexits 0.
User stories covered
- US Slice 1: Monorepo scaffold + /health tracer bullet #1: As a doctor, I want to view my own profile (name and specialization), so that I can verify what patients see when browsing the doctor list.
- US Slice 2: Login + role-aware dashboard happy path #2: As a doctor, I want to update my first name, last name, or specialization individually or all at once, so that I can keep my public profile accurate without re-submitting unchanged fields.
Blocked by
- None — can start immediately
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
afkEligible for the main agent loopEligible for the main agent looppriority:1Priority 1 — bugs default herePriority 1 — bugs default hereqa-readyPR opened, awaiting human QAPR opened, awaiting human QAsliceVertical tracer-bullet sliceVertical tracer-bullet slice
Activity
mGasiorek998 commentedon May 7, 2026
Plan: add a nullable specialization column on doctors via Drizzle schema (
pnpm db:pushapplies); fill in doctorContract with getProfile and updateProfile (request/response Zod schemas + 200/401/403); add use cases (get-profile, update-profile) + a small repository helper for the PATCH; mount a newapps/api/src/routes/doctor/doctor-router.tsfromapp.tsfor GET and PATCH /doctors/me/profile, both behind requireAuth + requireRole(['doctor']) inline; integration tests follow the documents.test.ts shape (real DB, signed JWTs for doctor + patient + missing); structureddoctor.profile.updatedlog on every PATCH listing changed fields; web side displays specialization on /doctor below the welcome line, falling back to em-dash when null. Order: contract → schema → repo → use case → route → wiring → web. Tests-first per AC.mGasiorek998 commentedon May 7, 2026
Iteration killed by Operator. Free for retry on next loop start.
mGasiorek998 commentedon May 7, 2026
Implementation PR opened: #26. 6 red→green cycles (one per AC). 11 new API integration tests + 3 new web component tests added; 96 api tests + 12 web tests green;
pnpm verifyclean.