notification API set read on retrieve
This commit is contained in:
parent
9d3274b523
commit
5d7aca80d9
1 changed files with 7 additions and 0 deletions
|
@ -381,6 +381,13 @@ class NotificationViewSet(viewsets.ModelViewSet):
|
||||||
|
|
||||||
return Notification.objects.filter(project__tenant_id=tenant_id).order_by('-created_at')
|
return Notification.objects.filter(project__tenant_id=tenant_id).order_by('-created_at')
|
||||||
|
|
||||||
|
def retrieve(self, request, *args, **kwargs):
|
||||||
|
instance = self.get_object()
|
||||||
|
instance.is_read = True
|
||||||
|
instance.save()
|
||||||
|
serializer = self.get_serializer(instance)
|
||||||
|
return Response(serializer.data)
|
||||||
|
|
||||||
@action(detail=True, methods=['GET'])
|
@action(detail=True, methods=['GET'])
|
||||||
def resend(self, request, pk):
|
def resend(self, request, pk):
|
||||||
notification = Notification.objects.filter(id=pk).first()
|
notification = Notification.objects.filter(id=pk).first()
|
||||||
|
|
Loading…
Add table
Reference in a new issue