Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 54 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
"dependencies": {
"@elysiajs/cors": "^1.4.1",
"@prisma/adapter-pg": "^7.3.0",
"@prisma/client": "^7.3.0",
"@prisma/client": "7.3.0",
"better-auth": "^1.4.18",
"dotenv": "^17.3.1",
"elysia": "^1.4.22",
"nodemailer": "^8.0.0",
"pg": "^8.18.0",
"pino": "^10.3.0"
"pino": "^10.3.0",
"razorpay": "^2.9.6"
},
"devDependencies": {
"@biomejs/biome": "^2.3.14",
Expand Down
42 changes: 42 additions & 0 deletions prisma/migrations/20260310174111_testing/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- CreateTable
CREATE TABLE "template" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"ownerId" TEXT,
"isBuiltIn" BOOLEAN NOT NULL DEFAULT false,
"sourceTemplateId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "template_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "template_fields" (
"id" TEXT NOT NULL,
"fieldName" TEXT NOT NULL,
"label" TEXT,
"fieldValueType" TEXT NOT NULL,
"fieldType" TEXT NOT NULL,
"validation" JSONB,
"options" JSONB,
"prevFieldId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"templateId" TEXT NOT NULL,

CONSTRAINT "template_fields_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "template_fields_templateId_idx" ON "template_fields"("templateId");

-- CreateIndex
CREATE INDEX "template_fields_templateId_prevFieldId_idx" ON "template_fields"("templateId", "prevFieldId");

-- AddForeignKey
ALTER TABLE "template" ADD CONSTRAINT "template_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "template_fields" ADD CONSTRAINT "template_fields_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "template"("id") ON DELETE CASCADE ON UPDATE CASCADE;
48 changes: 48 additions & 0 deletions prisma/migrations/20260310184414_payment/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
Warnings:

- A unique constraint covering the columns `[paymentId]` on the table `form_response` will be added. If there are existing duplicate values, this will fail.

*/
-- AlterTable
ALTER TABLE "form_response" ADD COLUMN "paymentId" TEXT;

-- CreateTable
CREATE TABLE "payment" (
"id" TEXT NOT NULL,
"amount" DECIMAL(10,2) NOT NULL,
"currency" TEXT NOT NULL DEFAULT 'usd',
"status" TEXT NOT NULL DEFAULT 'pending',
"stripeSessionId" TEXT,
"stripePaymentId" TEXT,
"formId" TEXT NOT NULL,
"formFieldId" TEXT NOT NULL,
"formResponseId" TEXT,
"respondentId" TEXT,
"metadata" JSONB,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "payment_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "payment_stripeSessionId_key" ON "payment"("stripeSessionId");

-- CreateIndex
CREATE UNIQUE INDEX "payment_stripePaymentId_key" ON "payment"("stripePaymentId");

-- CreateIndex
CREATE UNIQUE INDEX "payment_formResponseId_key" ON "payment"("formResponseId");

-- CreateIndex
CREATE INDEX "payment_formId_idx" ON "payment"("formId");

-- CreateIndex
CREATE INDEX "payment_formFieldId_idx" ON "payment"("formFieldId");

-- CreateIndex
CREATE UNIQUE INDEX "form_response_paymentId_key" ON "form_response"("paymentId");

-- AddForeignKey
ALTER TABLE "form_response" ADD CONSTRAINT "form_response_paymentId_fkey" FOREIGN KEY ("paymentId") REFERENCES "payment"("id") ON DELETE SET NULL ON UPDATE CASCADE;
Loading