From e32a3a980096a5f0f38e708a50df748abe0f8fad Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 2 Mar 2026 22:30:37 -0800 Subject: [PATCH] fix: use @TenantId() decorator in VoiceConfigController for JWT tenant extraction Co-Authored-By: Claude Opus 4.6 --- .../interfaces/rest/controllers/voice-config.controller.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/services/agent-service/src/interfaces/rest/controllers/voice-config.controller.ts b/packages/services/agent-service/src/interfaces/rest/controllers/voice-config.controller.ts index 8d65c97..1a1e94a 100644 --- a/packages/services/agent-service/src/interfaces/rest/controllers/voice-config.controller.ts +++ b/packages/services/agent-service/src/interfaces/rest/controllers/voice-config.controller.ts @@ -5,7 +5,8 @@ * GET /api/v1/agent/voice-config → Get current tenant's voice config * PUT /api/v1/agent/voice-config → Upsert voice config */ -import { Controller, Get, Put, Body, Headers } from '@nestjs/common'; +import { Controller, Get, Put, Body } from '@nestjs/common'; +import { TenantId } from '@it0/common'; import { VoiceConfigService, UpdateVoiceConfigDto } from '../../../infrastructure/services/voice-config.service'; const DEFAULT_CONFIG = { @@ -17,7 +18,7 @@ export class VoiceConfigController { constructor(private readonly voiceConfigService: VoiceConfigService) {} @Get() - async getConfig(@Headers('x-tenant-id') tenantId: string) { + async getConfig(@TenantId() tenantId: string) { if (!tenantId) return DEFAULT_CONFIG; const config = await this.voiceConfigService.findByTenantId(tenantId); if (!config) return { ...DEFAULT_CONFIG, tenantId }; @@ -29,7 +30,7 @@ export class VoiceConfigController { @Put() async upsertConfig( - @Headers('x-tenant-id') tenantId: string, + @TenantId() tenantId: string, @Body() dto: UpdateVoiceConfigDto, ) { const config = await this.voiceConfigService.upsert(tenantId || 'default', dto);