Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created payments table #40

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- CreateEnum
CREATE TYPE "PaymentStatus" AS ENUM ('PAID', 'PROCESSING', 'UNPAID', 'DENIED');

-- CreateTable
CREATE TABLE "Payment" (
"id" SERIAL NOT NULL,
"stripePaymentId" TEXT NOT NULL,
"creationDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updateDate" TIMESTAMP(3) NOT NULL,
"donation_id" INTEGER NOT NULL,
"amount" INTEGER NOT NULL,
"currency" TEXT NOT NULL,
"status" "PaymentStatus" NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "Payment_stripePaymentId_key" ON "Payment"("stripePaymentId");
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- This is an empty migration.
mat-ng marked this conversation as resolved.
Show resolved Hide resolved
22 changes: 21 additions & 1 deletion backend/typescript/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ model User {
donations Donation[]
}

enum RoleType{
enum RoleType {
Admin
User
}
Expand All @@ -39,6 +39,7 @@ model Donation {
cause_id Int
is_recurring Recurrence
confirmation_email_sent Boolean
transactions Payment[]
mat-ng marked this conversation as resolved.
Show resolved Hide resolved
}

enum Recurrence {
Expand Down Expand Up @@ -75,3 +76,22 @@ model Item {
npo NPO? @relation("NPOItem")
npo_id Int? @unique
}

model Payment {
id Int @id @default(autoincrement())
stripePaymentId String @unique
creationDate DateTime @default(now())
updateDate DateTime @updatedAt
donation Donation @relation(fields: [donation_id], references: [id])
mat-ng marked this conversation as resolved.
Show resolved Hide resolved
donation_id Int
amount Int
mat-ng marked this conversation as resolved.
Show resolved Hide resolved
currency String
status PaymentStatus
}

enum PaymentStatus {
PAID
PROCESSING
UNPAID
DENIED
}
Loading