chore: adjust TriggerType for OpenAI and Typebot integrations

Modifies the TriggerType enum to include a 'none' option and updates the OpenAI and Typebot services to handle this new option. Additionally, the services now require a trigger operator and value when the trigger type is set to 'keyword'.

Modified files:
- prisma/postgresql-schema.prisma
- src/api/integrations/openai/services/openai.service.ts
- src/api/integrations/typebot/services/typebot.service.ts

Untracked file:
- prisma/migrations/20240729115127_modify_trigger_type_openai_typebot_table/
This commit is contained in:
Davidson Gomes 2024-07-29 08:53:15 -03:00
parent f95d34a1da
commit d00e3677f5
4 changed files with 5 additions and 2 deletions

View File

@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "TriggerType" ADD VALUE 'none';

View File

@ -36,6 +36,7 @@ enum TypebotSessionStatus {
enum TriggerType {
all
keyword
none
}
enum TriggerOperator {

View File

@ -212,7 +212,7 @@ export class OpenaiService {
throw new Error('Openai Bot already exists');
}
if (data.triggerType !== 'all') {
if (data.triggerType === 'keyword') {
if (!data.triggerOperator || !data.triggerValue) {
throw new Error('Trigger operator and value are required');
}

View File

@ -96,7 +96,7 @@ export class TypebotService {
throw new Error('Typebot already exists');
}
if (data.triggerType !== 'all') {
if (data.triggerType === 'keyword') {
if (!data.triggerOperator || !data.triggerValue) {
throw new Error('Trigger operator and value are required');
}