feat(api): create users via referring integrations#2463
Merged
nickscamara merged 6 commits intomainfrom Dec 2, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/api/src/controllers/v0/admin/create-user.ts">
<violation number="1" location="apps/api/src/controllers/v0/admin/create-user.ts:69">
P2: Validate that a Bearer token value is present before hashing it; otherwise requests with an empty token crash the controller and return 500 instead of 401.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
Contributor
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (all 2 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/api/src/controllers/v0/admin/create-user.ts">
<violation number="1" location="apps/api/src/controllers/v0/admin/create-user.ts:50">
P2: Malformed Bearer headers (`Authorization: Bearer` with no token) crash the handler and return 500 instead of a 401 because `token` is hashed without being validated.</violation>
<violation number="2" location="apps/api/src/controllers/v0/admin/create-user.ts:170">
P1: New teams created for preexisting users are never added to `user_teams`, so the user isn’t associated with the team and subsequent requests keep creating duplicate teams/coupons.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Member
Author
|
@cubic-dev-ai please re-review |
Contributor
@mogery I've started the AI code review. It'll take a few minutes to complete. |
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/api/src/controllers/v0/admin/create-user.ts">
<violation number="1" location="apps/api/src/controllers/v0/admin/create-user.ts:96">
P2: `alreadyExisted` stays false when an existing user needs a new team for this referrer, causing an incorrect API response. Set the flag as soon as a preexisting user is detected.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
nickscamara
approved these changes
Dec 2, 2025
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 by cubic
Adds a new admin endpoint to create users via referring integrations, issue API keys, and apply integration-specific coupons. This enables partners to onboard users programmatically with a simple API.
Written for commit a3e140e. Summary will update automatically on new commits.