Skip to content

Implement GET /me (resolve company + role from Keycloak sub) #14

Description

@JulienLouisSchneider

Issue 4 — Implement GET /me (resolve company + role from Keycloak sub)

Description

Add an authenticated endpoint that returns the current user’s company context based on sub from the JWT and the membership table.

Checklist

  • Add route GET /me under auth middleware.

  • Implement handler:

    • reads sub from context

    • queries company_members by keycloak_user_id = sub

    • returns JSON: { "company_id": <id>, "role": "<role>" }

    • if no membership: return 404 with { "code": "NOT_LINKED" }

  • Add minimal tests (or integration test) for linked vs not linked.

  • Update README with the endpoint description.

Acceptance Criteria

  • With valid token + membership row → 200 and correct company_id/role.

  • With valid token + no membership row → 404 with code=NOT_LINKED.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions