feat: add profile patch endpoints and integrate with auth middleware#105
Merged
Conversation
mehmetcangurbuz08
requested review from
AlperKartkaya,
berat-sayin and
delibas-rojhat
March 22, 2026 15:49
AlperKartkaya
requested changes
Mar 22, 2026
AlperKartkaya
left a comment
Contributor
There was a problem hiding this comment.
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:
- create profile with
firstName+lastName-> works - patch only
phoneNumber-> returns500
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?
Contributor
|
The issue is fixed now, merging the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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