fix(admin-service): 修复公开 API 路由前缀排除规则

setGlobalPrefix exclude 应匹配 controller 路径而非完整 URL。

修复前: exclude: ['api/app/version/(.*)']
  → 不生效,公开 API 被加上 /api/v1 前缀
  → 移动端需访问 /api/v1/app/version/check (错误)

修复后: exclude: ['app/version/(.*)']
  → 正确排除 AppVersionController 的路由
  → 移动端访问 /api/app/version/check (无 /api/v1 前缀)
  → 管理端继续使用 /api/v1/admin/versions (不受影响)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-03 07:37:44 -08:00
parent 1d1e08cc8f
commit 6f87be4454
1 changed files with 1 additions and 1 deletions

View File

@ -8,7 +8,7 @@ async function bootstrap() {
// Global prefix for admin APIs; mobile client endpoints excluded
app.setGlobalPrefix('api/v1', {
exclude: ['api/app/version/(.*)'],
exclude: ['app/version/(.*)'],
});
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));