diff --git a/prisma/migrations/20240712162206_remove_templates_table/migration.sql b/prisma/migrations/20240712162206_remove_templates_table/migration.sql new file mode 100644 index 000000000..3da4351a9 --- /dev/null +++ b/prisma/migrations/20240712162206_remove_templates_table/migration.sql @@ -0,0 +1,11 @@ +/* + Warnings: + + - You are about to drop the `Template` table. If the table is not empty, all the data it contains will be lost. + +*/ +-- DropForeignKey +ALTER TABLE "Template" DROP CONSTRAINT "Template_instanceId_fkey"; + +-- DropTable +DROP TABLE "Template"; diff --git a/prisma/postgresql-schema.prisma b/prisma/postgresql-schema.prisma index 6c0ee0d4d..fdb73b246 100644 --- a/prisma/postgresql-schema.prisma +++ b/prisma/postgresql-schema.prisma @@ -75,7 +75,6 @@ model Instance { MessageUpdate MessageUpdate[] TypebotSession TypebotSession[] TypebotSetting TypebotSetting? - Template Template[] } model Session { @@ -306,14 +305,3 @@ model TypebotSetting { Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade) instanceId String @unique } - -model Template { - id String @id @default(cuid()) - name String @db.VarChar(255) - language String @db.VarChar(255) - templateId 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 -} diff --git a/src/api/services/template.service.ts b/src/api/services/template.service.ts index d00aec47a..2fd88a9e5 100644 --- a/src/api/services/template.service.ts +++ b/src/api/services/template.service.ts @@ -1,4 +1,3 @@ -import { Template } from '@prisma/client'; import axios from 'axios'; import { ConfigService, WaBusiness } from '../../config/env.config'; @@ -39,7 +38,7 @@ export class TemplateService { return response.data; } - public async create(instance: InstanceDto, data: TemplateDto): Promise