Skip to content

feat: add profile patch endpoints and integrate with auth middleware#105

Merged
AlperKartkaya merged 8 commits into
developmentfrom
backend/Profile-patchEndpoints
Mar 22, 2026
Merged

feat: add profile patch endpoints and integrate with auth middleware#105
AlperKartkaya merged 8 commits into
developmentfrom
backend/Profile-patchEndpoints

Conversation

@mehmetcangurbuz08

@mehmetcangurbuz08 mehmetcangurbuz08 commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

This PR adds patch endpoints to the profiles module and protects related routes with auth middleware.

Changes:

Added GET /me and profile patch flows
Added patch endpoints for me, physical, health, location, and privacy
Enforced JWT-based user access on profiles routes
Standardized validation and error responses
Fixed privacy enum type issue in repository query
Testing:

Manually tested endpoints with a valid auth token
Verified GET /me response after patch operations

Closes #106

@AlperKartkaya AlperKartkaya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a well-implemented good feature. There is just one critical blocker to address: PATCH /api/profiles/me is currently broken for partial updates after a profile already exists.

When tested this flow:

  1. create profile with firstName + lastName -> works
  2. patch only phoneNumber -> returns 500

Root cause seems to be in backend/src/modules/profiles/repository.js: upsertProfileByUserId() still tries to insert null first_name / last_name, but those DB columns are NOT NULL, so Postgres rejects the request before the conflict update helps.

This is merge-blocking because a normal profile update flow is broken.

Can you please consider fixing this by using update logic for existing profiles and keeping the create/upsert path only for first profile creation?

@AlperKartkaya

Copy link
Copy Markdown
Contributor

The issue is fixed now, merging the PR.

@AlperKartkaya
AlperKartkaya merged commit 22e048d into development Mar 22, 2026
@mehmetcangurbuz08
mehmetcangurbuz08 deleted the backend/Profile-patchEndpoints branch March 29, 2026 15:48
@mehmetcangurbuz08 mehmetcangurbuz08 self-assigned this Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend][MVP] Add profile patch endpoints and integrate auth middleware

2 participants