-
Notifications
You must be signed in to change notification settings - Fork 4
fix: restore redemption API path from /business to /redemption #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The router prefix was changed from /redemption to /business in commit 475cd62, but the admin components still use /redemption paths, causing 404 errors when accessing the admin dashboard at /#secretcode. This restores the original /redemption prefix for consistency.
评审者指南(在小型 PR 上折叠)评审者指南将后端兑换路由前缀恢复为 通过 /redemption API 进行管理员密钥登录的时序图sequenceDiagram
actor Admin
participant SecretCodePage
participant RedemptionService
participant BackendAPI
participant RedemptionRouter
Admin->>SecretCodePage: Enter_secret_code_and_submit
SecretCodePage->>RedemptionService: redeemCode(code)
RedemptionService->>BackendAPI: POST /xyzen/api/v1/redemption/redeem
BackendAPI->>RedemptionRouter: Route_request_to_redemption_router
RedemptionRouter-->>BackendAPI: Redeem_response
BackendAPI-->>RedemptionService: 200_OK_with_auth_and_admin_data
RedemptionService-->>SecretCodePage: RedeemCodeResponse
SecretCodePage-->>Admin: Login_success_and_admin_dashboard_loaded
按文件划分的更改
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的 控制台 以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideRestores the backend redemption router prefix to Sequence diagram for admin secret code login via /redemption APIsequenceDiagram
actor Admin
participant SecretCodePage
participant RedemptionService
participant BackendAPI
participant RedemptionRouter
Admin->>SecretCodePage: Enter_secret_code_and_submit
SecretCodePage->>RedemptionService: redeemCode(code)
RedemptionService->>BackendAPI: POST /xyzen/api/v1/redemption/redeem
BackendAPI->>RedemptionRouter: Route_request_to_redemption_router
RedemptionRouter-->>BackendAPI: Redeem_response
BackendAPI-->>RedemptionService: 200_OK_with_auth_and_admin_data
RedemptionService-->>SecretCodePage: RedeemCodeResponse
SecretCodePage-->>Admin: Login_success_and_admin_dashboard_loaded
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - 我发现了 1 个问题,并留下了一些高层次的反馈:
- 由于前端和后端都依赖
/redemption这个基础路径,建议在redemptionService.ts中把这个前缀提取成一个共享常量(或配置),以避免未来路径变更时出现不一致。 - 将路由的 tag 从
business重命名为redemption可能会影响依赖这些 tag 的工具(例如 OpenAPI 客户端或过滤器);如果这是有意为之,建议在同一个改动中,将所有基于 tag 的用法也一并调整为新名称。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- Since the frontend and backend both depend on the `/redemption` base path, consider extracting this prefix into a shared constant (or config) in `redemptionService.ts` to avoid future mismatches when paths change.
- Renaming the router tag from `business` to `redemption` may affect tools that rely on tags (e.g., OpenAPI clients or filters); if that impact is intentional, consider aligning any tag-based usage to the new name in the same change.
## Individual Comments
### Comment 1
<location> `web/src/service/redemptionService.ts:98-101` </location>
<code_context>
async redeemCode(code: string): Promise<RedeemCodeResponse> {
const response = await fetch(
- `${this.getBackendUrl()}/xyzen/api/v1/business/redeem`,
+ `${this.getBackendUrl()}/xyzen/api/v1/redemption/redeem`,
{
method: "POST",
</code_context>
<issue_to_address>
**suggestion:** Consider centralizing the `/xyzen/api/v1/redemption` base path to reduce duplication and mismatch risk.
Each method now repeats the full `/xyzen/api/v1/redemption/...` URL. Defining a shared base (e.g. `const baseRedemptionPath =
`${this.getBackendUrl()}/xyzen/api/v1/redemption`;`) and appending per-endpoint paths would make future URL changes safer and reduce the risk of endpoints drifting out of sync.
Suggested implementation:
```typescript
async redeemCode(code: string): Promise<RedeemCodeResponse> {
const baseRedemptionPath = `${this.getBackendUrl()}/xyzen/api/v1/redemption`;
const response = await fetch(
`${baseRedemptionPath}/redeem`,
{
method: "POST",
headers: this.createAuthHeaders(),
```
```typescript
async getUserWallet(): Promise<UserWalletResponse> {
const baseRedemptionPath = `${this.getBackendUrl()}/xyzen/api/v1/redemption`;
const response = await fetch(
`${baseRedemptionPath}/wallet`,
{
method: "GET",
headers: this.createAuthHeaders(),
```
If there are other methods in this file (or related services) that call `/xyzen/api/v1/redemption/...`, they should also be updated to:
1. Define `const baseRedemptionPath = \`${this.getBackendUrl()}/xyzen/api/v1/redemption\`;` at the top of the method.
2. Build their endpoint URLs as `\`${baseRedemptionPath}/<endpoint>\`` rather than hardcoding the full string.
If the pattern is used in many places across the class, you may want to further centralize this into a private helper (e.g. `private getRedemptionBasePath(): string`) and replace the per-method `const` with calls to that helper.
</issue_to_address>帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的 Review。
Original comment in English
Hey - I've found 1 issue, and left some high level feedback:
- Since the frontend and backend both depend on the
/redemptionbase path, consider extracting this prefix into a shared constant (or config) inredemptionService.tsto avoid future mismatches when paths change. - Renaming the router tag from
businesstoredemptionmay affect tools that rely on tags (e.g., OpenAPI clients or filters); if that impact is intentional, consider aligning any tag-based usage to the new name in the same change.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Since the frontend and backend both depend on the `/redemption` base path, consider extracting this prefix into a shared constant (or config) in `redemptionService.ts` to avoid future mismatches when paths change.
- Renaming the router tag from `business` to `redemption` may affect tools that rely on tags (e.g., OpenAPI clients or filters); if that impact is intentional, consider aligning any tag-based usage to the new name in the same change.
## Individual Comments
### Comment 1
<location> `web/src/service/redemptionService.ts:98-101` </location>
<code_context>
async redeemCode(code: string): Promise<RedeemCodeResponse> {
const response = await fetch(
- `${this.getBackendUrl()}/xyzen/api/v1/business/redeem`,
+ `${this.getBackendUrl()}/xyzen/api/v1/redemption/redeem`,
{
method: "POST",
</code_context>
<issue_to_address>
**suggestion:** Consider centralizing the `/xyzen/api/v1/redemption` base path to reduce duplication and mismatch risk.
Each method now repeats the full `/xyzen/api/v1/redemption/...` URL. Defining a shared base (e.g. `const baseRedemptionPath =
`${this.getBackendUrl()}/xyzen/api/v1/redemption`;`) and appending per-endpoint paths would make future URL changes safer and reduce the risk of endpoints drifting out of sync.
Suggested implementation:
```typescript
async redeemCode(code: string): Promise<RedeemCodeResponse> {
const baseRedemptionPath = `${this.getBackendUrl()}/xyzen/api/v1/redemption`;
const response = await fetch(
`${baseRedemptionPath}/redeem`,
{
method: "POST",
headers: this.createAuthHeaders(),
```
```typescript
async getUserWallet(): Promise<UserWalletResponse> {
const baseRedemptionPath = `${this.getBackendUrl()}/xyzen/api/v1/redemption`;
const response = await fetch(
`${baseRedemptionPath}/wallet`,
{
method: "GET",
headers: this.createAuthHeaders(),
```
If there are other methods in this file (or related services) that call `/xyzen/api/v1/redemption/...`, they should also be updated to:
1. Define `const baseRedemptionPath = \`${this.getBackendUrl()}/xyzen/api/v1/redemption\`;` at the top of the method.
2. Build their endpoint URLs as `\`${baseRedemptionPath}/<endpoint>\`` rather than hardcoding the full string.
If the pattern is used in many places across the class, you may want to further centralize this into a private helper (e.g. `private getRedemptionBasePath(): string`) and replace the per-method `const` with calls to that helper.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
## [1.0.6](v1.0.5...v1.0.6) (2026-01-21) ### 🐛 Bug Fixes * restore redemption API path from /business to /redemption ([#191](#191)) ([7cf22ff](7cf22ff))
|
🎉 This PR is included in version 1.0.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
/businessback to/redemptionin the backendredemptionService.tsto use/redemption/paths consistentlyThis fixes the 404 error when accessing the admin dashboard at
/#secretcodeand trying to login.Root Cause
Commit
475cd62changed the router prefix from/redemptionto/business, but the admin components (SecretCodePage.tsx,CodesList.tsx,CodeGenerationForm.tsx) still use hardcoded/redemption/paths.Test plan
/#secretcode🤖 Generated with Claude Code
Summary by Sourcery
将兑换(redemption)API 的路由前缀,从
/business恢复为/redemption,并在后端与前端的服务调用中统一使用该前缀,从而修复管理后台的兑换流程。Bug 修复:
/redemption路由保持一致,修复管理端兑换接口返回 404 的问题。增强内容:
/redemption前缀和标签,以实现更清晰的 API 职责分离。Original summary in English
Summary by Sourcery
Restore the redemption API routing prefix from /business back to /redemption across backend and frontend service calls to fix admin dashboard redemption flows.
Bug Fixes:
Enhancements: