refactor: Remove deprecated create_connector_indexed_notification method and add notification types

- Removed the deprecated create_connector_indexed_notification method from NotificationService.
- Introduced new notification types and schemas in notification.types.ts to standardize notification handling.
- Updated useNotifications hook to utilize the new notification type definitions.
This commit is contained in:
Anish Sarkar 2026-01-13 17:21:00 +05:30
parent e38e6d90e0
commit 59a8ef5d64
5 changed files with 115 additions and 60 deletions

View file

@ -505,49 +505,3 @@ class NotificationService:
},
)
@staticmethod
async def create_connector_indexed_notification(
session: AsyncSession,
user_id: UUID,
connector_name: str,
connector_type: str,
status: str,
search_space_id: int,
indexed_count: int | None = None,
) -> Notification:
"""
Create notification when connector indexing completes.
DEPRECATED: Use NotificationService.connector_indexing methods instead.
Args:
session: Database session
user_id: User to notify
connector_name: Name of the connector
connector_type: Type of connector
status: Indexing status ('SUCCESS', 'FAILED')
search_space_id: Search space ID
indexed_count: Number of items indexed (optional)
Returns:
Notification: The created notification
"""
status_lower = status.lower()
title = f"Connector indexed: {connector_name}"
message = f'Your connector "{connector_name}" has finished indexing ({status_lower}).'
if indexed_count is not None:
message += f" {indexed_count} items indexed."
return await NotificationService.create_notification(
session=session,
user_id=user_id,
notification_type="connector_indexed",
title=title,
message=message,
search_space_id=search_space_id,
notification_metadata={
"connector_name": connector_name,
"connector_type": connector_type,
"status": status,
"indexed_count": indexed_count,
},
)