| 24 | @ApiTags('Human Inputs') |
| 25 | @Controller('human-inputs') |
| 26 | export class HumanInputsController { |
| 27 | constructor(private readonly service: HumanInputsService) {} |
| 28 | |
| 29 | @Get() |
| 30 | @UseGuards(AuthGuard) |
| 31 | @ApiSecurity('api-key') |
| 32 | @ApiOperation({ summary: 'List human input requests' }) |
| 33 | @ApiResponse({ status: 200, type: [HumanInputResponseDto] }) |
| 34 | async list(@Query() query: ListHumanInputsQueryDto, @CurrentAuth() auth: AuthContext | null) { |
| 35 | if (!auth || !auth.organizationId) { |
| 36 | throw new UnauthorizedException('Authentication required'); |
| 37 | } |
| 38 | return this.service.list(query, auth.organizationId); |
| 39 | } |
| 40 | |
| 41 | @Get(':id') |
| 42 | @UseGuards(AuthGuard) |
| 43 | @ApiSecurity('api-key') |
| 44 | @ApiOperation({ summary: 'Get a human input request details' }) |
| 45 | @ApiResponse({ status: 200, type: HumanInputResponseDto }) |
| 46 | async get(@Param('id') id: string, @CurrentAuth() auth: AuthContext | null) { |
| 47 | if (!auth || !auth.organizationId) { |
| 48 | throw new UnauthorizedException('Authentication required'); |
| 49 | } |
| 50 | return this.service.getById(id, auth.organizationId); |
| 51 | } |
| 52 | |
| 53 | @Post(':id/resolve') |
| 54 | @UseGuards(AuthGuard) |
| 55 | @ApiSecurity('api-key') |
| 56 | @ApiOperation({ summary: 'Resolve a human input request' }) |
| 57 | @ApiResponse({ status: 200, type: HumanInputResponseDto }) |
| 58 | async resolve( |
| 59 | @Param('id') id: string, |
| 60 | @Body() dto: ResolveHumanInputDto, |
| 61 | @CurrentAuth() auth: AuthContext | null, |
| 62 | ) { |
| 63 | if (!auth || !auth.organizationId) { |
| 64 | throw new UnauthorizedException('Authentication required'); |
| 65 | } |
| 66 | return this.service.resolve(id, dto, auth.organizationId); |
| 67 | } |
| 68 | |
| 69 | // Public endpoints for resolving via token (no auth guard) |
| 70 | @Post('resolve/:token') |
| 71 | @ApiOperation({ summary: 'Resolve input via public token' }) |
| 72 | @ApiResponse({ status: 200, type: PublicResolveResultDto }) |
| 73 | async resolveByToken(@Param('token') token: string, @Body() body: ResolveByTokenDto) { |
| 74 | return this.service.resolveByToken(token, body.action || 'resolve', body.data); |
| 75 | } |
| 76 | } |
nothing calls this directly
no outgoing calls
no test coverage detected