stacker.news/api/typeDefs/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

149 lines
2.3 KiB
JavaScript

import { gql } from 'graphql-tag'
export default gql`
extend type Query {
notifications(cursor: String, inc: String): Notifications
}
extend type Mutation {
savePushSubscription(endpoint: String!, p256dh: String!, auth: String!, oldEndpoint: String): PushSubscription
deletePushSubscription(endpoint: String!): PushSubscription
}
type Votification {
id: ID!
earnedSats: Int!
item: Item!
sortTime: Date!
}
type ForwardedVotification {
id: ID!
earnedSats: Int!
item: Item!
sortTime: Date!
}
type FollowActivity {
id: ID!
item: Item!
sortTime: Date!
}
type Reply {
id: ID!
item: Item!
sortTime: Date!
}
type Mention {
id: ID!
mention: Boolean!
item: Item!
sortTime: Date!
}
type Invitification {
id: ID!
invite: Invite!
sortTime: Date!
}
type JobChanged {
id: ID!
item: Item!
sortTime: Date!
}
type EarnSources {
id: ID!
posts: Int!
comments: Int!
tipPosts: Int!
tipComments: Int!
}
type Streak {
id: ID!
sortTime: Date!
days: Int
}
type Earn {
id: ID!
earnedSats: Int!
minSortTime: Date!
sortTime: Date!
sources: EarnSources
}
type Revenue {
id: ID!
earnedSats: Int!
sortTime: Date!
subName: String!
}
type InvoicePaid {
id: ID!
earnedSats: Int!
invoice: Invoice!
sortTime: Date!
}
type WithdrawlPaid {
id: ID!
earnedSats: Int!
sortTime: Date!
withdrawl: Withdrawl!
}
type Referral {
id: ID!
sortTime: Date!
}
type SubStatus {
id: ID!
sub: Sub!
sortTime: Date!
}
type TerritoryPost {
id: ID!
item: Item!
sortTime: Date!
}
type TerritoryTransfer {
id: ID!
sub: Sub!
sortTime: Date!
}
type Reminder {
id: ID!
item: Item!
sortTime: Date!
}
union Notification = Reply | Votification | Mention
| Invitification | Earn | JobChanged | InvoicePaid | WithdrawlPaid | Referral
| Streak | FollowActivity | ForwardedVotification | Revenue | SubStatus
| TerritoryPost | TerritoryTransfer | Reminder
type Notifications {
lastChecked: Date
cursor: String
notifications: [Notification!]!
}
type PushSubscription {
id: ID!
userId: ID!
endpoint: String!
p256dh: String!
auth: String!
}
`