From 3ac3efd0992bbdb2f79f01267c9bbbbfd331a288 Mon Sep 17 00:00:00 2001 From: magsyg Date: Mon, 23 Dec 2024 15:13:39 +0100 Subject: [PATCH] feat: add same positions for gagn --- backend/samfundet/views.py | 4 ++++ frontend/src/dto.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/backend/samfundet/views.py b/backend/samfundet/views.py index 59666f8aa..231b1a1b4 100644 --- a/backend/samfundet/views.py +++ b/backend/samfundet/views.py @@ -1240,11 +1240,15 @@ class RecruitmentApplicationForRecruitersView(APIView): def get(self, request: Request, application_id: str) -> Response: application = get_object_or_404(RecruitmentApplication, id=application_id) + same_gang_applications = RecruitmentApplication.objects.filter( + user=application.user, recruitment=application.recruitment, recruitment_position__gang=application.recruitment_position.resolve_gang() + ).order_by('applicant_priority') other_applications = RecruitmentApplication.objects.filter(user=application.user, recruitment=application.recruitment).order_by('applicant_priority') return Response( data={ 'application': RecruitmentApplicationForRecruiterSerializer(instance=application).data, 'user': UserForRecruitmentSerializer(instance=application.user).data, + 'same_gang_applications': RecruitmentApplicationForRecruiterSerializer(same_gang_applications, many=True).data, 'other_applications': RecruitmentApplicationForRecruiterSerializer(other_applications, many=True).data, } ) diff --git a/frontend/src/dto.ts b/frontend/src/dto.ts index 44807690c..693b3241c 100644 --- a/frontend/src/dto.ts +++ b/frontend/src/dto.ts @@ -532,6 +532,7 @@ export type RecruitmentApplicationDto = { export type RecruitmentApplicationRecruiterDto = { user: RecruitmentUserDto; application: RecruitmentApplicationDto; + same_gang_applications: RecruitmentApplicationDto[]; other_applications: RecruitmentApplicationDto[]; };