Skip to content

Commit

Permalink
Merge pull request #129 from null-open-security-community/main
Browse files Browse the repository at this point in the history
Deploy employers jobs
  • Loading branch information
YogeshUpdhyay authored Jul 7, 2024
2 parents 8a2cc7a + b6c293a commit eb9a540
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ python manage.py test --settings=null_jobs_backend.test_settings
## Contributors and sponsors

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

Thanks goes to these wonderful people
Expand All @@ -88,7 +88,6 @@ Thanks goes to these wonderful people
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hims1911"><img src="https://avatars.githubusercontent.com/u/26831864?v=4?s=100" width="100px;" alt="Himanshu Sharma"/><br /><sub><b>Himanshu Sharma</b></sub></a><br /><a href="https://github.com/null-open-security-community/null-jobs-backend-2.0/commits/main/?author=hims1911" title="Code">💻</a> <a href="https://github.com/null-open-security-community/null-jobs-backend-2.0/commits/main/?author=hims1911" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/YogeshUpdhyay"><img src="https://avatars.githubusercontent.com/u/53992168?v=4?s=100" width="100px;" alt="Yogesh Upadhyay"/><br /><sub><b>Yogesh Upadhyay</b></sub></a><br /><a href="https://github.com/yezz123/authx/issues?q=author%3AYogeshUpdhyay" title="Bug reports">🐛</a><a href="https://github.com/null-open-security-community/null-jobs-backend-2.0/commits/main/?author=YogeshUpdhyay" title="Code">💻</a> <a href="https://github.com/null-open-security-community/null-jobs-backend-2.0/commits/main/?author=YogeshUpdhyay" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Himan10"><img src="https://avatars.githubusercontent.com/u/33115688?v=4?s=100" width="100px;" alt="Himanshu Bhatnagar"/><br /><sub><b>Himanshu Bhatnagar</b></sub></a><br /><a href="https://github.com/null-open-security-community/null-jobs-backend-2.0/commits/main/?author=Himan10" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Parth858"><img src="https://avatars.githubusercontent.com/u/87690475?v=4?s=100" width="100px;" alt="Parth K"/><br /><sub><b>Parth K</b></sub></a><br /><a href="https://github.com/null-open-security-community/null-jobs-backend-2.0/commits/main/?author=Parth858" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand All @@ -113,4 +112,4 @@ specification. Contributions of any kind welcome!

## License

This project is licensed under the terms of the MIT License.
This project is licensed under the terms of the MIT License.
18 changes: 16 additions & 2 deletions apps/jobs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
from django.db.models import BooleanField, Case, Value, When
from drf_spectacular.utils import extend_schema
from rest_framework import exceptions, parsers, status, viewsets, filters
from rest_framework.views import APIView
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated

from apps.accounts.permissions import Moderator
from apps.jobs.constants import response, values
from apps.userprofile.models import UserProfile
from apps.jobs.models import Company, ContactMessage, Job
from apps.accounts.permissions import IsEmployer
from apps.jobs.serializers import CompanySerializer, ContactUsSerializer, JobSerializer, JobsCountByCategoriesSerializer
from apps.jobs.utils.validators import validationClass
from apps.utils.responses import InternalServerError
Expand All @@ -23,10 +24,13 @@
class JobsFilter(df_filters.FilterSet):
category = df_filters.BaseInFilter(field_name="category")
job_type = df_filters.BaseInFilter(field_name="job_type")
min_exp = df_filters.NumberFilter(field_name='experience', lookup_expr='gte')
max_exp = df_filters.NumberFilter(field_name='experience', lookup_expr='lte')


class Meta:
model = Job
fields = ["category", "job_type", "is_active", "is_featured"]
fields = ["category", "job_type", 'experience', "is_active", "is_featured"]

class JobViewSets(viewsets.ModelViewSet):
"""
Expand Down Expand Up @@ -178,6 +182,16 @@ def get_trending_keywords(self, request):
def get_count_by_categories(self, request):
category_job_counts = Job.objects.values('category').annotate(count=Count('job_id'))
return Response(JobsCountByCategoriesSerializer(category_job_counts, many=True).data)


@action(
detail=False,
methods=['get'],
permission_classes=[IsAuthenticated, IsEmployer]
)
def employer(self, request):
jobs = Job.objects.filter(employer = request.user)
return Response(JobSerializer(jobs, many=True).data)



Expand Down

0 comments on commit eb9a540

Please sign in to comment.