Skip to content

Commit

Permalink
add return type
Browse files Browse the repository at this point in the history
  • Loading branch information
magsyg committed Dec 6, 2024
1 parent e6a366a commit 7cef1d6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions backend/samfundet/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
if TYPE_CHECKING:
from typing import Any

from rest_framework.utils.serializer_helpers import ReturnList


class TagSerializer(CustomBaseSerializer):
class Meta:
Expand Down Expand Up @@ -1162,25 +1164,25 @@ class Meta:
model = RecruitmentPosition
fields = ['unprocessed', 'withdrawn', 'accepted', 'rejected', 'hardtoget']

def get_unprocessed(self, instance: RecruitmentPosition): # noqa: ANN201 type: ignore[no-untyped-def]
def get_unprocessed(self, instance: RecruitmentPosition) -> ReturnList:
unprocessed = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.NOT_SET)
return self.ApplicationSerializer(unprocessed, many=True).data

def get_withdrawn(self, instance: RecruitmentPosition): # noqa: ANN201 type: ignore[no-untyped-def]
def get_withdrawn(self, instance: RecruitmentPosition) -> ReturnList:
withdrawn = instance.applications.filter(withdrawn=True)
return self.ApplicationSerializer(withdrawn, many=True).data

def get_rejected(self, instance: RecruitmentPosition): # noqa: ANN201 type: ignore[no-untyped-def]
def get_rejected(self, instance: RecruitmentPosition) -> ReturnList:
rejected = instance.applications.filter(
withdrawn=False, recruiter_status__in=[RecruitmentStatusChoices.AUTOMATIC_REJECTION, RecruitmentStatusChoices.REJECTION]
)
return self.ApplicationSerializer(rejected, many=True).data

def get_accepted(self, instance: RecruitmentPosition): # noqa: ANN201 type: ignore[no-untyped-def]
def get_accepted(self, instance: RecruitmentPosition) -> ReturnList:
accepted = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.CALLED_AND_ACCEPTED)
return self.ApplicationSerializer(accepted, many=True).data

def get_hardtoget(self, instance: RecruitmentPosition): # noqa: ANN201 type: ignore[no-untyped-def]
def get_hardtoget(self, instance: RecruitmentPosition) -> ReturnList:
hardtoget = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.CALLED_AND_REJECTED)
return self.ApplicationSerializer(hardtoget, many=True).data

Expand Down

0 comments on commit 7cef1d6

Please sign in to comment.