66 Req ,
77 Sse ,
88 UseInterceptors ,
9+ ValidationPipe ,
910} from '@nestjs/common' ;
1011import { WizardService } from 'omniboxd/wizard/wizard.service' ;
1112import { CollectRequestDto } from 'omniboxd/wizard/dto/collect-request.dto' ;
@@ -21,6 +22,20 @@ import {
2122} from 'omniboxd/decorators/validate-share.decorator' ;
2223import { Share } from 'omniboxd/shares/entities/share.entity' ;
2324
25+ @Controller ( 'api/v1/wizard' )
26+ export class CollectController {
27+ constructor ( private readonly wizardService : WizardService ) { }
28+
29+ @Post ( 'collect' )
30+ async collect (
31+ @UserId ( ) userId : string ,
32+ @Body ( ) data : CollectRequestDto ,
33+ @Body ( 'namespaceId' , new ValidationPipe ( ) ) namespaceId : string ,
34+ ) : Promise < CollectResponseDto > {
35+ return await this . wizardService . collect ( namespaceId , userId , data ) ;
36+ }
37+ }
38+
2439@Controller ( 'api/v1/namespaces/:namespaceId/wizard' )
2540export class WizardController {
2641 constructor ( private readonly wizardService : WizardService ) { }
@@ -95,4 +110,21 @@ export class SharedWizardController {
95110 'ask' ,
96111 ) ;
97112 }
113+
114+ @Post ( 'write' )
115+ @Sse ( )
116+ @CookieAuth ( { onAuthFail : 'continue' } )
117+ @ValidateShare ( )
118+ async write (
119+ @ValidatedShare ( ) share : Share ,
120+ @RequestId ( ) requestId : string ,
121+ @Body ( ) body : AgentRequestDto ,
122+ ) {
123+ return await this . wizardService . streamService . createShareAgentStream (
124+ share ,
125+ body ,
126+ requestId ,
127+ 'write' ,
128+ ) ;
129+ }
98130}
0 commit comments