155 lines
3.5 KiB
Plaintext
155 lines
3.5 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
output = "../generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgres"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum FeedSourceType {
|
|
RSS
|
|
JSON
|
|
}
|
|
|
|
enum FeedSourceHTTPMethod {
|
|
GET
|
|
POST
|
|
}
|
|
|
|
model FeedSourceHTTPHeader {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
value String
|
|
feed_source FeedSource @relation(fields: feed_source_id, references: [id], onDelete: Cascade)
|
|
feed_source_id Int
|
|
}
|
|
|
|
model FeedSourceCookies {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
value String
|
|
feed_source FeedSource @relation(fields: feed_source_id, references: [id], onDelete: Cascade)
|
|
feed_source_id Int
|
|
}
|
|
|
|
// start new
|
|
// todo: user modal to input url, then auto fetch details needed for this model
|
|
// user can then submit or not.
|
|
model FeedSource {
|
|
id Int @id @default(autoincrement())
|
|
url String
|
|
http_username String?
|
|
http_password String? // todo: encrypt this
|
|
http_headers FeedSourceHTTPHeader[]
|
|
http_method FeedSourceHTTPMethod @default(GET)
|
|
http_post_payload String?
|
|
redirect_limit Int @default(0)
|
|
timeout_seconds Int?
|
|
cookies FeedSourceCookies[]
|
|
|
|
feed Feed?
|
|
}
|
|
|
|
model Feed {
|
|
id Int @id @default(autoincrement())
|
|
source FeedSource @relation(fields: [source_id], references: [id], onDelete: Cascade)
|
|
source_id Int @unique
|
|
guild_id String
|
|
|
|
name String
|
|
description String
|
|
website_url String?
|
|
active Boolean
|
|
|
|
channels Channel[]
|
|
filters Filter[]
|
|
message_style MessageStyle? @relation(fields:message_style_id, references: [id], onDelete: SetNull)
|
|
message_style_id Int?
|
|
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt @default(now())
|
|
|
|
@@index([guild_id, created_at(sort: Desc)])
|
|
}
|
|
|
|
model Channel {
|
|
id Int @id @default(autoincrement())
|
|
channel_id String
|
|
Feed Feed @relation(fields: [feedId], references: [id], onDelete: Cascade)
|
|
feedId Int
|
|
}
|
|
|
|
model Filter {
|
|
id Int @id @default(autoincrement())
|
|
guild_id String
|
|
name String
|
|
value String
|
|
matching_algorithm MatchingAlgorithms
|
|
is_insensitive Boolean
|
|
is_whitelist Boolean
|
|
published_threshold DateTime?
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt
|
|
feeds Feed[]
|
|
|
|
@@unique([guild_id, name])
|
|
@@index([guild_id, created_at(sort: Desc)])
|
|
}
|
|
|
|
enum MatchingAlgorithms {
|
|
ANY
|
|
ALL
|
|
EXACT
|
|
REGEX
|
|
FUZZY
|
|
}
|
|
|
|
model MessageStyle {
|
|
id Int @id @default(autoincrement())
|
|
guild_id String
|
|
name String
|
|
colour String @db.VarChar(7) // hex colour including hashtag, example: #5865F2
|
|
show_author Boolean
|
|
show_image Boolean
|
|
show_thumbnail Boolean
|
|
show_footer Boolean
|
|
show_timestamp Boolean
|
|
title_mutator TextMutator?
|
|
description_mutator TextMutator?
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt
|
|
Feed Feed[]
|
|
|
|
@@unique([guild_id, name])
|
|
@@index([guild_id, created_at(sort: Desc)])
|
|
}
|
|
|
|
// Entertainment mutators for message styles
|
|
enum TextMutator {
|
|
UWUIFY
|
|
UWUIFY_SFW
|
|
GOTHIC_SCRIPT
|
|
EMOJI_SUBSTITUTE
|
|
ZALGO
|
|
MORSE_CODE
|
|
BINARY
|
|
HEXADECIMAL
|
|
REMOVE_VOWELS
|
|
DOUBLE_CHARACTERS
|
|
SMALL_CASE
|
|
LEET_SPEAK
|
|
PIG_LATIN
|
|
UPSIDE_DOWN
|
|
ALL_REVERSED
|
|
REVERSED_WORDS
|
|
SHUFFLE_WORDS
|
|
RANDOM_CASE
|
|
GIBBERISH
|
|
SHAKESPEAREAN
|
|
}
|