UNPKG

skailan-ai

Version:

Servicio de IA y procesamiento de lenguaje natural para Skailan

18 lines 800 B
import { Prompt } from '../../domain/entities/Prompt'; import { v4 as uuidv4 } from 'uuid'; export class CreatePrompt { promptRepository; constructor(promptRepository) { this.promptRepository = promptRepository; } async execute(request) { const { organizationId, name, description, template, type } = request; const existingPrompt = await this.promptRepository.findByName(name, organizationId); if (existingPrompt) { throw new Error('Prompt with this name already exists for this organization.'); } const newPrompt = new Prompt(uuidv4(), organizationId, name, description || null, template, type, new Date(), new Date()); return this.promptRepository.save(newPrompt); } } //# sourceMappingURL=CreatePrompt.js.map