mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-04-27 18:21:23 +08:00
Add authorization requests
This commit is contained in:
parent
41507aa550
commit
9529560fed
12 changed files with 280 additions and 0 deletions
|
@ -35,6 +35,10 @@ class DocumentRequestCreationSerializer(serializers.ModelSerializer):
|
|||
def create(self, validated_data):
|
||||
user = self.context["request"].user
|
||||
documents_data = validated_data.pop("documents")
|
||||
if not documents_data:
|
||||
raise serializers.ValidationError(
|
||||
{"error": "No documents provided"}
|
||||
)
|
||||
# Set requester to user who sent HTTP request to prevent spoofing
|
||||
validated_data["requester"] = user
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue