mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-10-05 13:35:23 +00:00
fix(user): remove agreement file validation from UserUpdateAPIView 🐛
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m12s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 5m12s
This commit is contained in:
20
api/views.py
20
api/views.py
@@ -324,26 +324,6 @@ class UserUpdateAPIView(StaffEditorPermissionMixin, generics.UpdateAPIView):
|
|||||||
data=request.data,
|
data=request.data,
|
||||||
partial=True,
|
partial=True,
|
||||||
)
|
)
|
||||||
agreement_file = request.data.get("agreement_file")
|
|
||||||
if not agreement_file:
|
|
||||||
return Response(
|
|
||||||
{"message": "Agreement file is required."},
|
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
|
||||||
)
|
|
||||||
if agreement_file.size > 10 * 1024 * 1024: # 5 MB limit
|
|
||||||
return Response(
|
|
||||||
{"message": "File size exceeds 10 MB limit."},
|
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
|
||||||
)
|
|
||||||
if agreement_file.content_type not in [
|
|
||||||
"application/pdf",
|
|
||||||
]:
|
|
||||||
return Response(
|
|
||||||
{"message": "Invalid file type. Only PDF files are allowed."},
|
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
|
||||||
)
|
|
||||||
if agreement_file:
|
|
||||||
user.agreement = agreement_file
|
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
user.save()
|
user.save()
|
||||||
return super().update(request, *args, **kwargs)
|
return super().update(request, *args, **kwargs)
|
||||||
|
Reference in New Issue
Block a user