Conversation
…iption bugfix - Disable real payment flows in PC app during beta (usePurchase hook short-circuit + BetaNotice inline text with clickable Discord link) - Add Discord community entry in Settings > About - Add redemption code system: admin CRUD for creating/managing codes, user-facing redeem dialog in account center - Support two code types: CREDITS (grant purchased quota) and MEMBERSHIP (activate subscription tier) - Multi-use codes with per-account single-use enforcement (@@unique constraint + atomic counter) - Extract activateSubscriptionWithQuota/deactivateSubscriptionToFree shared functions from payment.service.ts - Fix admin updateSubscription to sync Quota on tier/status changes (status semantics take priority) - Add admin redemption codes management page with full CRUD, filters, and usage history - Register RedemptionModule in app.module.ts and openapi-modules.ts - Add Prisma migration for RedemptionCode + RedemptionCodeUsage models - Add unit tests for redemption service and admin subscription update
- Guard EXPIRED/CANCELED branches with statusChanged to prevent tier-only changes on expired/canceled subscriptions from taking wrong path - Move subscription findUnique inside $transaction to prevent TOCTOU race - Preserve non-ACTIVE status (e.g., PAST_DUE) when admin changes tier only - Allow clearing expiresAt (nullable) in server-side updateRedemptionCodeSchema
…pty string - When tier changes, apply intended status (explicit or preserved) after activateSubscriptionWithQuota, covering PAST_DUE and all non-ACTIVE states - Convert empty expiresAt string to null before sending to server in edit flow
…validate membershipDays - Create dedicated anyhunt apiClient for redemption (PC app connects to server.anyhunt.app) - Add ANYHUNT_API_URL constant with VITE_ANYHUNT_API_URL env override - Catch P2002 on createCode and return 409 instead of 500 for duplicate custom codes - Add membershipDays to MEMBERSHIP type validation in admin frontend schema
…nd consistency - Add internal API Key-authenticated redeem endpoint on anyhunt server (POST /api/v1/redemption-codes/redeem with ApiKeyGuard) - Add redemption proxy module to moryflow server that forwards redeem requests to anyhunt server using ANYHUNT_API_KEY - Revert PC app to use moryflow server apiClient (no cross-domain auth) - Fix cancelAtPeriodEnd consistency: restoring CANCELED status after tier change now also sets cancelAtPeriodEnd: true Request flow: PC app -> moryflow server (user auth) -> anyhunt server (API Key)
There was a problem hiding this comment.
Devin Review found 3 new potential issues.
🐛 3 issues in files not directly in the diff
🐛 CLAUDE.md for admin features not updated with new redemption-codes module (apps/anyhunt/admin/www/src/features/CLAUDE.md:1)
The apps/anyhunt/admin/www/src/features/CLAUDE.md has the mandatory rule: "redemption-codes/ feature module was added to this directory, but the CLAUDE.md's feature list table was not updated to include it.
🐛 CLAUDE.md for payment directory not updated with new subscription-activation.ts (apps/anyhunt/server/src/payment/CLAUDE.md:1)
The apps/anyhunt/server/src/payment/CLAUDE.md has the mandatory rule: "This folder structure changes require updating this document." A new file subscription-activation.ts was added to this directory, but the CLAUDE.md's File Structure table was not updated to include it.
🐛 CLAUDE.md for admin www not updated with new RedemptionCodesPage (apps/anyhunt/admin/www/CLAUDE.md:1)
The apps/anyhunt/admin/www/CLAUDE.md has the mandatory rule: "RedemptionCodesPage was added and a new feature module redemption-codes/ was created, but the CLAUDE.md's Pages table, Feature List, and related sections were not updated.
View 12 additional findings in Devin Review.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a64443062
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
Changes by area
Server (apps/anyhunt/server): Prisma schema + migration, subscription-activation.ts shared functions, payment.service.ts refactor, admin.service.ts bugfix, redemption module (DTO + service + controllers + module), OpenAPI registration
PC App (apps/moryflow/pc): usePurchase short-circuit, BetaNotice component, Discord in About, RedeemCodeDialog (RHF+zod), user-profile integration
Admin Frontend (apps/anyhunt/admin/www): redemption-codes feature (12 files), RedemptionCodesPage, route registration
i18n (packages/i18n): settings + auth keys for all 5 locales
Test plan