feat: implement secure admin authentication system with JWT sessions, middleware protection, and Prisma schema initialization
This commit is contained in:
68
prisma/schema.prisma
Normal file
68
prisma/schema.prisma
Normal file
@@ -0,0 +1,68 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
email String @unique
|
||||
passwordHash String @map("password_hash")
|
||||
name String
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
model Project {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
title String
|
||||
slug String @unique
|
||||
description String @db.Text
|
||||
imageUrl String? @map("image_url")
|
||||
repoUrl String? @map("repo_url")
|
||||
liveUrl String? @map("live_url")
|
||||
category String
|
||||
isPublished Boolean @default(false) @map("is_published")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
skills ProjectSkill[]
|
||||
|
||||
@@map("projects")
|
||||
}
|
||||
|
||||
model Skill {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
name String
|
||||
iconName String? @map("icon_name")
|
||||
category String
|
||||
|
||||
projects ProjectSkill[]
|
||||
|
||||
@@map("skills")
|
||||
}
|
||||
|
||||
// Explicit Join Table based on ERD
|
||||
model ProjectSkill {
|
||||
projectId String @map("project_id") @db.Uuid
|
||||
skillId String @map("skill_id") @db.Uuid
|
||||
|
||||
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
||||
skill Skill @relation(fields: [skillId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@id([projectId, skillId])
|
||||
@@map("project_skills")
|
||||
}
|
||||
|
||||
model Message {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
senderName String @map("sender_name")
|
||||
senderEmail String @map("sender_email")
|
||||
content String @db.Text
|
||||
isRead Boolean @default(false) @map("is_read")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
@@map("messages")
|
||||
}
|
||||
Reference in New Issue
Block a user