stacker.news/fragments/notifications.js
SatsAllDay 852d2cf304
@remindme bot support (#1159)
* @remindme bot support

support reminders via @remindme bot, just like @delete bot

* minor cleanup

* minor query cleanup

* add db migration

* various fixes and updates:

* hasNewNotes implementation
* actually return notification component in ui
* delete reminder and job on item delete
* other goodies

* refactor to use prisma for deleting existing reminder

* * switch to deleteMany to delete existing Reminders upon edit/delete of post to satisfy prisma

* update wording in form toast for remindme bot usage

* update wording in the push notification sent

* transactional reminder inserts and expirein

* set expirein on @delete too

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-05-19 15:52:02 -05:00

154 lines
2.8 KiB
JavaScript

import { gql } from '@apollo/client'
import { ITEM_FULL_FIELDS } from './items'
import { INVITE_FIELDS } from './invites'
import { SUB_FIELDS } from './subs'
export const HAS_NOTIFICATIONS = gql`{ hasNewNotes }`
export const NOTIFICATIONS = gql`
${ITEM_FULL_FIELDS}
${INVITE_FIELDS}
${SUB_FIELDS}
query Notifications($cursor: String, $inc: String) {
notifications(cursor: $cursor, inc: $inc) {
cursor
lastChecked
notifications {
__typename
... on Mention {
id
sortTime
mention
item {
...ItemFullFields
text
}
}
... on Votification {
id
sortTime
earnedSats
item {
...ItemFullFields
text
}
}
... on Revenue {
id
sortTime
earnedSats
subName
}
... on ForwardedVotification {
id
sortTime
earnedSats
item {
...ItemFullFields
text
}
}
... on Streak {
id
sortTime
days
}
... on Earn {
id
sortTime
minSortTime
earnedSats
sources {
posts
comments
tipPosts
tipComments
}
}
... on Referral {
id
sortTime
}
... on Reply {
id
sortTime
item {
...ItemFullFields
text
}
}
... on FollowActivity {
id
sortTime
item {
...ItemFullFields
text
}
}
... on TerritoryPost {
id
sortTime
item {
...ItemFullFields
text
}
}
... on TerritoryTransfer {
id
sortTime
sub {
...SubFields
}
}
... on Invitification {
id
sortTime
invite {
...InviteFields
}
}
... on JobChanged {
id
sortTime
item {
...ItemFields
}
}
... on SubStatus {
id
sortTime
sub {
...SubFields
}
}
... on InvoicePaid {
id
sortTime
earnedSats
invoice {
id
nostr
comment
lud18Data
}
}
... on WithdrawlPaid {
id
sortTime
earnedSats
withdrawl {
autoWithdraw
}
}
... on Reminder {
id
sortTime
item {
...ItemFullFields
}
}
}
}
} `