2024-04-19 08:43:26 +08:00
|
|
|
import { gql } from '@apollo/client';
|
|
|
|
|
|
|
|
export interface Notification {
|
|
|
|
notificationType: string;
|
|
|
|
icon: string;
|
|
|
|
messageId: string;
|
|
|
|
messageValues: string[];
|
|
|
|
isSingleUserNotification: boolean;
|
|
|
|
createdAt: string; // You might want to use a Date type if you're parsing this string into a Date object
|
|
|
|
notificationId: number;
|
|
|
|
messageDescription: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface NotificationResponse {
|
|
|
|
notification_stream: Notification[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export const getNotificationsStream = gql`
|
2024-06-06 21:35:27 +08:00
|
|
|
subscription getNotificationStream(
|
|
|
|
$initialCursor: timestamptz!,
|
|
|
|
$excludedMessageIds: [String!]!
|
|
|
|
){
|
|
|
|
notification_stream(
|
|
|
|
batch_size: 10,
|
|
|
|
cursor: {initial_value: {createdAt: $initialCursor}},
|
|
|
|
where: {messageId: {_nin: $excludedMessageIds}}
|
|
|
|
) {
|
2024-04-19 08:43:26 +08:00
|
|
|
notificationType
|
|
|
|
icon
|
|
|
|
messageId
|
|
|
|
messageValues
|
|
|
|
isSingleUserNotification
|
|
|
|
createdAt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
getNotificationsStream,
|
|
|
|
};
|