0d4a225442
* First pass of user subscriptions * add new db model to track subscriptions * update user typedef and api resolver for subscription state * add subscribe action to user profile page * add mutation to subscribe to a user * Update notifications queries, hasNewNotes queries for FollowActivity note type * Only show items that have been created since subscribing to the user * Send push notifications to user subscribers for posts and comments * Rename item dropdown to action dropdown and re-use for item info and user actions * Don't allow self-follows * Add index on followee for faster lookups * Don't show subscribe action if not logged in * small style enhance --------- Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com> Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
102 lines
1.6 KiB
JavaScript
102 lines
1.6 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 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!
|
|
sortTime: Date!
|
|
sources: EarnSources
|
|
}
|
|
|
|
type InvoicePaid {
|
|
id: ID!
|
|
earnedSats: Int!
|
|
invoice: Invoice!
|
|
sortTime: Date!
|
|
}
|
|
|
|
type Referral {
|
|
id: ID!
|
|
sortTime: Date!
|
|
}
|
|
|
|
union Notification = Reply | Votification | Mention
|
|
| Invitification | Earn | JobChanged | InvoicePaid | Referral
|
|
| Streak | FollowActivity
|
|
|
|
type Notifications {
|
|
lastChecked: Date
|
|
cursor: String
|
|
notifications: [Notification!]!
|
|
}
|
|
|
|
type PushSubscription {
|
|
id: ID!
|
|
userId: ID!
|
|
endpoint: String!
|
|
p256dh: String!
|
|
auth: String!
|
|
}
|
|
`
|