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

@ -1,9 +1,11 @@
import {
type GetNotificationsRequest,
type GetNotificationsResponse,
type GetSourceTypesResponse,
type GetUnreadCountResponse,
getNotificationsRequest,
getNotificationsResponse,
getSourceTypesResponse,
getUnreadCountResponse,
type InboxItemTypeEnum,
type MarkAllNotificationsReadResponse,
@ -42,6 +44,9 @@ class NotificationsApiService {
if (queryParams.type) {
params.append("type", queryParams.type);
}
if (queryParams.source_type) {
params.append("source_type", queryParams.source_type);
}
if (queryParams.before_date) {
params.append("before_date", queryParams.before_date);
}
@ -92,6 +97,23 @@ class NotificationsApiService {
return baseApiService.patch("/api/v1/notifications/read-all", markAllNotificationsReadResponse);
};
/**
* Get distinct source types (connector + document types) across all
* status notifications. Used to populate the inbox Status tab filter.
*/
getSourceTypes = async (searchSpaceId?: number): Promise<GetSourceTypesResponse> => {
const params = new URLSearchParams();
if (searchSpaceId !== undefined) {
params.append("search_space_id", String(searchSpaceId));
}
const queryString = params.toString();
return baseApiService.get(
`/api/v1/notifications/source-types${queryString ? `?${queryString}` : ""}`,
getSourceTypesResponse
);
};
/**
* Get unread notification count with split between total and recent
* - total_unread: All unread notifications