FEAT: Coleta do contúdo de IA
Some checks are pending
Deploy Dev / deploy (push) Waiting to run

This commit is contained in:
Rafael Alves Lopes 2026-05-27 09:30:36 -03:00
parent 2fd19e9bae
commit 350af31eec
2 changed files with 22 additions and 0 deletions

View File

@ -30,6 +30,11 @@ export class AdminAccessController {
return this.adminAccessService.listAiContents(); return this.adminAccessService.listAiContents();
} }
@Get('ai-contents/:id/file')
getAiContentFile(@Param('id') id: string) {
return this.adminAccessService.getAiContentFile(Number(id));
}
@Post('ai-contents') @Post('ai-contents')
createAiContent(@Body() body: { createAiContent(@Body() body: {
title?: string; title?: string;

View File

@ -320,6 +320,23 @@ export class AdminAccessService {
return result.rows; return result.rows;
} }
async getAiContentFile(id: number) {
const result = await this.database.query(
`
SELECT id, title, filename, mimetype, content_base64
FROM ai_knowledge_contents
WHERE id = $1
`,
[id],
);
if (!result.rows[0]) {
throw new Error('Conteudo de IA nao encontrado');
}
return result.rows[0];
}
async createAiContent(input: AiContentInput) { async createAiContent(input: AiContentInput) {
const title = String(input.title || '').trim(); const title = String(input.title || '').trim();
if (!title) { if (!title) {