Created
June 11, 2025 18:59
-
-
Save UltiRequiem/77799613eddb335fae3d5b7bddd8f132 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model User { | |
id String @id @default(cuid()) | |
email String @unique | |
created_at DateTime @default(now()) | |
updated_at DateTime @updatedAt | |
api_keys ApiKey[] | |
quota_account QuotaAccount? | |
analysis_jobs AnalysisJob[] | |
@@map("users") | |
} | |
model ApiKey { | |
id String @id @default(cuid()) | |
key_value String @unique | |
name String? | |
user_id String | |
is_active Boolean @default(true) | |
created_at DateTime @default(now()) | |
updated_at DateTime @updatedAt | |
user User @relation(fields: [user_id], references: [id], onDelete: Cascade) | |
@@index([user_id]) | |
@@index([key_value]) | |
@@map("api_keys") | |
} | |
model QuotaAccount { | |
id String @id @default(cuid()) | |
user_id String @unique | |
current_balance_cents Int @default(0) | |
reserved_amount_cents Int @default(0) | |
total_deposited_cents Int @default(0) | |
total_consumed_cents Int @default(0) | |
created_at DateTime @default(now()) | |
updated_at DateTime @updatedAt | |
user User @relation(fields: [user_id], references: [id], onDelete: Cascade) | |
usage_transactions UsageTransaction[] | |
@@map("quota_accounts") | |
} | |
model AnalysisJob { | |
id String @id @default(cuid()) | |
user_id String | |
status String @default("PENDING") | |
file_url String | |
file_name String? | |
file_size_mb Float? | |
estimated_duration_minutes Float? | |
actual_duration_minutes Float? | |
s3_key String? | |
webhook_url String? | |
webhook_data String? | |
participants String? | |
created_at DateTime @default(now()) | |
completed_at DateTime? | |
user User @relation(fields: [user_id], references: [id], onDelete: Cascade) | |
entities Entity[] | |
@@index([user_id]) | |
@@index([status]) | |
@@index([created_at]) | |
@@map("analysis_jobs") | |
} | |
model Entity { | |
id String @id @default(cuid()) | |
analysis_job_id String | |
hti_entity_id String? | |
name String? | |
entity_type String | |
confidence_score Float? | |
metadata String? | |
created_at DateTime @default(now()) | |
analysis_job AnalysisJob @relation(fields: [analysis_job_id], references: [id], onDelete: Cascade) | |
documents Document[] | |
@@index([analysis_job_id]) | |
@@index([hti_entity_id]) | |
@@map("entities") | |
} | |
model Document { | |
id String @id @default(cuid()) | |
entity_id String | |
document_type String | |
s3_key String | |
file_size_mb Float? | |
status String @default("GENERATING") | |
expires_at DateTime? | |
created_at DateTime @default(now()) | |
entity Entity @relation(fields: [entity_id], references: [id], onDelete: Cascade) | |
@@index([entity_id]) | |
@@index([status]) | |
@@map("documents") | |
} | |
model UsageTransaction { | |
id String @id @default(cuid()) | |
quota_account_id String | |
transaction_type String | |
service_type String | |
amount_cents Int | |
quantity Float | |
unit_price_cents Int | |
reference_id String? | |
description String? | |
created_at DateTime @default(now()) | |
quota_account QuotaAccount @relation(fields: [quota_account_id], references: [id], onDelete: Cascade) | |
@@index([quota_account_id]) | |
@@index([transaction_type]) | |
@@index([created_at]) | |
@@map("usage_transactions") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment