Files
api/web/components/Notifications/graphql/notification.query.ts
Pujit Mehrotra a09f7c935d refactor(api): delete only archived notifications in deleteAll (#983)
* refactor(api): delete only archived notifications in deleteAll

* refactor: rename deleteAllNotifications mutation to deleteArchivedNotifications

* fix: update mutation name for deleting archived notifications

* chore(web): update codegen dependencies to fix codegen issues

* chore(web): update vue-tsc to fix build typechecking
2024-12-13 14:50:33 -05:00

102 lines
1.8 KiB
TypeScript

import { graphql } from "~/composables/gql/gql";
export const NOTIFICATION_FRAGMENT = graphql(/* GraphQL */ `
fragment NotificationFragment on Notification {
id
title
subject
description
importance
link
type
timestamp
formattedTimestamp
}
`);
export const NOTIFICATION_COUNT_FRAGMENT = graphql(/* GraphQL */ `
fragment NotificationCountFragment on NotificationCounts {
total
info
warning
alert
}
`);
export const getNotifications = graphql(/* GraphQL */ `
query Notifications($filter: NotificationFilter!) {
notifications {
id
list(filter: $filter) {
...NotificationFragment
}
}
}
`);
export const archiveNotification = graphql(/* GraphQL */ `
mutation ArchiveNotification($id: String!) {
archiveNotification(id: $id) {
...NotificationFragment
}
}
`);
export const archiveAllNotifications = graphql(/* GraphQL */ `
mutation ArchiveAllNotifications {
archiveAll {
unread {
total
}
archive {
info
warning
alert
total
}
}
}
`);
export const deleteNotification = graphql(/* GraphQL */ `
mutation DeleteNotification($id: String!, $type: NotificationType!) {
deleteNotification(id: $id, type: $type) {
archive {
total
}
}
}
`);
export const deleteArchivedNotifications = graphql(/* GraphQL */ `
mutation DeleteAllNotifications {
deleteArchivedNotifications {
archive {
total
}
unread {
total
}
}
}
`);
export const notificationsOverview = graphql(/* GraphQL */ `
query Overview {
notifications {
id
overview {
unread {
info
warning
alert
total
}
archive {
total
}
}
}
}
`);