fix(api): stores 控制器显式 @Inject 服务依赖

tsx/esbuild 不生成 design:paramtypes 装饰器元数据,裸类型构造参数在
dev 运行时注入 undefined,GET /api/platforms 返回 500。改为与
auth.controller.ts 一致的显式 @Inject(...)。

跨领域改动说明:前端联调平台上下文时发现该阻断性 bug,修复方式
沿用仓库既有模式,不影响服务层(原本即显式 token 注入)。
This commit is contained in:
2026-09-03 21:39:53 +08:00
parent 3ab999d0b2
commit 8655b7805f
+12 -3
View File
@@ -5,6 +5,7 @@ import {
Get, Get,
Headers, Headers,
HttpCode, HttpCode,
Inject,
Param, Param,
Patch, Patch,
Post, Post,
@@ -39,7 +40,11 @@ type HttpResponse = { status: (status: number) => HttpResponse };
@ApiBearerAuth('access-token') @ApiBearerAuth('access-token')
@Controller() @Controller()
export class PlatformsController { export class PlatformsController {
public constructor(private readonly platformsService: PlatformsService) {} // tsx/esbuild 不生成 design:paramtypes 元数据,控制器依赖必须显式 @Inject(与 auth.controller 一致)
public constructor(
@Inject(PlatformsService)
private readonly platformsService: PlatformsService,
) {}
@Get('platforms') @Get('platforms')
@ApiOperation({ summary: '获取已启用的平台及非敏感能力目录' }) @ApiOperation({ summary: '获取已启用的平台及非敏感能力目录' })
@@ -75,7 +80,9 @@ export class PlatformsController {
@ApiBearerAuth('access-token') @ApiBearerAuth('access-token')
@Controller('stores') @Controller('stores')
export class StoresController { export class StoresController {
public constructor(private readonly storesService: StoresService) {} public constructor(
@Inject(StoresService) private readonly storesService: StoresService,
) {}
@Get() @Get()
@ApiOperation({ summary: '按平台分页列出当前工作空间的门店' }) @ApiOperation({ summary: '按平台分页列出当前工作空间的门店' })
@@ -260,7 +267,9 @@ export class StoresController {
@ApiBearerAuth('access-token') @ApiBearerAuth('access-token')
@Controller('operations') @Controller('operations')
export class OperationsController { export class OperationsController {
public constructor(private readonly storesService: StoresService) {} public constructor(
@Inject(StoresService) private readonly storesService: StoresService,
) {}
@Get(':operationId') @Get(':operationId')
@ApiOperation({ summary: '读取当前工作空间的异步操作状态' }) @ApiOperation({ summary: '读取当前工作空间的异步操作状态' })