mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
94 lines
2.4 KiB
Plaintext
94 lines
2.4 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
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
redirectPage RedirectPage[]
|
|
customPage CustomPage[]
|
|
stat Stat[]
|
|
pinnedPage PinnedPage?
|
|
|
|
@@index([shortcode])
|
|
}
|
|
|
|
// The redirect page for the url shortener
|
|
model RedirectPage {
|
|
uuid String @id @default(uuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt 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
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
customPage 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
|
|
|
|
customPage CustomPage @relation(fields: [customPageUuid], references: [uuid])
|
|
redirectPage RedirectPage @relation(fields: [redirectPageUuid], references: [uuid])
|
|
customPageUuid String
|
|
redirectPageUuid String
|
|
}
|
|
|
|
// Statts to track the links being accessed
|
|
model Stat {
|
|
uuid String @id @default(uuid())
|
|
accessedAt DateTime @default(now())
|
|
hash String? @db.VarChar(64)
|
|
userAgent String? @db.Text
|
|
|
|
page Page @relation(fields: [pageUuid], references: [uuid])
|
|
pageUuid String
|
|
}
|
|
|
|
model PinnedPage {
|
|
id Int @id @default(1)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
page Page @relation(fields: [pageUuid], references: [uuid])
|
|
pageUuid String @unique
|
|
}
|