feat: implement source type filtering in notifications API and UI, enhancing user experience by allowing users to filter notifications by connector and document types in the status tab

This commit is contained in:
Anish Sarkar 2026-03-06 17:25:07 +05:30
parent fe0b026315
commit d03f938fcd
5 changed files with 264 additions and 81 deletions

View file

@ -204,6 +204,7 @@ export const getNotificationsRequest = z.object({
queryParams: z.object({
search_space_id: z.number().optional(),
type: inboxItemTypeEnum.optional(),
source_type: z.string().optional(),
before_date: z.string().optional(),
search: z.string().optional(),
limit: z.number().min(1).max(100).optional(),
@ -261,6 +262,20 @@ export const getUnreadCountResponse = z.object({
recent_unread: z.number(), // Within SYNC_WINDOW_DAYS (14 days)
});
/**
* Response schema for notification source types (status tab filter)
*/
export const sourceTypeItem = z.object({
key: z.string(),
type: z.string(),
category: z.enum(["connector", "document"]),
count: z.number(),
});
export const getSourceTypesResponse = z.object({
sources: z.array(sourceTypeItem),
});
// =============================================================================
// Type Guards for Metadata
// =============================================================================
@ -387,3 +402,5 @@ export type MarkNotificationReadResponse = z.infer<typeof markNotificationReadRe
export type MarkAllNotificationsReadResponse = z.infer<typeof markAllNotificationsReadResponse>;
export type GetUnreadCountRequest = z.infer<typeof getUnreadCountRequest>;
export type GetUnreadCountResponse = z.infer<typeof getUnreadCountResponse>;
export type SourceTypeItem = z.infer<typeof sourceTypeItem>;
export type GetSourceTypesResponse = z.infer<typeof getSourceTypesResponse>;