mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
84 lines
2.2 KiB
Plaintext
84 lines
2.2 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
// The basis for the pages providing a shortcode to access them
|
|
model Page {
|
|
uuid String @id @default(uuid())
|
|
shortcode String @unique
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt
|
|
RedirectPage RedirectPage[]
|
|
CustomPage CustomPage[]
|
|
Stat Stat[]
|
|
|
|
@@index([shortcode])
|
|
}
|
|
|
|
// The redirect page for the url shortener
|
|
model RedirectPage {
|
|
uuid String @id @default(uuid())
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt
|
|
dest String
|
|
|
|
page Page @relation(fields: [pageUuid], references: [uuid])
|
|
pageUuid String
|
|
LinkBlock LinkBlock[]
|
|
}
|
|
|
|
// The custom page to display mutliple blocks of text and links
|
|
model CustomPage {
|
|
uuid String @id @default(uuid())
|
|
title String
|
|
image String?
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt
|
|
|
|
page Page @relation(fields: [pageUuid], references: [uuid])
|
|
pageUuid String
|
|
TextBlock TextBlock[]
|
|
LinkBlock LinkBlock[]
|
|
}
|
|
|
|
// Text block to be displayed on the custom page
|
|
// To provide additional information
|
|
model TextBlock {
|
|
uuid String @id @default(uuid())
|
|
order Int
|
|
text String
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt
|
|
|
|
custom_page CustomPage @relation(fields: [customPageUuid], references: [uuid])
|
|
customPageUuid String
|
|
}
|
|
|
|
// Link block to integrate a RedirectPage into the custom page
|
|
model LinkBlock {
|
|
uuid String @id @default(uuid())
|
|
order Int
|
|
title String
|
|
|
|
custom_page CustomPage @relation(fields: [customPageUuid], references: [uuid])
|
|
redirect_page RedirectPage @relation(fields: [redirectPageUuid], references: [uuid])
|
|
customPageUuid String
|
|
redirectPageUuid String
|
|
}
|
|
|
|
// Statts to track the links being accessed
|
|
model Stat {
|
|
uuid String @id @default(uuid())
|
|
accessed_at DateTime @default(now())
|
|
hash String? @db.VarChar(64)
|
|
user_agent String? @db.Text
|
|
|
|
page Page @relation(fields: [pageUuid], references: [uuid])
|
|
pageUuid String
|
|
}
|