Skip to content

feat: add public endpoint to create member identity (CM-1070)#3969

Merged
skwowet merged 3 commits intomainfrom
feat/CM-1070
Mar 27, 2026
Merged

feat: add public endpoint to create member identity (CM-1070)#3969
skwowet merged 3 commits intomainfrom
feat/CM-1070

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented Mar 27, 2026

Summary

  • Add POST /api/v1/members/:memberId/identities endpoint to create member identities
  • Add returnRows support to insertManyMemberIdentities/prepareBulkInsert DAL methods
  • Conflict detection: 409 if identity exists on same member or is verified on another member
  • Unverified duplicates on other members are allowed (picked up by merge suggestions)

Note

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/identities to create a member identity with request validation, audit logging, and updatedAt touch to trigger merge suggestions.

Updates identity conflict detection to use a renamed/expanded DAL helper (checkMemberIdentityExistence) that can filter by type and returns verified, 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 optional RETURNING * 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.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Mar 27, 2026
Copilot AI review requested due to automatic review settings March 27, 2026 12:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/identities public endpoint with conflict detection and audit logging.
  • Extend prepareBulkInsert and member-identity insert DAL functions to support RETURNING * via a returnRows flag.
  • Rename/extend identity-existence check to optionally filter by identity type and include verified status.

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.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

skwowet added 2 commits March 27, 2026 20:43
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet merged commit a35c3b0 into main Mar 27, 2026
19 checks passed
@skwowet skwowet deleted the feat/CM-1070 branch March 27, 2026 15:29
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.

2 participants