Files
ai/backend/src/production-kernel/production-kernel.controller.ts
T

150 lines
4.9 KiB
TypeScript

import { Body, Controller, Get, Inject, Param, Post, Query, UseGuards } from '@nestjs/common';
import { CurrentUser } from '../auth/current-user.decorator';
import type { AuthRequestUser } from '../auth/auth.types';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import {
AiReviewProductionContractDto,
CheckEpisodeContinuityDto,
CompileFlowTestGenerationPlansDto,
ConfirmProductionContractDto,
CreateProductionSourceSnapshotDto,
GenerateProductionStageDto,
MaterializeProductionExecutionDto,
PreviewProductionStagePromptDto,
ReviewProductionContractDto,
SaveProductionContractDto
} from './production-kernel.dto';
import { ProductionKernelService } from './production-kernel.service';
@Controller()
@UseGuards(JwtAuthGuard)
export class ProductionKernelController {
constructor(@Inject(ProductionKernelService) private readonly service: ProductionKernelService) {}
@Post('projects/:projectId/production/source-snapshots')
createSourceSnapshot(
@CurrentUser() user: AuthRequestUser,
@Param('projectId') projectId: string,
@Body() dto: CreateProductionSourceSnapshotDto
) {
return this.service.createSourceSnapshot(user, projectId, dto);
}
@Get('projects/:projectId/production/source-snapshots')
listSourceSnapshots(
@CurrentUser() user: AuthRequestUser,
@Param('projectId') projectId: string
) {
return this.service.listSourceSnapshots(user, projectId);
}
@Post('projects/:projectId/production/contracts/:contractType')
saveContract(
@CurrentUser() user: AuthRequestUser,
@Param('projectId') projectId: string,
@Param('contractType') contractType: string,
@Body() dto: SaveProductionContractDto
) {
return this.service.saveContract(user, projectId, contractType, dto);
}
@Get('projects/:projectId/production/contracts')
listContracts(
@CurrentUser() user: AuthRequestUser,
@Param('projectId') projectId: string,
@Query('contract_type') contractType?: string
) {
return this.service.listContracts(user, projectId, contractType);
}
@Get('production/contracts/:contractId')
getContract(
@CurrentUser() user: AuthRequestUser,
@Param('contractId') contractId: string
) {
return this.service.getContract(user, contractId);
}
@Post('production/contracts/:contractId/review')
reviewContract(
@CurrentUser() user: AuthRequestUser,
@Param('contractId') contractId: string,
@Body() dto: ReviewProductionContractDto
) {
return this.service.reviewContract(user, contractId, dto);
}
@Post('production/contracts/:contractId/ai-review')
aiReviewContract(
@CurrentUser() user: AuthRequestUser,
@Param('contractId') contractId: string,
@Body() dto: AiReviewProductionContractDto = {}
) {
return this.service.aiReviewSceneScript(user, contractId, dto);
}
@Post('production/contracts/:contractId/confirm')
confirmContract(
@CurrentUser() user: AuthRequestUser,
@Param('contractId') contractId: string,
@Body() dto: ConfirmProductionContractDto = {}
) {
return this.service.confirmContract(user, contractId, dto);
}
@Post('production/contracts/:contractId/release-to-script')
releaseEpisodePlan(
@CurrentUser() user: AuthRequestUser,
@Param('contractId') contractId: string
) {
return this.service.releaseEpisodePlan(user, contractId);
}
@Post('production/contracts/:contractId/materialize-execution-draft')
materializeExecutionDraft(
@CurrentUser() user: AuthRequestUser,
@Param('contractId') contractId: string,
@Body() dto: MaterializeProductionExecutionDto
) {
return this.service.materializeExecutionDraft(user, contractId, dto);
}
@Post('production/contracts/:contractId/compile-flow-test-generation-plans')
compileFlowTestGenerationPlans(
@CurrentUser() user: AuthRequestUser,
@Param('contractId') contractId: string,
@Body() dto: CompileFlowTestGenerationPlansDto
) {
return this.service.compileFlowTestGenerationPlans(user, contractId, dto);
}
@Post('projects/:projectId/production/prompts/:stage/preview')
previewStagePrompt(
@CurrentUser() user: AuthRequestUser,
@Param('projectId') projectId: string,
@Param('stage') stage: string,
@Body() dto: PreviewProductionStagePromptDto
) {
return this.service.previewStagePrompt(user, projectId, stage, dto);
}
@Post('projects/:projectId/production/stages/:stage/generate')
generateStageContract(
@CurrentUser() user: AuthRequestUser,
@Param('projectId') projectId: string,
@Param('stage') stage: string,
@Body() dto: GenerateProductionStageDto
) {
return this.service.generateStageContract(user, projectId, stage, dto);
}
@Post('projects/:projectId/production/episode-continuity/check')
checkEpisodeContinuity(
@CurrentUser() user: AuthRequestUser,
@Param('projectId') projectId: string,
@Body() dto: CheckEpisodeContinuityDto
) {
return this.service.checkEpisodeContinuity(user, projectId, dto);
}
}