feature/IO-3096-GlobalNotifications - Checkpoint - Notification Center
This commit is contained in:
49
client/src/graphql/notifications.queries.js
Normal file
49
client/src/graphql/notifications.queries.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { gql } from "@apollo/client";
|
||||
|
||||
export const GET_NOTIFICATIONS = gql`
|
||||
query GetNotifications($limit: Int!, $offset: Int!, $where: notifications_bool_exp) {
|
||||
notifications(limit: $limit, offset: $offset, order_by: { created_at: desc }, where: $where) {
|
||||
id
|
||||
jobid
|
||||
associationid
|
||||
scenario_text
|
||||
fcm_text
|
||||
scenario_meta
|
||||
created_at
|
||||
read
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_UNREAD_COUNT = gql`
|
||||
query GetUnreadCount {
|
||||
notifications_aggregate(where: { read: { _is_null: true } }) {
|
||||
aggregate {
|
||||
count
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const MARK_ALL_NOTIFICATIONS_READ = gql`
|
||||
mutation MarkAllNotificationsRead {
|
||||
update_notifications(where: { read: { _is_null: true } }, _set: { read: "now()" }) {
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SUBSCRIBE_TO_NOTIFICATIONS = gql`
|
||||
subscription SubscribeToNotifications {
|
||||
notifications(order_by: { created_at: desc }, limit: 1) {
|
||||
id
|
||||
jobid
|
||||
associationid
|
||||
scenario_text
|
||||
fcm_text
|
||||
scenario_meta
|
||||
created_at
|
||||
read
|
||||
}
|
||||
}
|
||||
`;
|
||||
Reference in New Issue
Block a user