mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-11 02:49:36 -06:00
This commit introduces changes to support managing WhatsApp templates using the official WhatsApp Business API. The following modifications have been made: - Implemented a new Template model in the Prisma schema, including fields for template ID, name, language, and associated Instance (business ID, instance ID, and created/updated timestamps). - Modified the Instance model in the Prisma schema to include a Template relationship. - Updated InstanceController to include a new `businessId` property in the InstanceDto. - Added a new TemplateRouter, TemplateController, and TemplateService to handle template-related requests and services. - Updated the WebhookService to utilize the new TemplateService. - Added new TypebotController, WebhookController, and WAMonitoringService methods to handle template-related events. - Updated the validate schema to include a new template schema. The main goal of this commit is to enable managing WhatsApp templates, including creating, updating, and deleting templates, as well as associating them with specific instances.
22 lines
709 B
SQL
22 lines
709 B
SQL
-- CreateTable
|
|
CREATE TABLE "Template" (
|
|
"id" TEXT NOT NULL,
|
|
"name" VARCHAR(255) NOT NULL,
|
|
"language" VARCHAR(255) NOT NULL,
|
|
"templateId" VARCHAR(255) NOT NULL,
|
|
"createdAt" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" TIMESTAMP NOT NULL,
|
|
"instanceId" TEXT NOT NULL,
|
|
|
|
CONSTRAINT "Template_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "Template_templateId_key" ON "Template"("templateId");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "Template_instanceId_key" ON "Template"("instanceId");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "Template" ADD CONSTRAINT "Template_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|