mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 07:04:50 -06:00
Revert "V2 fix chatwoot reply quote"
This commit is contained in:
parent
2c7288e888
commit
ff78954383
@ -23,7 +23,6 @@ DEL_INSTANCE=false
|
||||
|
||||
# Provider: postgresql | mysql
|
||||
DATABASE_PROVIDER=postgresql
|
||||
# DATABASE_DIRECT_URL='' # Direct connection to the database
|
||||
DATABASE_CONNECTION_URI='postgresql://user:pass@localhost:5432/evolution?schema=public'
|
||||
# Client name for the database connection
|
||||
# It is used to separate an API installation from another that uses the same database.
|
||||
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -12,6 +12,5 @@
|
||||
"prisma-smart-formatter.prisma.defaultFormatter": "Prisma.prisma",
|
||||
"i18n-ally.localesPaths": [
|
||||
"store/messages"
|
||||
],
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
]
|
||||
}
|
@ -1,39 +1,23 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
redis:
|
||||
image: redis:latest
|
||||
container_name: redis
|
||||
command: >
|
||||
redis-server --port 6379 --appendonly yes
|
||||
networks:
|
||||
- evolution-net
|
||||
volumes:
|
||||
- evolution_redis:/data
|
||||
ports:
|
||||
- 6379:6379
|
||||
expose:
|
||||
- 6379
|
||||
|
||||
postgres:
|
||||
container_name: postgres
|
||||
image: postgres:15
|
||||
networks:
|
||||
- evolution-net
|
||||
command: ["postgres", "-c", "max_connections=1000"]
|
||||
api:
|
||||
container_name: evolution_api
|
||||
image: atendai/evolution-api:v2.0.9-rc
|
||||
restart: always
|
||||
ports:
|
||||
- 5432:5432
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=PASSWORD
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- evolution_instances:/evolution/instances
|
||||
networks:
|
||||
- evolution-net
|
||||
env_file:
|
||||
- .env
|
||||
expose:
|
||||
- 5432
|
||||
- 8080
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
evolution_redis:
|
||||
evolution_instances:
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
|
@ -1,929 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `Chat` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Chatwoot` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Contact` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Dify` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `DifySetting` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `EvolutionBot` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `EvolutionBotSetting` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Flowise` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `FlowiseSetting` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Instance` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `IntegrationSession` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Label` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Media` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Message` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `MessageUpdate` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `OpenaiBot` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `OpenaiCreds` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `OpenaiSetting` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Proxy` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Rabbitmq` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Session` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Setting` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Sqs` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Template` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Typebot` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `TypebotSetting` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Webhook` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `Websocket` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Chat" DROP CONSTRAINT "Chat_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Chatwoot" DROP CONSTRAINT "Chatwoot_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Contact" DROP CONSTRAINT "Contact_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Dify" DROP CONSTRAINT "Dify_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "DifySetting" DROP CONSTRAINT "DifySetting_difyIdFallback_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "DifySetting" DROP CONSTRAINT "DifySetting_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "EvolutionBot" DROP CONSTRAINT "EvolutionBot_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "EvolutionBotSetting" DROP CONSTRAINT "EvolutionBotSetting_botIdFallback_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "EvolutionBotSetting" DROP CONSTRAINT "EvolutionBotSetting_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Flowise" DROP CONSTRAINT "Flowise_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "FlowiseSetting" DROP CONSTRAINT "FlowiseSetting_flowiseIdFallback_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "FlowiseSetting" DROP CONSTRAINT "FlowiseSetting_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "IntegrationSession" DROP CONSTRAINT "IntegrationSession_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Label" DROP CONSTRAINT "Label_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Media" DROP CONSTRAINT "Media_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Media" DROP CONSTRAINT "Media_messageId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Message" DROP CONSTRAINT "Message_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Message" DROP CONSTRAINT "Message_sessionId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "MessageUpdate" DROP CONSTRAINT "MessageUpdate_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "MessageUpdate" DROP CONSTRAINT "MessageUpdate_messageId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "OpenaiBot" DROP CONSTRAINT "OpenaiBot_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "OpenaiBot" DROP CONSTRAINT "OpenaiBot_openaiCredsId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "OpenaiCreds" DROP CONSTRAINT "OpenaiCreds_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "OpenaiSetting" DROP CONSTRAINT "OpenaiSetting_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "OpenaiSetting" DROP CONSTRAINT "OpenaiSetting_openaiCredsId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "OpenaiSetting" DROP CONSTRAINT "OpenaiSetting_openaiIdFallback_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Proxy" DROP CONSTRAINT "Proxy_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Rabbitmq" DROP CONSTRAINT "Rabbitmq_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Session" DROP CONSTRAINT "Session_sessionId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Setting" DROP CONSTRAINT "Setting_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Sqs" DROP CONSTRAINT "Sqs_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Template" DROP CONSTRAINT "Template_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Typebot" DROP CONSTRAINT "Typebot_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "TypebotSetting" DROP CONSTRAINT "TypebotSetting_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "TypebotSetting" DROP CONSTRAINT "TypebotSetting_typebotIdFallback_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Webhook" DROP CONSTRAINT "Webhook_instanceId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Websocket" DROP CONSTRAINT "Websocket_instanceId_fkey";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Chat";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Chatwoot";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Contact";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Dify";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "DifySetting";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "EvolutionBot";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "EvolutionBotSetting";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Flowise";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "FlowiseSetting";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Instance";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "IntegrationSession";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Label";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Media";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Message";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "MessageUpdate";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "OpenaiBot";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "OpenaiCreds";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "OpenaiSetting";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Proxy";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Rabbitmq";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Session";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Setting";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Sqs";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Template";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Typebot";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "TypebotSetting";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Webhook";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Websocket";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "instances" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"connection_status" "InstanceConnectionStatus" NOT NULL DEFAULT 'open',
|
||||
"owner_jid" VARCHAR(100),
|
||||
"profile_name" VARCHAR(100),
|
||||
"profile_pic_url" VARCHAR(500),
|
||||
"integration" VARCHAR(100),
|
||||
"number" VARCHAR(100),
|
||||
"business_id" VARCHAR(100),
|
||||
"token" VARCHAR(255),
|
||||
"client_name" VARCHAR(100),
|
||||
"disconnection_reason_code" INTEGER,
|
||||
"disconnection_object" JSONB,
|
||||
"disconnection_at" TIMESTAMPTZ,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ,
|
||||
|
||||
CONSTRAINT "instances_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "sessions" (
|
||||
"id" TEXT NOT NULL,
|
||||
"session_id" TEXT NOT NULL,
|
||||
"creds" TEXT,
|
||||
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "sessions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "chats" (
|
||||
"id" TEXT NOT NULL,
|
||||
"remote_jid" VARCHAR(100) NOT NULL,
|
||||
"name" VARCHAR(100),
|
||||
"labels" JSONB,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "chats_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "contacts" (
|
||||
"id" TEXT NOT NULL,
|
||||
"remote_jid" VARCHAR(100) NOT NULL,
|
||||
"push_name" VARCHAR(100),
|
||||
"profile_pic_url" VARCHAR(500),
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "contacts_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "messages" (
|
||||
"id" TEXT NOT NULL,
|
||||
"key" JSONB NOT NULL,
|
||||
"push_name" VARCHAR(100),
|
||||
"participant" VARCHAR(100),
|
||||
"message_type" VARCHAR(100) NOT NULL,
|
||||
"message" JSONB NOT NULL,
|
||||
"context_info" JSONB,
|
||||
"message_timestamp" INTEGER NOT NULL,
|
||||
"chatwoot_message_id" INTEGER,
|
||||
"chatwoot_inbox_id" INTEGER,
|
||||
"chatwoot_conversation_id" INTEGER,
|
||||
"chatwoot_contact_inbox_source_id" VARCHAR(100),
|
||||
"chatwoot_is_read" BOOLEAN,
|
||||
"webhook_url" VARCHAR(500),
|
||||
"source" "DeviceMessage" NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
"session_id" TEXT,
|
||||
|
||||
CONSTRAINT "messages_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "message_updates" (
|
||||
"id" TEXT NOT NULL,
|
||||
"key_id" VARCHAR(100) NOT NULL,
|
||||
"remote_jid" VARCHAR(100) NOT NULL,
|
||||
"from_me" BOOLEAN NOT NULL,
|
||||
"participant" VARCHAR(100),
|
||||
"poll_updates" JSONB,
|
||||
"status" VARCHAR(30) NOT NULL,
|
||||
"message_id" TEXT NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "message_updates_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "webhooks" (
|
||||
"id" TEXT NOT NULL,
|
||||
"url" VARCHAR(500) NOT NULL,
|
||||
"enabled" BOOLEAN DEFAULT true,
|
||||
"events" JSONB,
|
||||
"webhook_by_events" BOOLEAN DEFAULT false,
|
||||
"webhook_base64" BOOLEAN DEFAULT false,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "webhooks_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "chatwoots" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN DEFAULT true,
|
||||
"account_id" VARCHAR(100),
|
||||
"token" VARCHAR(100),
|
||||
"url" VARCHAR(500),
|
||||
"name_inbox" VARCHAR(100),
|
||||
"sign_msg" BOOLEAN DEFAULT false,
|
||||
"sign_delimiter" VARCHAR(100),
|
||||
"number" VARCHAR(100),
|
||||
"reopen_conversation" BOOLEAN DEFAULT false,
|
||||
"conversation_pending" BOOLEAN DEFAULT false,
|
||||
"merge_brazil_contacts" BOOLEAN DEFAULT false,
|
||||
"import_contacts" BOOLEAN DEFAULT false,
|
||||
"import_messages" BOOLEAN DEFAULT false,
|
||||
"days_limit_import_messages" INTEGER,
|
||||
"organization" VARCHAR(100),
|
||||
"logo" VARCHAR(500),
|
||||
"ignore_jids" JSONB,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "chatwoots_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "labels" (
|
||||
"id" TEXT NOT NULL,
|
||||
"label_id" VARCHAR(100),
|
||||
"name" VARCHAR(100) NOT NULL,
|
||||
"color" VARCHAR(100) NOT NULL,
|
||||
"predefined_id" VARCHAR(100),
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "labels_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "proxies" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT false,
|
||||
"host" VARCHAR(100) NOT NULL,
|
||||
"port" VARCHAR(100) NOT NULL,
|
||||
"protocol" VARCHAR(100) NOT NULL,
|
||||
"username" VARCHAR(100) NOT NULL,
|
||||
"password" VARCHAR(100) NOT NULL,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "proxies_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "settings" (
|
||||
"id" TEXT NOT NULL,
|
||||
"reject_call" BOOLEAN NOT NULL DEFAULT false,
|
||||
"msg_call" VARCHAR(100),
|
||||
"groups_ignore" BOOLEAN NOT NULL DEFAULT false,
|
||||
"always_online" BOOLEAN NOT NULL DEFAULT false,
|
||||
"read_messages" BOOLEAN NOT NULL DEFAULT false,
|
||||
"read_status" BOOLEAN NOT NULL DEFAULT false,
|
||||
"sync_full_history" BOOLEAN NOT NULL DEFAULT false,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "settings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "rabbitmqs" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT false,
|
||||
"events" JSONB NOT NULL,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "rabbitmqs_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "sqss" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT false,
|
||||
"events" JSONB NOT NULL,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "sqss_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "websockets" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT false,
|
||||
"events" JSONB NOT NULL,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "websockets_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "typebots" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"description" VARCHAR(255),
|
||||
"url" VARCHAR(500) NOT NULL,
|
||||
"typebot" VARCHAR(100) NOT NULL,
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ,
|
||||
"ignore_jids" JSONB,
|
||||
"trigger_type" "TriggerType",
|
||||
"trigger_operator" "TriggerOperator",
|
||||
"trigger_value" TEXT,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "typebots_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "typebot_settings" (
|
||||
"id" TEXT NOT NULL,
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"typebot_id_fallback" VARCHAR(100),
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "typebot_settings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "medias" (
|
||||
"id" TEXT NOT NULL,
|
||||
"file_name" VARCHAR(500) NOT NULL,
|
||||
"type" VARCHAR(100) NOT NULL,
|
||||
"mime_type" VARCHAR(100) NOT NULL,
|
||||
"created_at" DATE DEFAULT CURRENT_TIMESTAMP,
|
||||
"message_id" TEXT NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "medias_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "openai_creds" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" VARCHAR(255),
|
||||
"api_key" VARCHAR(255),
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "openai_creds_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "openai_bots" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"description" VARCHAR(255),
|
||||
"assistant_id" VARCHAR(255),
|
||||
"function_url" VARCHAR(500),
|
||||
"model" VARCHAR(100),
|
||||
"system_messages" JSONB,
|
||||
"assistant_messages" JSONB,
|
||||
"user_messages" JSONB,
|
||||
"max_tokens" INTEGER,
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"trigger_type" "TriggerType",
|
||||
"trigger_operator" "TriggerOperator",
|
||||
"trigger_value" TEXT,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"bot_type" "OpenaiBotType" NOT NULL,
|
||||
"openai_creds_id" TEXT NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "openai_bots_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "integration_sessions" (
|
||||
"id" TEXT NOT NULL,
|
||||
"session_id" VARCHAR(255) NOT NULL,
|
||||
"remote_jid" VARCHAR(100) NOT NULL,
|
||||
"push_name" TEXT,
|
||||
"status" "SessionStatus" NOT NULL,
|
||||
"await_user" BOOLEAN NOT NULL DEFAULT false,
|
||||
"context" JSONB,
|
||||
"type" VARCHAR(100),
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"parameters" JSONB,
|
||||
"botId" TEXT,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "integration_sessions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "openai_settings" (
|
||||
"id" TEXT NOT NULL,
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"speech_to_text" BOOLEAN DEFAULT false,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"openai_creds_id" TEXT NOT NULL,
|
||||
"openai_id_fallback" VARCHAR(100),
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "openai_settings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "templates" (
|
||||
"id" TEXT NOT NULL,
|
||||
"template_id" VARCHAR(255) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"template" JSONB NOT NULL,
|
||||
"webhook_url" VARCHAR(500),
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "templates_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "difys" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"description" VARCHAR(255),
|
||||
"bot_type" "DifyBotType" NOT NULL,
|
||||
"api_url" VARCHAR(255),
|
||||
"api_key" VARCHAR(255),
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"trigger_type" "TriggerType",
|
||||
"trigger_operator" "TriggerOperator",
|
||||
"trigger_value" TEXT,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "difys_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "dify_settings" (
|
||||
"id" TEXT NOT NULL,
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"dify_id_fallback" VARCHAR(100),
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "dify_settings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "evolution_bots" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"description" VARCHAR(255),
|
||||
"api_url" VARCHAR(255),
|
||||
"api_key" VARCHAR(255),
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"trigger_type" "TriggerType",
|
||||
"trigger_operator" "TriggerOperator",
|
||||
"trigger_value" TEXT,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "evolution_bots_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "evolution_bot_settings" (
|
||||
"id" TEXT NOT NULL,
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"bot_id_fallback" VARCHAR(100),
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "evolution_bot_settings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "flowises" (
|
||||
"id" TEXT NOT NULL,
|
||||
"enabled" BOOLEAN NOT NULL DEFAULT true,
|
||||
"description" VARCHAR(255),
|
||||
"api_url" VARCHAR(255),
|
||||
"api_key" VARCHAR(255),
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"trigger_type" "TriggerType",
|
||||
"trigger_operator" "TriggerOperator",
|
||||
"trigger_value" TEXT,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "flowises_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "flowise_settings" (
|
||||
"id" TEXT NOT NULL,
|
||||
"expire" INTEGER DEFAULT 0,
|
||||
"keyword_finish" VARCHAR(100),
|
||||
"delay_message" INTEGER,
|
||||
"unknown_message" VARCHAR(100),
|
||||
"listening_from_me" BOOLEAN DEFAULT false,
|
||||
"stop_bot_from_me" BOOLEAN DEFAULT false,
|
||||
"keep_open" BOOLEAN DEFAULT false,
|
||||
"debounce_time" INTEGER,
|
||||
"ignore_jids" JSONB,
|
||||
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMPTZ NOT NULL,
|
||||
"flowise_id_fallback" VARCHAR(100),
|
||||
"instance_id" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "flowise_settings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "instances_name_key" ON "instances"("name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "sessions_session_id_key" ON "sessions"("session_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "contacts_remote_jid_instance_id_key" ON "contacts"("remote_jid", "instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "webhooks_instance_id_key" ON "webhooks"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "chatwoots_instance_id_key" ON "chatwoots"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "labels_label_id_instance_id_key" ON "labels"("label_id", "instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "proxies_instance_id_key" ON "proxies"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "settings_instance_id_key" ON "settings"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "rabbitmqs_instance_id_key" ON "rabbitmqs"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "sqss_instance_id_key" ON "sqss"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "websockets_instance_id_key" ON "websockets"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "typebot_settings_instance_id_key" ON "typebot_settings"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "medias_file_name_key" ON "medias"("file_name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "medias_message_id_key" ON "medias"("message_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "openai_creds_name_key" ON "openai_creds"("name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "openai_creds_api_key_key" ON "openai_creds"("api_key");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "integration_sessions_session_id_key" ON "integration_sessions"("session_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "openai_settings_openai_creds_id_key" ON "openai_settings"("openai_creds_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "openai_settings_instance_id_key" ON "openai_settings"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "templates_template_id_key" ON "templates"("template_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "templates_name_key" ON "templates"("name");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "dify_settings_instance_id_key" ON "dify_settings"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "evolution_bot_settings_instance_id_key" ON "evolution_bot_settings"("instance_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "flowise_settings_instance_id_key" ON "flowise_settings"("instance_id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_session_id_fkey" FOREIGN KEY ("session_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "chats" ADD CONSTRAINT "chats_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "contacts" ADD CONSTRAINT "contacts_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "messages" ADD CONSTRAINT "messages_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "messages" ADD CONSTRAINT "messages_session_id_fkey" FOREIGN KEY ("session_id") REFERENCES "integration_sessions"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "message_updates" ADD CONSTRAINT "message_updates_message_id_fkey" FOREIGN KEY ("message_id") REFERENCES "messages"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "message_updates" ADD CONSTRAINT "message_updates_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "webhooks" ADD CONSTRAINT "webhooks_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "chatwoots" ADD CONSTRAINT "chatwoots_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "labels" ADD CONSTRAINT "labels_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "proxies" ADD CONSTRAINT "proxies_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "settings" ADD CONSTRAINT "settings_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "rabbitmqs" ADD CONSTRAINT "rabbitmqs_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "sqss" ADD CONSTRAINT "sqss_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "websockets" ADD CONSTRAINT "websockets_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "typebots" ADD CONSTRAINT "typebots_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "typebot_settings" ADD CONSTRAINT "typebot_settings_typebot_id_fallback_fkey" FOREIGN KEY ("typebot_id_fallback") REFERENCES "typebots"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "typebot_settings" ADD CONSTRAINT "typebot_settings_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "medias" ADD CONSTRAINT "medias_message_id_fkey" FOREIGN KEY ("message_id") REFERENCES "messages"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "medias" ADD CONSTRAINT "medias_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "openai_creds" ADD CONSTRAINT "openai_creds_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "openai_bots" ADD CONSTRAINT "openai_bots_openai_creds_id_fkey" FOREIGN KEY ("openai_creds_id") REFERENCES "openai_creds"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "openai_bots" ADD CONSTRAINT "openai_bots_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "integration_sessions" ADD CONSTRAINT "integration_sessions_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "openai_settings" ADD CONSTRAINT "openai_settings_openai_creds_id_fkey" FOREIGN KEY ("openai_creds_id") REFERENCES "openai_creds"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "openai_settings" ADD CONSTRAINT "openai_settings_openai_id_fallback_fkey" FOREIGN KEY ("openai_id_fallback") REFERENCES "openai_bots"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "openai_settings" ADD CONSTRAINT "openai_settings_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "templates" ADD CONSTRAINT "templates_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "difys" ADD CONSTRAINT "difys_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "dify_settings" ADD CONSTRAINT "dify_settings_dify_id_fallback_fkey" FOREIGN KEY ("dify_id_fallback") REFERENCES "difys"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "dify_settings" ADD CONSTRAINT "dify_settings_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "evolution_bots" ADD CONSTRAINT "evolution_bots_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "evolution_bot_settings" ADD CONSTRAINT "evolution_bot_settings_bot_id_fallback_fkey" FOREIGN KEY ("bot_id_fallback") REFERENCES "evolution_bots"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "evolution_bot_settings" ADD CONSTRAINT "evolution_bot_settings_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "flowises" ADD CONSTRAINT "flowises_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "flowise_settings" ADD CONSTRAINT "flowise_settings_flowise_id_fallback_fkey" FOREIGN KEY ("flowise_id_fallback") REFERENCES "flowises"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "flowise_settings" ADD CONSTRAINT "flowise_settings_instance_id_fkey" FOREIGN KEY ("instance_id") REFERENCES "instances"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -9,9 +9,8 @@ generator client {
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_CONNECTION_URI")
|
||||
directUrl = env("DATABASE_DIRECT_URL")
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_CONNECTION_URI")
|
||||
}
|
||||
|
||||
enum InstanceConnectionStatus {
|
||||
@ -64,137 +63,118 @@ enum DifyBotType {
|
||||
model Instance {
|
||||
id String @id @default(cuid())
|
||||
name String @unique @db.VarChar(255)
|
||||
connectionStatus InstanceConnectionStatus @default(open) @map("connection_status")
|
||||
ownerJid String? @map("owner_jid") @db.VarChar(100)
|
||||
profileName String? @map("profile_name") @db.VarChar(100)
|
||||
profilePicUrl String? @map("profile_pic_url") @db.VarChar(500)
|
||||
connectionStatus InstanceConnectionStatus @default(open)
|
||||
ownerJid String? @db.VarChar(100)
|
||||
profileName String? @db.VarChar(100)
|
||||
profilePicUrl String? @db.VarChar(500)
|
||||
integration String? @db.VarChar(100)
|
||||
number String? @db.VarChar(100)
|
||||
businessId String? @map("business_id") @db.VarChar(100)
|
||||
businessId String? @db.VarChar(100)
|
||||
token String? @db.VarChar(255)
|
||||
clientName String? @map("client_name") @db.VarChar(100)
|
||||
disconnectionReasonCode Int? @map("disconnection_reason_code") @db.Integer
|
||||
disconnectionObject Json? @map("disconnection_object") @db.JsonB
|
||||
disconnectionAt DateTime? @map("disconnection_at") @db.Timestamptz()
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
Chat Chat[]
|
||||
Contact Contact[]
|
||||
Message Message[]
|
||||
Webhook Webhook?
|
||||
Chatwoot Chatwoot?
|
||||
Label Label[]
|
||||
Proxy Proxy?
|
||||
Setting Setting?
|
||||
Rabbitmq Rabbitmq?
|
||||
Sqs Sqs?
|
||||
Websocket Websocket?
|
||||
Typebot Typebot[]
|
||||
Session Session?
|
||||
MessageUpdate MessageUpdate[]
|
||||
TypebotSetting TypebotSetting?
|
||||
Media Media[]
|
||||
OpenaiCreds OpenaiCreds[]
|
||||
OpenaiBot OpenaiBot[]
|
||||
OpenaiSetting OpenaiSetting?
|
||||
Template Template[]
|
||||
Dify Dify[]
|
||||
DifySetting DifySetting?
|
||||
integrationSessions IntegrationSession[]
|
||||
EvolutionBot EvolutionBot[]
|
||||
EvolutionBotSetting EvolutionBotSetting?
|
||||
Flowise Flowise[]
|
||||
FlowiseSetting FlowiseSetting?
|
||||
|
||||
@@map("instances")
|
||||
clientName String? @db.VarChar(100)
|
||||
disconnectionReasonCode Int? @db.Integer
|
||||
disconnectionObject Json? @db.JsonB
|
||||
disconnectionAt DateTime? @db.Timestamp
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
Chat Chat[]
|
||||
Contact Contact[]
|
||||
Message Message[]
|
||||
Webhook Webhook?
|
||||
Chatwoot Chatwoot?
|
||||
Label Label[]
|
||||
Proxy Proxy?
|
||||
Setting Setting?
|
||||
Rabbitmq Rabbitmq?
|
||||
Sqs Sqs?
|
||||
Websocket Websocket?
|
||||
Typebot Typebot[]
|
||||
Session Session?
|
||||
MessageUpdate MessageUpdate[]
|
||||
TypebotSetting TypebotSetting?
|
||||
Media Media[]
|
||||
OpenaiCreds OpenaiCreds[]
|
||||
OpenaiBot OpenaiBot[]
|
||||
OpenaiSetting OpenaiSetting?
|
||||
Template Template[]
|
||||
Dify Dify[]
|
||||
DifySetting DifySetting?
|
||||
integrationSessions IntegrationSession[]
|
||||
EvolutionBot EvolutionBot[]
|
||||
EvolutionBotSetting EvolutionBotSetting?
|
||||
Flowise Flowise[]
|
||||
FlowiseSetting FlowiseSetting?
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionId String @unique @map("session_id")
|
||||
sessionId String @unique
|
||||
creds String? @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
Instance Instance @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("sessions")
|
||||
createdAt DateTime @default(now()) @db.Timestamp
|
||||
Instance Instance @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Chat {
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @map("remote_jid") @db.VarChar(100)
|
||||
name String? @db.VarChar(100)
|
||||
labels Json? @db.JsonB
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("chats")
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @db.VarChar(100)
|
||||
name String? @db.VarChar(100)
|
||||
labels Json? @db.JsonB
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Contact {
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @map("remote_jid") @db.VarChar(100)
|
||||
pushName String? @map("push_name") @db.VarChar(100)
|
||||
profilePicUrl String? @map("profile_pic_url") @db.VarChar(500)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
remoteJid String @db.VarChar(100)
|
||||
pushName String? @db.VarChar(100)
|
||||
profilePicUrl String? @db.VarChar(500)
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
|
||||
@@unique([remoteJid, instanceId])
|
||||
@@map("contacts")
|
||||
}
|
||||
|
||||
model Message {
|
||||
id String @id @default(cuid())
|
||||
key Json @db.JsonB
|
||||
pushName String? @map("push_name") @db.VarChar(100)
|
||||
participant String? @db.VarChar(100)
|
||||
messageType String @map("message_type") @db.VarChar(100)
|
||||
message Json @db.JsonB
|
||||
contextInfo Json? @map("context_info") @db.JsonB
|
||||
messageTimestamp Int @map("message_timestamp") @db.Integer
|
||||
chatwootMessageId Int? @map("chatwoot_message_id") @db.Integer
|
||||
chatwootInboxId Int? @map("chatwoot_inbox_id") @db.Integer
|
||||
chatwootConversationId Int? @map("chatwoot_conversation_id") @db.Integer
|
||||
chatwootContactInboxSourceId String? @map("chatwoot_contact_inbox_source_id") @db.VarChar(100)
|
||||
chatwootIsRead Boolean? @map("chatwoot_is_read") @db.Boolean
|
||||
webhookUrl String? @map("webhook_url") @db.VarChar(500)
|
||||
id String @id @default(cuid())
|
||||
key Json @db.JsonB
|
||||
pushName String? @db.VarChar(100)
|
||||
participant String? @db.VarChar(100)
|
||||
messageType String @db.VarChar(100)
|
||||
message Json @db.JsonB
|
||||
contextInfo Json? @db.JsonB
|
||||
source DeviceMessage
|
||||
messageTimestamp Int @db.Integer
|
||||
chatwootMessageId Int? @db.Integer
|
||||
chatwootInboxId Int? @db.Integer
|
||||
chatwootConversationId Int? @db.Integer
|
||||
chatwootContactInboxSourceId String? @db.VarChar(100)
|
||||
chatwootIsRead Boolean? @db.Boolean
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
MessageUpdate MessageUpdate[]
|
||||
Media Media?
|
||||
webhookUrl String? @db.VarChar(500)
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
MessageUpdate MessageUpdate[]
|
||||
Media Media?
|
||||
|
||||
sessionId String? @map("session_id")
|
||||
sessionId String?
|
||||
session IntegrationSession? @relation(fields: [sessionId], references: [id])
|
||||
|
||||
@@map("messages")
|
||||
}
|
||||
|
||||
model MessageUpdate {
|
||||
id String @id @default(cuid())
|
||||
keyId String @map("key_id") @db.VarChar(100)
|
||||
remoteJid String @map("remote_jid") @db.VarChar(100)
|
||||
fromMe Boolean @map("from_me") @db.Boolean
|
||||
participant String? @db.VarChar(100)
|
||||
pollUpdates Json? @map("poll_updates") @db.JsonB
|
||||
status String @db.VarChar(30)
|
||||
|
||||
messageId String @map("message_id")
|
||||
Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("message_updates")
|
||||
id String @id @default(cuid())
|
||||
keyId String @db.VarChar(100)
|
||||
remoteJid String @db.VarChar(100)
|
||||
fromMe Boolean @db.Boolean
|
||||
participant String? @db.VarChar(100)
|
||||
pollUpdates Json? @db.JsonB
|
||||
status String @db.VarChar(30)
|
||||
Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
messageId String
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Webhook {
|
||||
@ -202,133 +182,110 @@ model Webhook {
|
||||
url String @db.VarChar(500)
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
events Json? @db.JsonB
|
||||
webhookByEvents Boolean? @default(false) @map("webhook_by_events") @db.Boolean
|
||||
webhookBase64 Boolean? @default(false) @map("webhook_base64") @db.Boolean
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("webhooks")
|
||||
webhookByEvents Boolean? @default(false) @db.Boolean
|
||||
webhookBase64 Boolean? @default(false) @db.Boolean
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Chatwoot {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
accountId String? @map("account_id") @db.VarChar(100)
|
||||
accountId String? @db.VarChar(100)
|
||||
token String? @db.VarChar(100)
|
||||
url String? @db.VarChar(500)
|
||||
nameInbox String? @map("name_inbox") @db.VarChar(100)
|
||||
signMsg Boolean? @default(false) @map("sign_msg") @db.Boolean
|
||||
signDelimiter String? @map("sign_delimiter") @db.VarChar(100)
|
||||
nameInbox String? @db.VarChar(100)
|
||||
signMsg Boolean? @default(false) @db.Boolean
|
||||
signDelimiter String? @db.VarChar(100)
|
||||
number String? @db.VarChar(100)
|
||||
reopenConversation Boolean? @default(false) @map("reopen_conversation") @db.Boolean
|
||||
conversationPending Boolean? @default(false) @map("conversation_pending") @db.Boolean
|
||||
mergeBrazilContacts Boolean? @default(false) @map("merge_brazil_contacts") @db.Boolean
|
||||
importContacts Boolean? @default(false) @map("import_contacts") @db.Boolean
|
||||
importMessages Boolean? @default(false) @map("import_messages") @db.Boolean
|
||||
daysLimitImportMessages Int? @map("days_limit_import_messages") @db.Integer
|
||||
reopenConversation Boolean? @default(false) @db.Boolean
|
||||
conversationPending Boolean? @default(false) @db.Boolean
|
||||
mergeBrazilContacts Boolean? @default(false) @db.Boolean
|
||||
importContacts Boolean? @default(false) @db.Boolean
|
||||
importMessages Boolean? @default(false) @db.Boolean
|
||||
daysLimitImportMessages Int? @db.Integer
|
||||
organization String? @db.VarChar(100)
|
||||
logo String? @db.VarChar(500)
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("chatwoots")
|
||||
ignoreJids Json?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Label {
|
||||
id String @id @default(cuid())
|
||||
labelId String? @map("label_id") @db.VarChar(100)
|
||||
labelId String? @db.VarChar(100)
|
||||
name String @db.VarChar(100)
|
||||
color String @db.VarChar(100)
|
||||
predefinedId String? @map("predefined_id") @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
predefinedId String? @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
|
||||
@@unique([labelId, instanceId])
|
||||
@@map("labels")
|
||||
}
|
||||
|
||||
model Proxy {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
host String @db.VarChar(100)
|
||||
port String @db.VarChar(100)
|
||||
protocol String @db.VarChar(100)
|
||||
username String @db.VarChar(100)
|
||||
password String @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("proxies")
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
host String @db.VarChar(100)
|
||||
port String @db.VarChar(100)
|
||||
protocol String @db.VarChar(100)
|
||||
username String @db.VarChar(100)
|
||||
password String @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Setting {
|
||||
id String @id @default(cuid())
|
||||
rejectCall Boolean @default(false) @map("reject_call") @db.Boolean
|
||||
msgCall String? @map("msg_call") @db.VarChar(100)
|
||||
groupsIgnore Boolean @default(false) @map("groups_ignore") @db.Boolean
|
||||
alwaysOnline Boolean @default(false) @map("always_online") @db.Boolean
|
||||
readMessages Boolean @default(false) @map("read_messages") @db.Boolean
|
||||
readStatus Boolean @default(false) @map("read_status") @db.Boolean
|
||||
syncFullHistory Boolean @default(false) @map("sync_full_history") @db.Boolean
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("settings")
|
||||
rejectCall Boolean @default(false) @db.Boolean
|
||||
msgCall String? @db.VarChar(100)
|
||||
groupsIgnore Boolean @default(false) @db.Boolean
|
||||
alwaysOnline Boolean @default(false) @db.Boolean
|
||||
readMessages Boolean @default(false) @db.Boolean
|
||||
readStatus Boolean @default(false) @db.Boolean
|
||||
syncFullHistory Boolean @default(false) @db.Boolean
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Rabbitmq {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
events Json @db.JsonB
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("rabbitmqs")
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
events Json @db.JsonB
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Sqs {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
events Json @db.JsonB
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("sqss")
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
events Json @db.JsonB
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Websocket {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
events Json @db.JsonB
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("websockets")
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false) @db.Boolean
|
||||
events Json @db.JsonB
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Typebot {
|
||||
@ -338,340 +295,284 @@ model Typebot {
|
||||
url String @db.VarChar(500)
|
||||
typebot String @db.VarChar(100)
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
triggerType TriggerType? @map("trigger_type")
|
||||
triggerOperator TriggerOperator? @map("trigger_operator")
|
||||
triggerValue String? @map("trigger_value")
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
TypebotSetting TypebotSetting[]
|
||||
|
||||
@@map("typebots")
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
ignoreJids Json?
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
TypebotSetting TypebotSetting[]
|
||||
}
|
||||
|
||||
model TypebotSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
typebotIdFallback String? @map("typebot_id_fallback") @db.VarChar(100)
|
||||
Fallback Typebot? @relation(fields: [typebotIdFallback], references: [id])
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("typebot_settings")
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
typebotIdFallback String? @db.VarChar(100)
|
||||
ignoreJids Json?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback Typebot? @relation(fields: [typebotIdFallback], references: [id])
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Media {
|
||||
id String @id @default(cuid())
|
||||
fileName String @unique @map("file_name") @db.VarChar(500)
|
||||
type String @db.VarChar(100)
|
||||
mimetype String @map("mime_type") @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Date
|
||||
|
||||
messageId String @unique @map("message_id")
|
||||
Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("medias")
|
||||
id String @id @default(cuid())
|
||||
fileName String @unique @db.VarChar(500)
|
||||
type String @db.VarChar(100)
|
||||
mimetype String @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
messageId String @unique
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model OpenaiCreds {
|
||||
id String @id @default(cuid())
|
||||
name String? @unique @db.VarChar(255)
|
||||
apiKey String? @unique @map("api_key") @db.VarChar(255)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
id String @id @default(cuid())
|
||||
name String? @unique @db.VarChar(255)
|
||||
apiKey String? @unique @db.VarChar(255)
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
OpenaiAssistant OpenaiBot[]
|
||||
OpenaiSetting OpenaiSetting?
|
||||
|
||||
@@map("openai_creds")
|
||||
}
|
||||
|
||||
model OpenaiBot {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true) @db.Boolean
|
||||
description String? @db.VarChar(255)
|
||||
assistantId String? @map("assistant_id") @db.VarChar(255)
|
||||
functionUrl String? @map("function_url") @db.VarChar(500)
|
||||
botType OpenaiBotType
|
||||
assistantId String? @db.VarChar(255)
|
||||
functionUrl String? @db.VarChar(500)
|
||||
model String? @db.VarChar(100)
|
||||
systemMessages Json? @map("system_messages") @db.JsonB
|
||||
assistantMessages Json? @map("assistant_messages") @db.JsonB
|
||||
userMessages Json? @map("user_messages") @db.JsonB
|
||||
maxTokens Int? @map("max_tokens") @db.Integer
|
||||
systemMessages Json? @db.JsonB
|
||||
assistantMessages Json? @db.JsonB
|
||||
userMessages Json? @db.JsonB
|
||||
maxTokens Int? @db.Integer
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
triggerType TriggerType? @map("trigger_type")
|
||||
triggerOperator TriggerOperator? @map("trigger_operator")
|
||||
triggerValue String? @map("trigger_value")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
botType OpenaiBotType @map("bot_type")
|
||||
|
||||
openaiCredsId String @map("openai_creds_id")
|
||||
OpenaiCreds OpenaiCreds @relation(fields: [openaiCredsId], references: [id], onDelete: Cascade)
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
OpenaiSetting OpenaiSetting[]
|
||||
|
||||
@@map("openai_bots")
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
OpenaiCreds OpenaiCreds @relation(fields: [openaiCredsId], references: [id], onDelete: Cascade)
|
||||
openaiCredsId String
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
OpenaiSetting OpenaiSetting[]
|
||||
}
|
||||
|
||||
model IntegrationSession {
|
||||
id String @id @default(cuid())
|
||||
sessionId String @unique @map("session_id") @db.VarChar(255)
|
||||
remoteJid String @map("remote_jid") @db.VarChar(100)
|
||||
pushName String? @map("push_name")
|
||||
sessionId String @db.VarChar(255)
|
||||
remoteJid String @db.VarChar(100)
|
||||
pushName String?
|
||||
status SessionStatus
|
||||
awaitUser Boolean @default(false) @map("await_user") @db.Boolean
|
||||
awaitUser Boolean @default(false) @db.Boolean
|
||||
context Json?
|
||||
type String? @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Message Message[]
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
parameters Json? @db.JsonB
|
||||
botId String?
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
Message Message[]
|
||||
|
||||
@@map("integration_sessions")
|
||||
botId String?
|
||||
}
|
||||
|
||||
model OpenaiSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
speechToText Boolean? @default(false) @map("speech_to_text") @db.Boolean
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
openaiCredsId String @unique @map("openai_creds_id")
|
||||
OpenaiCreds OpenaiCreds? @relation(fields: [openaiCredsId], references: [id])
|
||||
|
||||
openaiIdFallback String? @map("openai_id_fallback") @db.VarChar(100)
|
||||
Fallback OpenaiBot? @relation(fields: [openaiIdFallback], references: [id])
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("openai_settings")
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
speechToText Boolean? @default(false) @db.Boolean
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
OpenaiCreds OpenaiCreds? @relation(fields: [openaiCredsId], references: [id])
|
||||
openaiCredsId String @unique
|
||||
Fallback OpenaiBot? @relation(fields: [openaiIdFallback], references: [id])
|
||||
openaiIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Template {
|
||||
id String @id @default(cuid())
|
||||
templateId String @unique @map("template_id") @db.VarChar(255)
|
||||
templateId String @unique @db.VarChar(255)
|
||||
name String @unique @db.VarChar(255)
|
||||
template Json @db.JsonB
|
||||
webhookUrl String? @map("webhook_url") @db.VarChar(500)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("templates")
|
||||
webhookUrl String? @db.VarChar(500)
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Dify {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true) @db.Boolean
|
||||
description String? @db.VarChar(255)
|
||||
botType DifyBotType @map("bot_type")
|
||||
apiUrl String? @map("api_url") @db.VarChar(255)
|
||||
apiKey String? @map("api_key") @db.VarChar(255)
|
||||
botType DifyBotType
|
||||
apiUrl String? @db.VarChar(255)
|
||||
apiKey String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
triggerType TriggerType? @map("trigger_type")
|
||||
triggerOperator TriggerOperator? @map("trigger_operator")
|
||||
triggerValue String? @map("trigger_value")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
DifySetting DifySetting[]
|
||||
|
||||
@@map("difys")
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
DifySetting DifySetting[]
|
||||
}
|
||||
|
||||
model DifySetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
difyIdFallback String? @map("dify_id_fallback") @db.VarChar(100)
|
||||
Fallback Dify? @relation(fields: [difyIdFallback], references: [id])
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("dify_settings")
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback Dify? @relation(fields: [difyIdFallback], references: [id])
|
||||
difyIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model EvolutionBot {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true) @db.Boolean
|
||||
description String? @db.VarChar(255)
|
||||
apiUrl String? @map("api_url") @db.VarChar(255)
|
||||
apiKey String? @map("api_key") @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
triggerType TriggerType? @map("trigger_type")
|
||||
triggerOperator TriggerOperator? @map("trigger_operator")
|
||||
triggerValue String? @map("trigger_value")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true) @db.Boolean
|
||||
description String? @db.VarChar(255)
|
||||
apiUrl String? @db.VarChar(255)
|
||||
apiKey String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
EvolutionBotSetting EvolutionBotSetting[]
|
||||
|
||||
@@map("evolution_bots")
|
||||
}
|
||||
|
||||
model EvolutionBotSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
botIdFallback String? @map("bot_id_fallback") @db.VarChar(100)
|
||||
Fallback EvolutionBot? @relation(fields: [botIdFallback], references: [id])
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("evolution_bot_settings")
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback EvolutionBot? @relation(fields: [botIdFallback], references: [id])
|
||||
botIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Flowise {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true) @db.Boolean
|
||||
description String? @db.VarChar(255)
|
||||
apiUrl String? @map("api_url") @db.VarChar(255)
|
||||
apiKey String? @map("api_key") @db.VarChar(255)
|
||||
apiUrl String? @db.VarChar(255)
|
||||
apiKey String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
triggerType TriggerType? @map("trigger_type")
|
||||
triggerOperator TriggerOperator? @map("trigger_operator")
|
||||
triggerValue String? @map("trigger_value")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
instanceId String @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
FlowiseSetting FlowiseSetting[]
|
||||
|
||||
@@map("flowises")
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
FlowiseSetting FlowiseSetting[]
|
||||
}
|
||||
|
||||
model FlowiseSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @map("keyword_finish") @db.VarChar(100)
|
||||
delayMessage Int? @map("delay_message") @db.Integer
|
||||
unknownMessage String? @map("unknown_message") @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @map("listening_from_me") @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @map("stop_bot_from_me") @db.Boolean
|
||||
keepOpen Boolean? @default(false) @map("keep_open") @db.Boolean
|
||||
debounceTime Int? @map("debounce_time") @db.Integer
|
||||
ignoreJids Json? @map("ignore_jids")
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
flowiseIdFallback String? @map("flowise_id_fallback") @db.VarChar(100)
|
||||
Fallback Flowise? @relation(fields: [flowiseIdFallback], references: [id])
|
||||
|
||||
instanceId String @unique @map("instance_id")
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("flowise_settings")
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Integer
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Integer
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false) @db.Boolean
|
||||
stopBotFromMe Boolean? @default(false) @db.Boolean
|
||||
keepOpen Boolean? @default(false) @db.Boolean
|
||||
debounceTime Int? @db.Integer
|
||||
ignoreJids Json?
|
||||
createdAt DateTime? @default(now()) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback Flowise? @relation(fields: [flowiseIdFallback], references: [id])
|
||||
flowiseIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model IsOnWhatsapp {
|
||||
|
@ -204,7 +204,7 @@ export class InstanceController {
|
||||
const urlServer = this.configService.get<HttpServer>('SERVER').URL;
|
||||
|
||||
try {
|
||||
await this.chatwootService.create(instance, {
|
||||
this.chatwootService.create(instance, {
|
||||
enabled: true,
|
||||
accountId: instanceData.chatwootAccountId,
|
||||
token: instanceData.chatwootToken,
|
||||
@ -220,10 +220,10 @@ export class InstanceController {
|
||||
daysLimitImportMessages: instanceData.chatwootDaysLimitImportMessages ?? 60,
|
||||
organization: instanceData.chatwootOrganization,
|
||||
logo: instanceData.chatwootLogo,
|
||||
autoCreate: instanceData.chatwootAutoCreate ?? true,
|
||||
autoCreate: instanceData.chatwootAutoCreate !== false,
|
||||
});
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
this.logger.log(error);
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -1477,7 +1477,7 @@ export class ChatwootService {
|
||||
let inReplyToExternalId = null;
|
||||
|
||||
if (msg) {
|
||||
inReplyToExternalId = msg.message?.extendedTextMessage?.contextInfo?.stanzaId ?? msg.contextInfo?.stanzaId;
|
||||
inReplyToExternalId = msg.message?.extendedTextMessage?.contextInfo?.stanzaId;
|
||||
if (inReplyToExternalId) {
|
||||
const message = await this.getMessageByKeyId(instance, inReplyToExternalId);
|
||||
if (message?.chatwootMessageId) {
|
||||
|
2
src/cache/cacheengine.ts
vendored
2
src/cache/cacheengine.ts
vendored
@ -20,6 +20,8 @@ export class CacheEngine {
|
||||
logger.verbose(`LocalCache initialized for ${module}`);
|
||||
this.engine = new LocalCache(configService, module);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public getEngine() {
|
||||
|
Loading…
Reference in New Issue
Block a user