Skip to content

fix(api): include profile_id in profile creation response#144

Open
sehr-abrar wants to merge 9 commits into
ascherj:mainfrom
sehr-abrar:fix/78-profile-response-missing-profile-id
Open

fix(api): include profile_id in profile creation response#144
sehr-abrar wants to merge 9 commits into
ascherj:mainfrom
sehr-abrar:fix/78-profile-response-missing-profile-id

Conversation

@sehr-abrar

@sehr-abrar sehr-abrar commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Profile creation returned the identifier only as id, but clients expect a
profile_id field to use in follow-up requests like GET /profiles/{profile_id}.
This PR adds profile_id to the ProfileResponse schema, mapped from the existing
id. The id field is unchanged, so the change is additive and backward-compatible.

Issue

Closes #78

Changes

  • api/schemas/profile.py: added a profile_id computed field to ProfileResponse
    that returns the model's id. A plain profile_id: UUID field would not work
    because the schema uses from_attributes and the ORM object has .id, not
    .profile_id, so the value is derived from id instead.
  • tests/unit/test_profile_schema.py: new test module (5 tests) for the new field
    and backward compatibility.

Testing

  • Unit tests pass (make test-unit) (see pre-existing failures note)
  • Integration tests pass (make test-integration) (N/A; the repo has no integration tests yet, so this collects 0 tests)
  • Linter passes (make lint) (see pre-existing failures note)
  • Type checker passes (make typecheck)
  • New/updated tests cover the changes

New tests in tests/unit/test_profile_schema.py cover: profile_id is present in
the response, it equals both the source id and the response id, id is still
present for backward compatibility, profile_id serializes to the same UUID string
as id in JSON, and profile_id is present when all optional fields are None.

Manual verification:

  1. git checkout fix/78-profile-response-missing-profile-id
  2. python -m pytest tests/unit/test_profile_schema.py -v (expect 5 passed)
  3. With the app running, POST /profiles and confirm the JSON body now includes
    profile_id alongside id.

Pre-existing failures (unrelated to this PR): main already fails checks in modules
this PR does not touch. On main, make test-unit reports 55 failing tests (e.g.
test_tech_detector.py, test_skill_extractor.py) and make lint reports about 161
ruff errors in those same modules. After this PR the counts do not increase (unit
failures 55 to 53, with the 5 new tests passing), and the two files I changed pass
ruff, black, and mypy individually. This PR does not try to fix the pre-existing failures.

Notes for Reviewers

  • Kept id on purpose: frontend/src/components/ProfileForm.tsx reads profile.id
    from the create response, so removing or renaming it would break the frontend.
    The change only adds profile_id.
  • ProfileResponse is shared by the create, get, and update endpoints in
    api/routes/profiles.py, so profile_id now appears in all three responses.
    This is intended and safe since it only adds a field.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API response for profile creation doesn't include the profile_id field

1 participant