diff --git a/src/modules/voicebox/voicebox.controller.ts b/src/modules/voicebox/voicebox.controller.ts index 2f1ba2f..acaaf46 100644 --- a/src/modules/voicebox/voicebox.controller.ts +++ b/src/modules/voicebox/voicebox.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Post, Body, Res, HttpStatus, Param } from '@nestjs/common'; +import { Controller, Get, Post, Body, Res, HttpStatus, Param, Delete } from '@nestjs/common'; import { Public } from '../../common/decorators'; import { VoiceboxService } from './voicebox.service'; import type { Response } from 'express'; @@ -54,4 +54,9 @@ export class VoiceboxController { async speak(@Body() body: { text: string; profile: string; personality?: boolean }) { return this.voiceboxService.speak(body.text, body.profile, body.personality); } + + @Delete('history/:id') + async deleteHistory(@Param('id') id: string) { + return this.voiceboxService.deleteHistory(id); + } } diff --git a/src/modules/voicebox/voicebox.service.ts b/src/modules/voicebox/voicebox.service.ts index 1b42122..38cb88a 100644 --- a/src/modules/voicebox/voicebox.service.ts +++ b/src/modules/voicebox/voicebox.service.ts @@ -237,4 +237,22 @@ export class VoiceboxService { ); } } + + /** + * Belirtilen ID'ye sahip VoiceBox geçmiş kaydını siler + */ + async deleteHistory(generationId: string) { + try { + const response: any = await lastValueFrom( + this.httpService.delete(`${this.voiceboxUrl}/history/${generationId}`) + ); + return response.data; + } catch (error: any) { + this.logger.error(`Error deleting VoiceBox history for ${generationId}`, error.message); + throw new HttpException( + 'Geçmiş kaydı silinemedi', + HttpStatus.INTERNAL_SERVER_ERROR + ); + } + } }