Notifications
MessageResponse
Bases: BaseModel
Generic message response.
Source code in app/api/v1/endpoints/notifications.py
21 22 23 24 25 | |
NotificationCreateRequest
Bases: NotificationBase
Schema for creating a notification through the API.
Source code in app/api/v1/endpoints/notifications.py
28 29 30 31 32 33 34 35 | |
clear_all_notifications(service, current_user)
async
Clear all notifications (Admin only).
Source code in app/api/v1/endpoints/notifications.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
create_notification(notification_in, service, current_user)
async
Create a notification (Admin only).
If target_user_id is provided, the notification will be created for that user. Otherwise, it will be created for the admin currently authenticated.
Source code in app/api/v1/endpoints/notifications.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
get_notifications(service, current_user)
async
List all notifications for the current user.
Parameters:
-
service(Annotated[NotificationService, Depends(get_notification_service)]) –The notification service instance.
-
current_user(Annotated[User, Depends(get_current_user)]) –The currently authenticated user.
Returns:
-
List[NotificationResponse]–List[NotificationResponse]: A list of notifications for the user.
Raises:
-
TechnicalError–If there's an error fetching notifications.
Source code in app/api/v1/endpoints/notifications.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
mark_all_notifications_read(service, current_user)
async
Mark all notifications as read for the current user.
Source code in app/api/v1/endpoints/notifications.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
mark_notification_read(notification_id, service, current_user)
async
Mark a specific notification as read.
Source code in app/api/v1/endpoints/notifications.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
stream_notifications(request, current_user, manager=Depends(get_websocket))
async
SSE Stream for real-time notifications.
Provides a Server-Sent Events (SSE) stream that delivers real-time notifications to the authenticated user.
Parameters:
-
request(Request) –The FastAPI request object.
-
current_user(Annotated[User, Depends(get_current_user)]) –The currently authenticated user.
-
manager(Websocket, default:Depends(get_websocket)) –The websocket manager instance.
Returns:
-
StreamingResponse(StreamingResponse) –A response delivering SSE events.
Source code in app/api/v1/endpoints/notifications.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |