Some checks failed
Build and publish Docker image / docker (push) Failing after 2m33s
229 lines
6.0 KiB
Plaintext
229 lines
6.0 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum Role {
|
|
VISITOR
|
|
MEMBER
|
|
ADMIN
|
|
}
|
|
|
|
enum Language {
|
|
DE
|
|
EN
|
|
}
|
|
|
|
enum TrustLevel {
|
|
UNKNOWN
|
|
LOW
|
|
MEDIUM
|
|
HIGH
|
|
PRIMARY
|
|
}
|
|
|
|
enum EntryStatus {
|
|
DRAFT
|
|
PUBLISHED
|
|
BLOCKED
|
|
ARCHIVED
|
|
}
|
|
|
|
enum ContributionStatus {
|
|
PENDING
|
|
APPROVED
|
|
REJECTED
|
|
NEEDS_ADMIN_REVIEW
|
|
}
|
|
|
|
enum ModerationOutcome {
|
|
APPROVE
|
|
REJECT
|
|
ESCALATE
|
|
}
|
|
|
|
enum ContributionOrigin {
|
|
COMMUNITY
|
|
AI_RESEARCH
|
|
ADMIN
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
passwordHash String?
|
|
role Role @default(MEMBER)
|
|
accounts Account[]
|
|
sessions Session[]
|
|
contributions Contribution[]
|
|
moderationOverrides ModerationDecision[] @relation("ModerationOverride")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String? @db.Text
|
|
access_token String? @db.Text
|
|
expires_at Int?
|
|
token_type String?
|
|
scope String?
|
|
id_token String? @db.Text
|
|
session_state String?
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([provider, providerAccountId])
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
sessionToken String @unique
|
|
userId String
|
|
expires DateTime
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model VerificationToken {
|
|
identifier String
|
|
token String @unique
|
|
expires DateTime
|
|
|
|
@@unique([identifier, token])
|
|
}
|
|
|
|
model Source {
|
|
id String @id @default(cuid())
|
|
title String
|
|
url String
|
|
author String?
|
|
institution String?
|
|
license String?
|
|
language Language
|
|
retrievedAt DateTime @default(now())
|
|
trustLevel TrustLevel @default(UNKNOWN)
|
|
notes String?
|
|
entryLinks KnowledgeEntrySource[]
|
|
contributionLinks ContributionSource[]
|
|
answerLinks AnswerSource[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([url, language])
|
|
@@index([language, trustLevel])
|
|
}
|
|
|
|
model KnowledgeEntry {
|
|
id String @id @default(cuid())
|
|
title String
|
|
slug String
|
|
language Language
|
|
summary String
|
|
content Json
|
|
timelineStart DateTime?
|
|
timelineEnd DateTime?
|
|
tags String[]
|
|
status EntryStatus @default(DRAFT)
|
|
version Int @default(1)
|
|
sources KnowledgeEntrySource[]
|
|
contributions Contribution[]
|
|
answers QuestionAnswer[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@unique([slug, language])
|
|
@@index([status, language])
|
|
}
|
|
|
|
model KnowledgeEntrySource {
|
|
entryId String
|
|
sourceId String
|
|
note String?
|
|
entry KnowledgeEntry @relation(fields: [entryId], references: [id], onDelete: Cascade)
|
|
source Source @relation(fields: [sourceId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([entryId, sourceId])
|
|
}
|
|
|
|
model Contribution {
|
|
id String @id @default(cuid())
|
|
origin ContributionOrigin
|
|
status ContributionStatus @default(PENDING)
|
|
title String
|
|
language Language
|
|
proposedContent Json
|
|
rationale String?
|
|
authorId String?
|
|
entryId String?
|
|
author User? @relation(fields: [authorId], references: [id], onDelete: SetNull)
|
|
entry KnowledgeEntry? @relation(fields: [entryId], references: [id], onDelete: SetNull)
|
|
sources ContributionSource[]
|
|
moderationDecisions ModerationDecision[]
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([status, origin])
|
|
}
|
|
|
|
model ContributionSource {
|
|
contributionId String
|
|
sourceId String
|
|
contribution Contribution @relation(fields: [contributionId], references: [id], onDelete: Cascade)
|
|
source Source @relation(fields: [sourceId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([contributionId, sourceId])
|
|
}
|
|
|
|
model ModerationDecision {
|
|
id String @id @default(cuid())
|
|
contributionId String
|
|
outcome ModerationOutcome
|
|
riskCategories String[]
|
|
confidence Float
|
|
reasoning String
|
|
model String
|
|
promptVersion String
|
|
rawResponse Json?
|
|
overriddenById String?
|
|
overrideReason String?
|
|
overriddenAt DateTime?
|
|
contribution Contribution @relation(fields: [contributionId], references: [id], onDelete: Cascade)
|
|
overriddenBy User? @relation("ModerationOverride", fields: [overriddenById], references: [id], onDelete: SetNull)
|
|
createdAt DateTime @default(now())
|
|
|
|
@@index([outcome, createdAt])
|
|
}
|
|
|
|
model QuestionAnswer {
|
|
id String @id @default(cuid())
|
|
question String
|
|
language Language
|
|
answer String
|
|
model String
|
|
tokenCount Int?
|
|
costCents Int?
|
|
entryId String?
|
|
entry KnowledgeEntry? @relation(fields: [entryId], references: [id], onDelete: SetNull)
|
|
sources AnswerSource[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model AnswerSource {
|
|
answerId String
|
|
sourceId String
|
|
answer QuestionAnswer @relation(fields: [answerId], references: [id], onDelete: Cascade)
|
|
source Source @relation(fields: [sourceId], references: [id], onDelete: Cascade)
|
|
|
|
@@id([answerId, sourceId])
|
|
}
|