Skip to content

Commit

Permalink
Create JobOfferSeiralizerUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
DEENUU1 committed Jan 8, 2024
1 parent 1004378 commit 5accac8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions offer/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ def validate_company(self, value):
return value


class JobOfferSerializerUpdate(ModelSerializer):
class Meta:
model = JobOffer
fields = [
"id",
"title",
"description",
"company",
"addresses",
"is_remote",
"is_hybrid",
"apply_form",
"skills",
"salary",
"experience",
"work_type",
"employment_type",
"status",
]


class ScrapedDataSerializer(serializers.Serializer):
title = serializers.CharField()
description = serializers.CharField(allow_null=True, required=False)
Expand Down
3 changes: 2 additions & 1 deletion offer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
ScrapedDataSerializer,
JobOfferCompanySerializer,
JobOfferRateCreateSerializer,
JobOfferSerializerUpdate
)
from collections import Counter

Expand Down Expand Up @@ -165,7 +166,7 @@ def update(self, request, pk=None):
{"info": "Offer is expired"}, status=status.HTTP_400_BAD_REQUEST
)

serializer = JobOfferSerializerCreate(offer, data=request.data)
serializer = JobOfferSerializerUpdate(offer, data=request.data)
serializer.is_valid(raise_exception=True)
serializer.save()
return Response(serializer.data)
Expand Down

0 comments on commit 5accac8

Please sign in to comment.