From c4abc08dd1c7cf953d8936f57c8c0536ee3e50e3 Mon Sep 17 00:00:00 2001 From: magsyg Date: Tue, 12 Nov 2024 22:11:33 +0100 Subject: [PATCH] fixes --- backend/samfundet/serializers.py | 22 +++++++++++----------- backend/samfundet/views.py | 2 +- frontend/src/routes/backend.ts | 4 +--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/backend/samfundet/serializers.py b/backend/samfundet/serializers.py index ec2e05019..5f4e9b332 100644 --- a/backend/samfundet/serializers.py +++ b/backend/samfundet/serializers.py @@ -1096,7 +1096,7 @@ def get_application_count(self, application: RecruitmentApplication) -> int: class RecruitmentPositionOrganizedApplications(CustomBaseSerializer): - applicationSerializer = RecruitmentApplicationForGangSerializer + ApplicationSerializer = RecruitmentApplicationForGangSerializer unprocessed = serializers.SerializerMethodField(method_name='get_unprocessed', read_only=True) withdrawn = serializers.SerializerMethodField(method_name='get_withdrawn', read_only=True) accepted = serializers.SerializerMethodField(method_name='get_accepted', read_only=True) @@ -1107,27 +1107,27 @@ class Meta: model = RecruitmentPosition fields = ['unprocessed', 'withdrawn', 'accepted', 'rejected', 'hardtoget'] - def get_unprocessed(self, instance: RecruitmentPosition): + def get_unprocessed(self, instance: RecruitmentPosition): # noqa: ANN201 unprocessed = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.NOT_SET) - return self.applicationSerializer(unprocessed, many=True).data + return self.ApplicationSerializer(unprocessed, many=True).data - def get_withdrawn(self, instance: RecruitmentPosition): + def get_withdrawn(self, instance: RecruitmentPosition): # noqa: ANN201 withdrawn = instance.applications.filter(withdrawn=True) - return self.applicationSerializer(withdrawn, many=True).data + return self.ApplicationSerializer(withdrawn, many=True).data - def get_rejected(self, instance: RecruitmentPosition): + def get_rejected(self, instance: RecruitmentPosition): # noqa: ANN201 rejected = instance.applications.filter( withdrawn=False, recruiter_status__in=[RecruitmentStatusChoices.AUTOMATIC_REJECTION, RecruitmentStatusChoices.REJECTION] ) - return self.applicationSerializer(rejected, many=True).data + return self.ApplicationSerializer(rejected, many=True).data - def get_accepted(self, instance: RecruitmentPosition): + def get_accepted(self, instance: RecruitmentPosition): # noqa: ANN201 accepted = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.CALLED_AND_ACCEPTED) - return self.applicationSerializer(accepted, many=True).data + return self.ApplicationSerializer(accepted, many=True).data - def get_hardtoget(self, instance: RecruitmentPosition): + def get_hardtoget(self, instance: RecruitmentPosition): # noqa: ANN201 hardtoget = instance.applications.filter(withdrawn=False, recruiter_status=RecruitmentStatusChoices.CALLED_AND_REJECTED) - return self.applicationSerializer(hardtoget, many=True).data + return self.ApplicationSerializer(hardtoget, many=True).data class RecruitmentApplicationUpdateForGangSerializer(serializers.Serializer): diff --git a/backend/samfundet/views.py b/backend/samfundet/views.py index f9ae11a69..e77fdb5d5 100644 --- a/backend/samfundet/views.py +++ b/backend/samfundet/views.py @@ -42,7 +42,6 @@ from .homepage import homepage from .models.role import Role from .serializers import ( - RecruitmentPositionOrganizedApplications, TagSerializer, GangSerializer, MenuSerializer, @@ -88,6 +87,7 @@ RecruitmentSeparatePositionSerializer, RecruitmentApplicationForGangSerializer, RecruitmentUpdateUserPrioritySerializer, + RecruitmentPositionOrganizedApplications, RecruitmentPositionForApplicantSerializer, RecruitmentInterviewAvailabilitySerializer, RecruitmentApplicationForApplicantSerializer, diff --git a/frontend/src/routes/backend.ts b/frontend/src/routes/backend.ts index 5ca8ce229..c5b130e73 100644 --- a/frontend/src/routes/backend.ts +++ b/frontend/src/routes/backend.ts @@ -562,8 +562,6 @@ export const ROUTES_BACKEND = { samfundet__recruitment_applications_for_position_detail: '/api/recruitment-applications-for-position/:pk/', samfundet__interview_list: '/api/interview/', samfundet__interview_detail: '/api/interview/:pk/', - samfundet__api_root: '/api/', - samfundet__api_root: '/api/:format', samfundet__schema: '/schema/', samfundet__swagger_ui: '/schema/swagger-ui/', samfundet__redoc: '/schema/redoc/', @@ -610,4 +608,4 @@ export const ROUTES_BACKEND = { samfundet__purchase_feedback: '/purchase-feedback/', static__path: '/static/:path', media__path: '/media/:path', -} as const; \ No newline at end of file +} as const;