feat: add public endpoint to create member identity (CM-1070)#3969
Merged
feat: add public endpoint to create member identity (CM-1070)#3969
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new public API endpoint to create member identities and extends DAL bulk-insert helpers to optionally return inserted rows, enabling the endpoint to return the created identity while enforcing conflict rules.
Changes:
- Add
POST /api/v1/members/:memberId/identitiespublic endpoint with conflict detection and audit logging. - Extend
prepareBulkInsertand member-identity insert DAL functions to supportRETURNING *via areturnRowsflag. - Rename/extend identity-existence check to optionally filter by identity
typeand includeverifiedstatus.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| services/libs/data-access-layer/src/utils.ts | Adds optional RETURNING * support to bulk insert query builder. |
| services/libs/data-access-layer/src/members/identities.ts | Adds typed identity existence check with optional type filter and returnRows support for bulk insert. |
| backend/src/services/member/memberIdentityService.ts | Updates service to use the renamed identity existence check helper. |
| backend/src/api/public/v1/members/index.ts | Registers new public POST route for creating identities. |
| backend/src/api/public/v1/members/identities/createMemberIdentity.ts | Implements the new public endpoint with validation, conflict checks, insert, and response mapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
backend/src/api/public/v1/members/identities/createMemberIdentity.ts
Outdated
Show resolved
Hide resolved
backend/src/api/public/v1/members/identities/createMemberIdentity.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
backend/src/api/public/v1/members/identities/createMemberIdentity.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
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.

Summary
POST /api/v1/members/:memberId/identitiesendpoint to create member identitiesinsertManyMemberIdentities/prepareBulkInsert DALmethodsNote
Medium Risk
Adds a new public write endpoint and changes identity-conflict checks and insert semantics; mistakes could allow duplicate/incorrect identity association or affect callers relying on bulk insert behavior.
Overview
Adds
POST /api/v1/members/:memberId/identitiesto create a member identity with request validation, audit logging, andupdatedAttouch to trigger merge suggestions.Updates identity conflict detection to use a renamed/expanded DAL helper (
checkMemberIdentityExistence) that can filter bytypeand returnsverified, and enforces 409s when the identity already exists on the member or is verified on another member.Extends DAL bulk insert helpers (
prepareBulkInsert,insertManyMemberIdentities,createMemberIdentity) with optionalRETURNING *support so the new endpoint can return the inserted identity row.Written by Cursor Bugbot for commit 2127764. This will update automatically on new commits. Configure here.