stacker.news/prisma/schema.prisma

595 lines
17 KiB
Plaintext
Raw Normal View History

2021-03-25 19:29:24 +00:00
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
2023-06-20 01:26:34 +00:00
model Snl {
id Int @id @default(autoincrement())
live Boolean @default(false)
}
2021-03-25 19:29:24 +00:00
model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
name String? @unique @db.Citext
email String? @unique
emailVerified DateTime? @map(name: "email_verified")
image String?
items Item[] @relation("UserItems")
fwdItems Item[] @relation("FwdItem")
mentions Mention[]
messages Message[]
actions ItemAct[]
invoices Invoice[]
withdrawls Withdrawl[]
invites Invite[] @relation(name: "Invites")
invite Invite? @relation(fields: [inviteId], references: [id])
inviteId String?
bio Item? @relation(fields: [bioId], references: [id])
bioId Int?
2022-11-15 20:51:55 +00:00
msats BigInt @default(0)
stackedMsats BigInt @default(0)
2022-09-27 21:19:15 +00:00
freeComments Int @default(5)
freePosts Int @default(2)
checkedNotesAt DateTime?
fiatCurrency String @default("USD")
pubkey String? @unique
2023-01-18 18:49:20 +00:00
slashtagId String? @unique
trust Float @default(0)
2022-06-27 20:49:52 +00:00
upvoteTrust Float @default(0)
lastSeenAt DateTime?
lastCheckedJobs DateTime?
2022-05-16 20:51:22 +00:00
photoId Int?
photo Upload? @relation(fields: [photoId], references: [id])
2023-05-01 20:58:30 +00:00
subs String[]
2021-03-25 19:29:24 +00:00
// streak
streak Int?
2023-01-07 00:53:09 +00:00
// walkthrough
2021-12-09 20:40:40 +00:00
upvotePopover Boolean @default(false)
tipPopover Boolean @default(false)
2023-01-07 00:53:09 +00:00
// nostr
nostrPubkey String?
nostrRelays UserNostrRelay[]
2022-12-19 22:27:52 +00:00
// referrals
referrer User? @relation("referrals", fields: [referrerId], references: [id])
referrerId Int?
referrees User[] @relation("referrals")
2022-12-09 19:25:38 +00:00
// tip settings
2023-05-06 23:29:20 +00:00
tipDefault Int @default(100)
2022-12-09 19:25:38 +00:00
turboTipping Boolean @default(false)
2022-04-21 22:50:02 +00:00
// notification settings
noteItemSats Boolean @default(true)
noteEarning Boolean @default(true)
noteAllDescendants Boolean @default(true)
noteMentions Boolean @default(true)
noteDeposits Boolean @default(true)
noteInvites Boolean @default(true)
noteJobIndicator Boolean @default(true)
2023-02-01 14:44:35 +00:00
noteCowboyHat Boolean @default(true)
2022-04-21 22:50:02 +00:00
2022-08-30 21:50:47 +00:00
// privacy settings
2022-12-01 21:31:04 +00:00
hideInvoiceDesc Boolean @default(false)
hideFromTopUsers Boolean @default(false)
2023-05-01 21:49:47 +00:00
hideCowboyHat Boolean @default(false)
2022-08-30 21:50:47 +00:00
2022-09-21 19:57:36 +00:00
// content settings
wildWestMode Boolean @default(false)
2022-09-27 21:19:15 +00:00
greeterMode Boolean @default(false)
2022-09-21 19:57:36 +00:00
Earn Earn[]
2023-06-20 01:26:34 +00:00
Upload Upload[] @relation(name: "Uploads")
PollVote PollVote[]
Donation Donation[]
ReferralAct ReferralAct[]
Streak Streak[]
Bookmarks Bookmark[]
Subscriptions Subscription[]
ThreadSubscriptions ThreadSubscription[]
Service worker rework, Web Target Share API & Web Push API (#324) * npm uninstall next-pwa next-pwa was last updated in August 2022. There is also an issue which mentions that next-pwa is abandoned (?): https://github.com/shadowwalker/next-pwa/issues/482 But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us. It even lead to a bug since pages were cached without our knowledge. So I will go with a different PWA approach. This different approach should do the following: - make it more transparent what the service worker is doing - gives us more control to configure the service worker and thus making it easier * Use workbox-webpack-plugin Every other plugin (`next-offline`, `next-workbox-webpack-plugin`, `next-with-workbox`, ...) added unnecessary configuration which felt contrary to how PWAs should be built. (PWAs should progressivly enhance the website in small steps, see https://web.dev/learn/pwa/getting-started/#focus-on-a-feature) These default configurations even lead to worse UX since they made invalid assumptions about stacker.news: We _do not_ want to cache our start url and we _do not_ want to cache anything unless explicitly told to. Almost every page on SN should be fresh for the best UX. To achieve this, by default, the service worker falls back to the network (as if the service worker wasn't there). Therefore, this should be the simplest configuration with a valid precache and cache busting support. In the future, we can try to use prefetching to improve performance of navigation requests. * Add support for Web Share Target API See https://developer.chrome.com/articles/web-share-target/ * Use Web Push API for push notifications I followed this (very good!) guide: https://web.dev/notifications/ * Refactor code related to Web Push * Send push notification to users on events * Merge notifications * Send notification to author of every parent recursively * Remove unused userId param in savePushSubscription As it should be, the user id is retrieved from the authenticated user in the backend. * Resubscribe user if push subscription changed * Update old subscription if oldEndpoint was given * Allow users to unsubscribe * Use LTREE operator instead of recursive query * Always show checkbox for push notifications * Justify checkbox to end * Update title of first push notification * Fix warning from uncontrolled to controlled * Add comment about Notification.requestPermission * Fix timestamp * Catch error on push subscription toggle * Wrap function bodies in try/catch * Use Promise.allSettled * Filter subscriptions by user notification settings * Fix user notification filter * Use skipWaiting --------- Co-authored-by: ekzyis <ek@stacker.news>
2023-07-04 19:36:07 +00:00
PushSubscriptions PushSubscription[]
2022-08-06 22:03:57 +00:00
2021-10-06 14:43:32 +00:00
@@index([createdAt])
2022-03-10 19:26:35 +00:00
@@index([inviteId])
2021-03-25 19:29:24 +00:00
@@map(name: "users")
}
2023-02-01 14:44:35 +00:00
model Streak {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
startedAt DateTime @db.Date
endedAt DateTime? @db.Date
userId Int
user User @relation(fields: [userId], references: [id])
@@unique([startedAt, userId])
@@index([userId])
}
2023-01-07 00:53:09 +00:00
model NostrRelay {
addr String @id
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
users UserNostrRelay[]
}
model UserNostrRelay {
User User @relation(fields: [userId], references: [id])
userId Int
NostrRelay NostrRelay @relation(fields: [nostrRelayAddr], references: [addr])
nostrRelayAddr String
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
@@id([userId, nostrRelayAddr])
}
2022-12-08 00:04:02 +00:00
model Donation {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
sats Int
userId Int
user User @relation(fields: [userId], references: [id])
}
2022-05-12 18:44:21 +00:00
model Upload {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
type String
size Int
width Int?
height Int?
item Item? @relation(fields: [itemId], references: [id])
2022-07-21 22:55:05 +00:00
itemId Int? @unique
2022-05-16 20:51:22 +00:00
user User @relation(name: "Uploads", fields: [userId], references: [id])
2022-05-12 18:44:21 +00:00
userId Int
2022-05-16 20:51:22 +00:00
User User[]
2022-08-06 22:03:57 +00:00
2022-05-12 18:44:21 +00:00
@@index([createdAt])
@@index([itemId])
@@index([userId])
}
enum EarnType {
POST
COMMENT
TIP_COMMENT
TIP_POST
}
2022-03-17 20:13:19 +00:00
model Earn {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
2022-11-15 20:51:55 +00:00
msats BigInt
user User @relation(fields: [userId], references: [id])
2022-03-17 20:13:19 +00:00
userId Int
type EarnType?
typeId Int?
rank Int?
2022-03-17 20:13:19 +00:00
@@index([createdAt])
@@index([userId])
@@index([createdAt, userId])
2022-03-17 20:13:19 +00:00
}
2021-06-27 03:09:39 +00:00
model LnAuth {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
k1 String @unique
pubkey String?
}
2021-10-28 19:59:53 +00:00
model LnWith {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
k1 String @unique
userId Int
withdrawalId Int?
}
2021-10-12 20:40:30 +00:00
model Invite {
id String @id @default(cuid())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
user User @relation(name: "Invites", fields: [userId], references: [id])
userId Int
gift Int?
limit Int?
revoked Boolean @default(false)
invitees User[]
2022-03-10 19:26:35 +00:00
@@index([userId])
@@index([createdAt])
2021-10-12 20:40:30 +00:00
}
2021-03-25 19:29:24 +00:00
model Message {
id Int @id @default(autoincrement())
text String
user User @relation(fields: [userId], references: [id])
userId Int
}
2022-02-25 17:34:09 +00:00
enum Status {
ACTIVE
STOPPED
NOSATS
}
2021-03-25 19:29:24 +00:00
model Item {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
2023-01-12 23:53:09 +00:00
deletedAt DateTime?
title String?
text String?
url String?
user User @relation("UserItems", fields: [userId], references: [id])
userId Int
fwdUser User? @relation(name: "FwdItem", fields: [fwdUserId], references: [id])
fwdUserId Int?
parent Item? @relation("ParentChildren", fields: [parentId], references: [id])
parentId Int?
children Item[] @relation("ParentChildren")
2023-01-26 19:09:57 +00:00
root Item? @relation("RootDescendant", fields: [rootId], references: [id])
rootId Int?
descendants Item[] @relation("RootDescendant")
actions ItemAct[]
mentions Mention[]
path Unsupported("LTREE")?
pin Pin? @relation(fields: [pinId], references: [id])
pinId Int?
uploadId Int?
upload Upload?
paidImgLink Boolean @default(false)
2023-01-22 20:17:50 +00:00
// open timestamps
otsHash String?
otsFile Bytes?
2023-01-26 23:28:10 +00:00
// bounties
bounty Int?
bountyPaidTo Int[]
2022-09-27 21:19:15 +00:00
// is free post or bio
freebie Boolean @default(false)
bio Boolean @default(false)
// denormalized self stats
2022-11-15 20:51:55 +00:00
weightedVotes Float @default(0)
weightedDownVotes Float @default(0)
msats BigInt @default(0)
2023-05-06 23:53:10 +00:00
boost Int @default(0)
upvotes Int @default(0)
// denormalized comment stats
2023-05-09 18:52:35 +00:00
ncomments Int @default(0)
commentMsats BigInt @default(0)
lastCommentAt DateTime?
weightedComments Float @default(0)
2021-03-25 19:29:24 +00:00
2022-02-17 17:23:43 +00:00
// if sub is null, this is the main sub
sub Sub? @relation(fields: [subName], references: [name])
subName String? @db.Citext
// fields exclusively for job post types right now
2022-02-26 21:42:38 +00:00
minSalary Int?
maxSalary Int?
maxBid Int?
status Status @default(ACTIVE)
statusUpdatedAt DateTime?
location String?
2022-03-07 21:50:13 +00:00
company String?
2022-02-26 21:42:38 +00:00
latitude Float?
longitude Float?
remote Boolean?
2022-02-17 17:23:43 +00:00
2022-07-30 13:25:46 +00:00
// fields for polls
pollCost Int?
2023-06-20 01:26:34 +00:00
User User[]
PollOption PollOption[]
PollVote PollVote[]
Bookmark Bookmark[]
ThreadSubscription ThreadSubscription[]
2022-08-06 22:03:57 +00:00
2022-11-06 20:39:23 +00:00
@@index([weightedVotes])
@@index([weightedDownVotes])
@@index([bio])
@@index([freebie])
2021-10-06 14:43:32 +00:00
@@index([createdAt])
2021-03-25 19:29:24 +00:00
@@index([userId])
2023-01-26 19:09:57 +00:00
@@index([rootId])
2021-03-25 19:29:24 +00:00
@@index([parentId])
2022-03-10 19:17:30 +00:00
@@index([status])
@@index([maxBid])
@@index([statusUpdatedAt])
@@index([subName])
@@index([pinId])
2022-04-12 21:09:12 +00:00
@@index([path])
2021-03-25 19:29:24 +00:00
}
2022-07-30 13:25:46 +00:00
model PollOption {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
itemId Int
item Item @relation(fields: [itemId], references: [id])
option String
PollVote PollVote[]
2022-08-06 22:03:57 +00:00
2022-07-30 13:25:46 +00:00
@@index([itemId])
}
model PollVote {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
userId Int
user User @relation(fields: [userId], references: [id])
itemId Int
item Item @relation(fields: [itemId], references: [id])
pollOptionId Int
pollOption PollOption @relation(fields: [pollOptionId], references: [id])
@@unique([itemId, userId])
@@index([userId])
@@index([pollOptionId])
}
2022-02-17 17:23:43 +00:00
enum PostType {
LINK
DISCUSSION
JOB
2022-07-30 13:25:46 +00:00
POLL
2023-05-01 20:58:30 +00:00
BOUNTY
2022-02-17 17:23:43 +00:00
}
enum RankingType {
WOT
RECENT
AUCTION
}
model Sub {
name String @id @db.Citext
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
postTypes PostType[]
rankingType RankingType
baseCost Int @default(1)
desc String?
2023-05-01 20:58:30 +00:00
Item Item[]
Subscription Subscription[]
}
model Subscription {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
subName String @db.Citext
sub Sub @relation(fields: [subName], references: [name])
user User @relation(fields: [userId], references: [id])
userId Int
2022-02-17 17:23:43 +00:00
}
2022-01-07 16:32:31 +00:00
// the active pin is the latest one when it's a recurring cron
model Pin {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
cron String?
timezone String?
position Int
Item Item[]
}
2022-12-19 22:27:52 +00:00
model ReferralAct {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
referrerId Int
referrer User @relation(fields: [referrerId], references: [id])
itemActId Int
itemAct ItemAct @relation(fields: [itemActId], references: [id])
msats BigInt
}
2021-09-08 21:51:23 +00:00
enum ItemActType {
2021-09-08 21:15:06 +00:00
VOTE
BOOST
TIP
2022-03-16 16:35:51 +00:00
STREAM
2022-07-30 13:25:46 +00:00
POLL
2022-09-21 19:57:36 +00:00
DONT_LIKE_THIS
2022-11-23 18:12:09 +00:00
FEE
2021-09-08 21:15:06 +00:00
}
2021-09-08 21:51:23 +00:00
model ItemAct {
2022-12-19 22:27:52 +00:00
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
msats BigInt
act ItemActType
item Item @relation(fields: [itemId], references: [id])
itemId Int
user User @relation(fields: [userId], references: [id])
userId Int
ReferralAct ReferralAct[]
2021-04-22 22:14:32 +00:00
@@index([itemId])
@@index([userId])
2021-09-08 21:51:23 +00:00
@@index([act])
2021-10-06 14:43:32 +00:00
@@index([createdAt])
// for getting a user's spending on an item, eg meSats
@@index([itemId, userId, act])
// for getting a user's spending over time, eg amount spent in a week
@@index([userId, createdAt, act])
// for checking if an item has been tipped recently, where the item number is small
@@index([itemId, createdAt, act])
// for checking if an item has been tipped recently, where the recent acts are small
@@index([createdAt, itemId, act])
2021-04-22 22:14:32 +00:00
}
2021-08-18 22:20:33 +00:00
model Mention {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
item Item @relation(fields: [itemId], references: [id])
itemId Int
user User @relation(fields: [userId], references: [id])
userId Int
@@unique([itemId, userId])
2021-10-06 14:43:32 +00:00
@@index([createdAt])
2021-08-18 22:20:33 +00:00
@@index([itemId])
@@index([userId])
}
2021-05-11 15:52:50 +00:00
model Invoice {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
user User @relation(fields: [userId], references: [id])
userId Int
hash String @unique
bolt11 String
2023-02-15 17:20:26 +00:00
desc String?
2021-05-11 15:52:50 +00:00
expiresAt DateTime
confirmedAt DateTime?
2022-11-15 20:51:55 +00:00
msatsRequested BigInt
msatsReceived BigInt?
2021-05-11 15:52:50 +00:00
cancelled Boolean @default(false)
2021-10-06 14:43:32 +00:00
@@index([createdAt])
2021-05-11 15:52:50 +00:00
@@index([userId])
}
2021-05-12 23:04:19 +00:00
enum WithdrawlStatus {
2021-05-13 21:19:51 +00:00
CONFIRMED
2021-05-12 23:04:19 +00:00
INSUFFICIENT_BALANCE
INVALID_PAYMENT
PATHFINDING_TIMEOUT
ROUTE_NOT_FOUND
2021-05-13 21:19:51 +00:00
UNKNOWN_FAILURE
2021-05-12 23:04:19 +00:00
}
model Withdrawl {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
user User @relation(fields: [userId], references: [id])
userId Int
hash String
2021-05-12 23:04:19 +00:00
bolt11 String
2022-11-15 20:51:55 +00:00
msatsPaying BigInt
msatsPaid BigInt?
msatsFeePaying BigInt
msatsFeePaid BigInt?
2021-05-12 23:04:19 +00:00
status WithdrawlStatus?
2022-08-06 22:03:57 +00:00
2021-10-06 14:43:32 +00:00
@@index([createdAt])
2021-05-12 23:04:19 +00:00
@@index([userId])
}
2021-03-25 19:29:24 +00:00
model Account {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
compoundId String @unique @map(name: "compound_id")
userId Int @map(name: "user_id")
providerType String @map(name: "provider_type")
providerId String @map(name: "provider_id")
providerAccountId String @map(name: "provider_account_id")
refreshToken String? @map(name: "refresh_token")
accessToken String? @map(name: "access_token")
accessTokenExpires DateTime? @map(name: "access_token_expires")
@@index([providerAccountId])
@@index([providerId])
@@index([userId])
@@map(name: "accounts")
}
model Session {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
userId Int @map(name: "user_id")
expires DateTime
sessionToken String @unique @map(name: "session_token")
accessToken String @unique @map(name: "access_token")
@@map(name: "sessions")
}
model VerificationRequest {
id Int @id @default(autoincrement())
createdAt DateTime @default(now()) @map(name: "created_at")
updatedAt DateTime @updatedAt @map(name: "updated_at")
identifier String
token String @unique
expires DateTime
@@map(name: "verification_requests")
}
model Bookmark {
user User @relation(fields: [userId], references: [id])
userId Int
item Item @relation(fields: [itemId], references: [id])
itemId Int
createdAt DateTime @default(now()) @map(name: "created_at")
2023-02-24 16:35:05 +00:00
@@id([userId, itemId])
@@index([createdAt])
}
model ThreadSubscription {
user User @relation(fields: [userId], references: [id])
userId Int
item Item @relation(fields: [itemId], references: [id])
itemId Int
createdAt DateTime @default(now()) @map(name: "created_at")
@@id([userId, itemId])
@@index([createdAt])
2023-06-20 01:26:34 +00:00
}
Service worker rework, Web Target Share API & Web Push API (#324) * npm uninstall next-pwa next-pwa was last updated in August 2022. There is also an issue which mentions that next-pwa is abandoned (?): https://github.com/shadowwalker/next-pwa/issues/482 But the main reason for me uninstalling it is that it adds a lot of preconfigured stuff which is not necessary for us. It even lead to a bug since pages were cached without our knowledge. So I will go with a different PWA approach. This different approach should do the following: - make it more transparent what the service worker is doing - gives us more control to configure the service worker and thus making it easier * Use workbox-webpack-plugin Every other plugin (`next-offline`, `next-workbox-webpack-plugin`, `next-with-workbox`, ...) added unnecessary configuration which felt contrary to how PWAs should be built. (PWAs should progressivly enhance the website in small steps, see https://web.dev/learn/pwa/getting-started/#focus-on-a-feature) These default configurations even lead to worse UX since they made invalid assumptions about stacker.news: We _do not_ want to cache our start url and we _do not_ want to cache anything unless explicitly told to. Almost every page on SN should be fresh for the best UX. To achieve this, by default, the service worker falls back to the network (as if the service worker wasn't there). Therefore, this should be the simplest configuration with a valid precache and cache busting support. In the future, we can try to use prefetching to improve performance of navigation requests. * Add support for Web Share Target API See https://developer.chrome.com/articles/web-share-target/ * Use Web Push API for push notifications I followed this (very good!) guide: https://web.dev/notifications/ * Refactor code related to Web Push * Send push notification to users on events * Merge notifications * Send notification to author of every parent recursively * Remove unused userId param in savePushSubscription As it should be, the user id is retrieved from the authenticated user in the backend. * Resubscribe user if push subscription changed * Update old subscription if oldEndpoint was given * Allow users to unsubscribe * Use LTREE operator instead of recursive query * Always show checkbox for push notifications * Justify checkbox to end * Update title of first push notification * Fix warning from uncontrolled to controlled * Add comment about Notification.requestPermission * Fix timestamp * Catch error on push subscription toggle * Wrap function bodies in try/catch * Use Promise.allSettled * Filter subscriptions by user notification settings * Fix user notification filter * Use skipWaiting --------- Co-authored-by: ekzyis <ek@stacker.news>
2023-07-04 19:36:07 +00:00
model PushSubscription {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int
endpoint String
p256dh String
auth String
createdAt DateTime @default(now()) @map(name: "created_at")
@@index([userId])
}