Get count of unread notifications.
(self, request)
| 712 | |
| 713 | @action(detail=False, methods=['get'], url_path='count') |
| 714 | def unread_count(self, request): |
| 715 | """Get count of unread notifications.""" |
| 716 | queryset = self.get_queryset() |
| 717 | dismissed_ids = NotificationDismissal.objects.filter( |
| 718 | user=request.user |
| 719 | ).values_list('notification_id', flat=True) |
| 720 | unread_count = queryset.exclude(id__in=dismissed_ids).count() |
| 721 | |
| 722 | return Response({ |
| 723 | 'unread_count': unread_count |
| 724 | }) |
| 725 |
nothing calls this directly
no test coverage detected