Increased JWT time to expire and improved student status serializer

This commit is contained in:
Keannu Bernasol 2023-09-02 13:46:51 +08:00
parent 49afdc981f
commit 813734582a
3 changed files with 5 additions and 5 deletions

View file

@ -235,8 +235,8 @@ else:
SITE_NAME = 'Stud-E'
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=360),
"REFRESH_TOKEN_LIFETIME": timedelta(minutes=360)
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=3600),
"REFRESH_TOKEN_LIFETIME": timedelta(minutes=3600)
}
LEAFLET_CONFIG = {

View file

@ -39,7 +39,7 @@ class StudentStatusSerializer(serializers.ModelSerializer):
validated_data['location'] = Point(0, 0)
validated_data['subject'] = None
validated_data['landmark'] = None
validated_data['study_group'] = None
validated_data['study_group'] = []
else:
if 'subject' not in validated_data:
raise serializers.ValidationError(

View file

@ -42,7 +42,7 @@ class StudentStatusListByStudentStatusLocation(generics.ListAPIView):
user_location = fromstr(
user_status.location, srid=4326)
return StudentStatus.objects.filter(subject__in=user.subjects.all()).annotate(distance=Distance('location', user_location)).filter(distance__lte=50)
return StudentStatus.objects.filter(user != user).filter(subject__in=user.subjects.all()).annotate(distance=Distance('location', user_location)).filter(distance__lte=50)
class StudentStatusListByCurrentLocation(viewsets.ViewSet):
@ -57,7 +57,7 @@ class StudentStatusListByCurrentLocation(viewsets.ViewSet):
raise exceptions.ValidationError("Location is required")
user_location = fromstr(location_str, srid=4326)
queryset = StudentStatus.objects.filter(subject__in=user.subjects.all()).annotate(
queryset = StudentStatus.objects.filter(user != user).filter(subject__in=user.subjects.all()).annotate(
distance=Distance('location', user_location)).filter(distance__lte=50)
serializer = StudentStatusLocationSerializer(queryset, many=True)
return Response(serializer.data)