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:
@@ -5,6 +5,7 @@ import {
|
||||
Get,
|
||||
Headers,
|
||||
HttpCode,
|
||||
Inject,
|
||||
Param,
|
||||
Patch,
|
||||
Post,
|
||||
@@ -39,7 +40,11 @@ type HttpResponse = { status: (status: number) => HttpResponse };
|
||||
@ApiBearerAuth('access-token')
|
||||
@Controller()
|
||||
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')
|
||||
@ApiOperation({ summary: '获取已启用的平台及非敏感能力目录' })
|
||||
@@ -75,7 +80,9 @@ export class PlatformsController {
|
||||
@ApiBearerAuth('access-token')
|
||||
@Controller('stores')
|
||||
export class StoresController {
|
||||
public constructor(private readonly storesService: StoresService) {}
|
||||
public constructor(
|
||||
@Inject(StoresService) private readonly storesService: StoresService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: '按平台分页列出当前工作空间的门店' })
|
||||
@@ -260,7 +267,9 @@ export class StoresController {
|
||||
@ApiBearerAuth('access-token')
|
||||
@Controller('operations')
|
||||
export class OperationsController {
|
||||
public constructor(private readonly storesService: StoresService) {}
|
||||
public constructor(
|
||||
@Inject(StoresService) private readonly storesService: StoresService,
|
||||
) {}
|
||||
|
||||
@Get(':operationId')
|
||||
@ApiOperation({ summary: '读取当前工作空间的异步操作状态' })
|
||||
|
||||
Reference in New Issue
Block a user