feedback changes and added mark all read

This commit is contained in:
abutalib-kiwi
2023-09-22 19:55:10 +05:30
parent d1a4b86b09
commit 3afd7fecf3
5 changed files with 9 additions and 6 deletions

View File

@ -44,7 +44,7 @@ ERROR_CODE = {
"2018": "Attached File not found", "2018": "Attached File not found",
"2019": "Invalid Referral code", "2019": "Invalid Referral code",
"2020": "Enter valid mobile number", "2020": "Enter valid mobile number",
"2021": "Already register", "2021": "User registered",
"2022": "Invalid Guardian code", "2022": "Invalid Guardian code",
"2023": "Invalid user", "2023": "Invalid user",
# email not verified # email not verified

View File

@ -149,7 +149,7 @@ class TaskListAPIView(viewsets.ModelViewSet):
def get_queryset(self): def get_queryset(self):
queryset = JuniorTask.objects.filter(guardian__user=self.request.user queryset = JuniorTask.objects.filter(guardian__user=self.request.user
).select_related('junior', 'junior__auth' ).select_related('junior', 'junior__auth'
).order_by('due_date', 'created_at') ).order_by('-created_at')
queryset = self.filter_queryset(queryset) queryset = self.filter_queryset(queryset)
return queryset return queryset

View File

@ -108,7 +108,7 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
if guardian_data: if guardian_data:
JuniorGuardianRelationship.objects.get_or_create(guardian=guardian_data, junior=junior) JuniorGuardianRelationship.objects.get_or_create(guardian=guardian_data, junior=junior)
send_notification.delay(ASSOCIATE_REQUEST, junior.auth_id, JUNIOR, guardian_data.user_id, {}) send_notification.delay(ASSOCIATE_REQUEST, junior.auth_id, JUNIOR, guardian_data.user_id, {})
junior_approval_mail.delay(user.email, user.first_name) # junior_approval_mail.delay(user.email, user.first_name) removed as per changes
junior.dob = validated_data.get('dob', junior.dob) junior.dob = validated_data.get('dob', junior.dob)
junior.passcode = validated_data.get('passcode', junior.passcode) junior.passcode = validated_data.get('passcode', junior.passcode)
junior.country_name = validated_data.get('country_name', junior.country_name) junior.country_name = validated_data.get('country_name', junior.country_name)
@ -466,7 +466,7 @@ class AddGuardianSerializer(serializers.ModelSerializer):
"""Notification email""" """Notification email"""
junior_notification_email(email, full_name, email, password) junior_notification_email(email, full_name, email, password)
junior_approval_mail.delay(email, full_name) # junior_approval_mail.delay(email, full_name) removed as per changes
send_notification.delay(ASSOCIATE_REQUEST, junior_data.auth_id, JUNIOR, guardian_data.user_id, {}) send_notification.delay(ASSOCIATE_REQUEST, junior_data.auth_id, JUNIOR, guardian_data.user_id, {})
return guardian_data return guardian_data

View File

@ -383,7 +383,7 @@ class JuniorTaskListAPIView(viewsets.ModelViewSet):
def get_queryset(self): def get_queryset(self):
queryset = JuniorTask.objects.filter(junior__auth=self.request.user queryset = JuniorTask.objects.filter(junior__auth=self.request.user
).select_related('junior', 'junior__auth' ).select_related('junior', 'junior__auth'
).order_by('due_date', 'created_at') ).order_by('-created_at')
queryset = self.filter_queryset(queryset) queryset = self.filter_queryset(queryset)
return queryset return queryset

View File

@ -68,5 +68,8 @@ class NotificationViewSet(viewsets.GenericViewSet):
""" """
notification list notification list
""" """
Notification.objects.filter(id__in=request.data.get('id')).update(is_read=True) if request.query_params.get('all'):
Notification.objects.filter(notification_to_id=request.auth.payload['user_id']).update(is_read=True)
elif request.data.get('id'):
Notification.objects.filter(id__in=request.data.get('id')).update(is_read=True)
return custom_response(SUCCESS_CODE['3039'], response_status=status.HTTP_200_OK) return custom_response(SUCCESS_CODE['3039'], response_status=status.HTTP_200_OK)