feat(core): add notification list (#10480)

This commit is contained in:
EYHN
2025-03-11 06:23:33 +00:00
parent 06889295e0
commit ea07aa8607
30 changed files with 906 additions and 59 deletions

View File

@@ -932,6 +932,36 @@ export const leaveWorkspaceMutation = {
}`,
};
export const listNotificationsQuery = {
id: 'listNotificationsQuery' as const,
op: 'listNotifications',
query: `query listNotifications($pagination: PaginationInput!) {
currentUser {
notifications(pagination: $pagination) {
totalCount
edges {
cursor
node {
id
type
level
read
createdAt
updatedAt
body
}
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}
}`,
};
export const listUsersQuery = {
id: 'listUsersQuery' as const,
op: 'listUsers',
@@ -948,6 +978,16 @@ export const listUsersQuery = {
}`,
};
export const notificationCountQuery = {
id: 'notificationCountQuery' as const,
op: 'notificationCount',
query: `query notificationCount {
currentUser {
notificationCount
}
}`,
};
export const pricesQuery = {
id: 'pricesQuery' as const,
op: 'prices',
@@ -1004,6 +1044,14 @@ export const quotaQuery = {
],
};
export const readNotificationMutation = {
id: 'readNotificationMutation' as const,
op: 'readNotification',
query: `mutation readNotification($id: String!) {
readNotification(id: $id)
}`,
};
export const recoverDocMutation = {
id: 'recoverDocMutation' as const,
op: 'recoverDoc',

View File

@@ -0,0 +1,25 @@
query listNotifications($pagination: PaginationInput!) {
currentUser {
notifications(pagination: $pagination) {
totalCount
edges {
cursor
node {
id
type
level
read
createdAt
updatedAt
body
}
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}
}

View File

@@ -0,0 +1,5 @@
query notificationCount {
currentUser {
notificationCount
}
}

View File

@@ -0,0 +1,3 @@
mutation readNotification($id: String!) {
readNotification(id: $id)
}

View File

@@ -3103,6 +3103,42 @@ export type LeaveWorkspaceMutation = {
leaveWorkspace: boolean;
};
export type ListNotificationsQueryVariables = Exact<{
pagination: PaginationInput;
}>;
export type ListNotificationsQuery = {
__typename?: 'Query';
currentUser: {
__typename?: 'UserType';
notifications: {
__typename?: 'PaginatedNotificationObjectType';
totalCount: number;
edges: Array<{
__typename?: 'NotificationObjectTypeEdge';
cursor: string;
node: {
__typename?: 'NotificationObjectType';
id: string;
type: NotificationType;
level: NotificationLevel;
read: boolean;
createdAt: string;
updatedAt: string;
body: any;
};
}>;
pageInfo: {
__typename?: 'PageInfo';
startCursor: string | null;
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
};
};
} | null;
};
export type ListUsersQueryVariables = Exact<{
filter: ListUserInput;
}>;
@@ -3121,6 +3157,13 @@ export type ListUsersQuery = {
}>;
};
export type NotificationCountQueryVariables = Exact<{ [key: string]: never }>;
export type NotificationCountQuery = {
__typename?: 'Query';
currentUser: { __typename?: 'UserType'; notificationCount: number } | null;
};
export type PricesQueryVariables = Exact<{ [key: string]: never }>;
export type PricesQuery = {
@@ -3174,6 +3217,15 @@ export type QuotaQuery = {
} | null;
};
export type ReadNotificationMutationVariables = Exact<{
id: Scalars['String']['input'];
}>;
export type ReadNotificationMutation = {
__typename?: 'Mutation';
readNotification: boolean;
};
export type RecoverDocMutationVariables = Exact<{
workspaceId: Scalars['String']['input'];
docId: Scalars['String']['input'];
@@ -3868,11 +3920,21 @@ export type Queries =
variables: InvoicesQueryVariables;
response: InvoicesQuery;
}
| {
name: 'listNotificationsQuery';
variables: ListNotificationsQueryVariables;
response: ListNotificationsQuery;
}
| {
name: 'listUsersQuery';
variables: ListUsersQueryVariables;
response: ListUsersQuery;
}
| {
name: 'notificationCountQuery';
variables: NotificationCountQueryVariables;
response: NotificationCountQuery;
}
| {
name: 'pricesQuery';
variables: PricesQueryVariables;
@@ -4065,6 +4127,11 @@ export type Mutations =
variables: PublishPageMutationVariables;
response: PublishPageMutation;
}
| {
name: 'readNotificationMutation';
variables: ReadNotificationMutationVariables;
response: ReadNotificationMutation;
}
| {
name: 'recoverDocMutation';
variables: RecoverDocMutationVariables;