feat(api): launch-promo foundation — admin manual award + /me status (#724)#749
Open
chronoai-shining wants to merge 7 commits into
Open
feat(api): launch-promo foundation — admin manual award + /me status (#724)#749chronoai-shining wants to merge 7 commits into
chronoai-shining wants to merge 7 commits into
Conversation
…724) PR 1 of 2 for #724. Lands the data model, eligibility gate, redemption- code minting, notification delivery, and the admin manual-award + caller status endpoints. Cron + GitHub stargazers polling + NyxID GH-login resolution + frontend UI are scoped for PR 2. - launchPromo settings section: enabled, repoOwner/Name, totalSlots (default 500), awardPlayground/awardSkillGen (200), pollIntervalMs, codeExpiryDays, nyxidInviteCode. Defaults are conservative so the promo stays dormant until an admin turns it on. - launch_promo_claims collection + repo (one doc per awarded user, _id=userId for PK idempotency; awardedAt desc index for admin observability). - LaunchPromoService.awardUser: gates on enabled + rank ≤ totalSlots + slots remaining + not-already-claimed, mints a code via the existing redemption-codes service, drops a launchPromo.codeDelivered notification carrying the code + NyxID invite code, records the claim. Race-on-insert resolves cleanly to ALREADY_CLAIMED. Notification failure logged but doesn't roll back the claim. - LaunchPromoService.getStatusForUser: composes the /me/launch-promo response. - UserDirectoryRepository.getRegistrationRank: 1-based ranking by firstSeenAt asc, two queries, no scan. - New launchPromo.codeDelivered NotificationCategory. - Routes: GET /me/launch-promo, POST /admin/launch-promo/award/:userId (ornn:admin:skill), GET /admin/launch-promo/recent. Service-layer sentinels map to 400/403/404/409. Coverage: 12 colocated unit tests on LaunchPromoService — happy path + every error sentinel + race-on-insert + notification-failure-does- not-rollback. All green. Fixes #724
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.
Settings section + claims collection + service + admin manual-award endpoint + caller status. Cron + GH stargazers + NyxID GH-lookup + frontend deferred to PR 2. 12 unit tests green. Fixes #724