feat(partner): introduce PARTNER role and /partner endpoint family#3787
Draft
TaprootFreak wants to merge 1 commit into
Draft
feat(partner): introduce PARTNER role and /partner endpoint family#3787TaprootFreak wants to merge 1 commit into
TaprootFreak wants to merge 1 commit into
Conversation
Adds a new minimal subdomain enabling referral partners to self-service
their referees on app.dfx.swiss instead of routing through the internal
Google Sheet admin tool.
- New UserRole.PARTNER, wired into RoleGuard fallback table so
ADMIN/SUPER_ADMIN inherit access
- New /partner endpoint family (admin-only, ApiExcludeController):
GET /partner/user?address=<addr> lookup, scope-filtered
GET /partner/users list own referees
GET /partner/fees list partner-allowed fees
PUT /partner/user/:id/onboarding addFee + Active + usedRef
DELETE /partner/user/:id/fee?fee=<feeId> remove individual fee
- Server-side scope check: caller can only act on users whose usedRef
is either Config.defaultRef or equals the caller's own ref
- Reuses existing primitives: FeeService.addFeeInternal,
UserDataService.removeFee / updateUserDataInternal,
UserService.updateUserAdmin / getUsersByUsedRef (new),
FeeService.getCustomFeesForPartner (new wrapper around
SettingService.getCustomSignUpFees)
- No schema migration: PARTNER is an enum value on the existing
string-typed role column; history is derived from existing data
This was referenced May 29, 2026
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
UserRole.PARTNER, wired intoRoleGuardfallback table soADMIN/SUPER_ADMINinherit access/partnercontroller (admin-only,@ApiExcludeController) with 5 endpoints for partner self-serviceusedRefisConfig.defaultRefor equals caller's ownrefFeeService.addFeeInternal,UserDataService.removeFee/updateUserDataInternal,UserService.updateUserAdmin); adds two small helpers:UserService.getUsersByUsedRefandFeeService.getCustomFeesForPartnerWhy
Referral partners like Fab today rely on the internal DFX Admin Google Sheet (operated by the Compliance team) to set custom onboarding fees on their referees. This PR moves that workflow behind a proper backend, so partners can self-service it from
app.dfx.swiss(UI lands inDFXswiss/services, separate PR).Endpoints
/partner/user?address=<addr>UserDataby signing address, scope-filtered/partner/usersusedRef == caller.ref)/partner/feescustomSignUpFeessetting)/partner/user/:userDataId/onboardingaddFee + status=Active + usedRef=caller.ref(atomic 3-step)/partner/user/:userDataId/fee?fee=<feeId>PR Completeness checklist
PARTNERis a new enum value on the existing string-typedrolecolumn. History is derived from existing data (no new entity).DFXswiss/packagesandDFXswiss/services.Follow-up PRs
DFXswiss/packages— mirrorPARTNERenum value + addPartnerUrlconstants in@dfx.swiss/core, publish via OIDCDFXswiss/services—usePartnerGuard,usePartnerhook,/partnerscreens (lookup / onboarding form / referee list)Operational notes
user.role = 'Partner'via DB to test scope behaviour.UPDATEfor the actual partner accounts.Test plan
GET /v1/partner/user?address=<known-test-address>returns 200 withcanModify=truefor in-scope user, 403 for out-of-scopeGET /v1/partner/feesreturns the configured custom sign-up fees for that partnerPUT /v1/partner/user/<id>/onboardingwith{feeId}— verifyuserData.individualFeeListcontains the new id,status=Active, all defaultRef-users moved to caller's refDELETE /v1/partner/user/<id>/fee?fee=<feeId>— verify removalusedRef) → 403