initial commit

This commit is contained in:
2026-01-28 21:18:51 -05:00
commit e284a6c409
24 changed files with 948 additions and 0 deletions

81
api/prisma/schema.prisma Normal file
View File

@@ -0,0 +1,81 @@
generator client {
provider = "prisma-client-js"
output = "../node_modules/.prisma/client/"
}
datasource db {
provider = "postgresql"
}
model User {
id String @id
username String @unique
posts Post[]
comments Comment[]
notifications Notification[]
sessions Session[]
@@map("users")
}
model Post {
id Int @id @default(autoincrement())
created DateTime @default(now())
description String?
images Image[]
comments Comment[]
author User? @relation(fields: [author_id], references: [id], onDelete: Cascade)
author_id String?
@@map("posts")
}
model Image {
id Int @id @default(autoincrement())
filename String
post Post @relation(fields: [post_id], references: [id], onDelete: Cascade)
post_id Int
@@map("images")
}
model Comment {
id Int @id @default(autoincrement())
created DateTime @default(now())
text String
post Post @relation(fields: [post_id], references: [id], onDelete: Cascade)
post_id Int
author User @relation(fields: [author_id], references: [id], onDelete: Cascade)
author_id String
@@map("comments")
}
model Notification {
id Int @id @default(autoincrement())
text String
href String?
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
user_id String
@@map("notifications")
}
model Session {
token String @id
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
user_id String
created DateTime @default(now())
@@map("sessions")
}