Skip to content

Slice 1 (Module 03): Doctor profile read/update + specialization column #19

Open

Description

@mGasiorek998

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:push applies cleanly to the existing local DB.
  • Fill in doctorContract with getProfile and updateProfile ts-rest entries.
  • GET /doctors/me/profile → 200 { userId, firstName, lastName, specialization } behind requireAuth() + requireRole(['doctor']).
  • PATCH /doctors/me/profile → 200 with the full updated profile; accepts any combination of firstName, lastName, specialization; empty body {} is a no-op returning the current profile; bumps updated_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/profile returns the authenticated doctor's profile; returns 401 without JWT and 403 with a patient JWT.
  • PATCH /doctors/me/profile with { specialization: "Cardiology" } updates only that field and returns the new profile.
  • PATCH /doctors/me/profile with {} returns the current profile unchanged (no-op).
  • PATCH /doctors/me/profile with { firstName, lastName, specialization } updates all three and bumps updated_at.
  • All profile endpoints reject non-doctor JWTs with 403.
  • The doctor dashboard displays the doctor's specialization (including the empty/null state).
  • pnpm verify exits 0.

User stories covered

Blocked by

  • None — can start immediately

Activity

  1. added
    afkEligible for the main agent loop
    priority:1Priority 1 — bugs default here
    sliceVertical tracer-bullet slice
    in-progressCurrently being worked on by an iteration (semaphore)
    on May 7, 2026
  2. mGasiorek998 commented on May 7, 2026

    @mGasiorek998
    Author

    Plan: add a nullable specialization column on doctors via Drizzle schema (pnpm db:push applies); 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 new apps/api/src/routes/doctor/doctor-router.ts from app.ts for 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); structured doctor.profile.updated log 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.

  3. removed
    in-progressCurrently being worked on by an iteration (semaphore)
    on May 7, 2026
  4. mGasiorek998 commented on May 7, 2026

    @mGasiorek998
    Author

    Iteration killed by Operator. Free for retry on next loop start.

  5. mGasiorek998 commented on May 7, 2026

    @mGasiorek998
    Author

    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 verify clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    afkEligible for the main agent looppriority:1Priority 1 — bugs default hereqa-readyPR opened, awaiting human QAsliceVertical tracer-bullet slice

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions