mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
chore: add webhook-call model
This commit is contained in:
@ -89,11 +89,13 @@ export default function WebhookPage({ params }: WebhookPageOptions) {
|
||||
title="Edit webhook"
|
||||
subtitle="On this page, you can edit the webhook and its settings."
|
||||
/>
|
||||
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 flex items-center justify-center bg-white/50">
|
||||
<Loader className="h-8 w-8 animate-spin text-gray-500" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
<fieldset
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "WebhookCallStatus" AS ENUM ('SUCCESS', 'FAILED');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "WebhookCall" (
|
||||
"id" TEXT NOT NULL,
|
||||
"status" "WebhookCallStatus" NOT NULL,
|
||||
"url" TEXT NOT NULL,
|
||||
"requestBody" JSONB NOT NULL,
|
||||
"responseCode" INTEGER NOT NULL,
|
||||
"responseHeaders" JSONB,
|
||||
"responseBody" JSONB,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"webhookId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "WebhookCall_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "WebhookCall" ADD CONSTRAINT "WebhookCall_webhookId_fkey" FOREIGN KEY ("webhookId") REFERENCES "Webhook"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@ -115,6 +115,25 @@ model Webhook {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
userId Int
|
||||
User User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
WebhookCall WebhookCall[]
|
||||
}
|
||||
|
||||
enum WebhookCallStatus {
|
||||
SUCCESS
|
||||
FAILED
|
||||
}
|
||||
|
||||
model WebhookCall {
|
||||
id String @id @default(cuid())
|
||||
status WebhookCallStatus
|
||||
url String
|
||||
requestBody Json
|
||||
responseCode Int
|
||||
responseHeaders Json?
|
||||
responseBody Json?
|
||||
createdAt DateTime @default(now())
|
||||
webhookId String
|
||||
webhook Webhook @relation(fields: [webhookId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
enum ApiTokenAlgorithm {
|
||||
|
||||
Reference in New Issue
Block a user