This repository was archived by the owner on Jul 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
infrastructure/controllers Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,24 @@ export class ThreadsController {
215215 ) ;
216216 }
217217
218+ @ApiOperation ( {
219+ summary : 'Clean thread' ,
220+ description : 'Deletes all messages in a thread.' ,
221+ tags : [ 'Threads' ] ,
222+ parameters : [
223+ {
224+ in : 'path' ,
225+ name : 'thread_id' ,
226+ required : true ,
227+ description : 'The ID of the thread to clean.' ,
228+ } ,
229+ ] ,
230+ } )
231+ @Post ( ':thread_id/clean' )
232+ async cleanThread ( @Param ( 'thread_id' ) threadId : string ) {
233+ return this . threadsUsecases . clean ( threadId ) ;
234+ }
235+
218236 @ApiOperation ( {
219237 summary : 'Delete message' ,
220238 description : 'Deletes a message.' ,
Original file line number Diff line number Diff line change @@ -215,4 +215,9 @@ export class ThreadsUsecases {
215215 // we still allow user to delete message even if the thread is not there
216216 return this . getMessageOrThrow ( messageId ) ;
217217 }
218+
219+ async clean ( threadId : string ) {
220+ await this . getThreadOrThrow ( threadId ) ;
221+ await this . messageRepository . delete ( { thread_id : threadId } ) ;
222+ }
218223}
You can’t perform that action at this time.
0 commit comments