Skip to content

Commit

Permalink
Merge branch 'master' into robin/permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
robines committed Sep 23, 2024
2 parents 064d181 + df4e06f commit debe2f6
Show file tree
Hide file tree
Showing 335 changed files with 2,415 additions and 2,793 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ indent_size = 2

[*.{yml,yaml}]
indent_size = 2

[.eslintrc]
indent_size = 2
55 changes: 55 additions & 0 deletions .github/ISSUE_TEMPLATE/1-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 🚀 Feature Request
description: Suggest an idea for this project
title: "[FEATURE] <title>"
labels: ["feature"]
body:
- type: checkboxes
attributes:
label: 👀 Is there an existing feature request for this?
description: Please search to see if a feature request already exists for the feature you are suggesting.
options:
- label: I have searched the existing feature requests
required: true
- type: textarea
attributes:
label: 🌟 Feature statement
description: What is your feature request? Please describe.
placeholder: A clear and concise description of what the feature is.
validations:
required: true
- type: textarea
attributes:
label: 👨‍👩‍👦 Is the feature related to some other issue or PR?
description: Pleas give the isse or PR-number.
placeholder: "#issue-number" or "#PR-number"
validations:
required: false
- type: textarea
attributes:
label: 💡 Proposed Solution
description: Describe the solution you'd like
placeholder: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: 🔦 Additional Context
description: Add any other context or screenshots about the feature request here.
validations:
required: false
- type: textarea
attributes:
label: 🗺️ Where on Samfundet4 do you want the feature?
description: Pleas give a file, or general "area" of Samfundet4
validations:
required: true
- type: dropdown
attributes:
label: Priority
description: How important is this feature to you?
options:
- Nice to have
- Important
- Critical
validations:
required: true
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/2-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 🐞 Bug
description: File a bug/issue
title: "[BUG] <title>"
labels: ["Bug"]
body:
- type: checkboxes
attributes:
label: 👀 Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: 🚫 Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true
- type: textarea
attributes:
label: ✅ Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: 🧩 Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: true
- type: textarea
attributes:
label: 🐼 Environment
description: |
examples:
- **OS**: Ubuntu 20.04
- **Node**: 13.14.0
- **npm**: 7.6.3
value: |
- OS:
- Node:
- npm:
render: markdown
validations:
required: false
- type: textarea
attributes:
label: 🦮 Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: true
4 changes: 2 additions & 2 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ jobs:
- name: Install modules
run: yarn install

- name: Run ESLint
run: yarn run eslint:check
- name: Run Biome
run: yarn run biome:ci

- name: Run stylelint
run: yarn run stylelint:check
Expand Down
2 changes: 0 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
"esbenp.prettier-vscode",
"alexcvzz.vscode-sqlite",
"batisteo.vscode-django",
"dbaeumer.vscode-eslint",
"ms-python.vscode-pylance",
"editorconfig.editorconfig",
"yzhang.markdown-all-in-one",
"stylelint.vscode-stylelint",
"ms-python.mypy-type-checker",
"rvest.vs-code-prettier-eslint",
"visualstudioexptteam.vscodeintellicode"
]
}
7 changes: 0 additions & 7 deletions .vscode/settings.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,13 @@
// ================================
// Frontend
// ================================
"eslint.enable": true,
"eslint.format.enable": true,
"html.format.enable": false,
"prettier.configPath": "frontend/.prettierrc.js",
"prettier.ignorePath": "frontend/.prettierignore",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript][javascriptreact][typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
}
},
"eslint.workingDirectories": ["frontend"],
"[css][scss]": {
"editor.defaultFormatter": "stylelint.vscode-stylelint"
},
Expand Down
7 changes: 0 additions & 7 deletions .vscode/settings.emil.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,8 @@
// ================================
// Frontend
// ================================
"eslint.enable": true,
"eslint.format.enable": true,
"html.format.enable": false,
"prettier.configPath": "frontend/.prettierrc.js",
"prettier.ignorePath": "frontend/.prettierignore",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.workingDirectories": ["frontend"],
"[javascript][javascriptreact][typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
Expand Down
41 changes: 41 additions & 0 deletions backend/samfundet/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,47 @@ def get_interview_time(self, instance: RecruitmentApplication) -> str | None:
return instance.interview.interview_time if instance.interview else None


class RecruitmentBasicUserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['id', 'first_name', 'last_name', 'email', 'phone_number']


class RecruitmentRecruitmentPositionSerializer(serializers.ModelSerializer):
class Meta:
model = RecruitmentPosition
fields = ['id', 'name_nb', 'name_en']


class RecruitmentShowUnprocessedApplicationsSerializer(serializers.ModelSerializer):
user = RecruitmentBasicUserSerializer(read_only=True)
recruitment_position = RecruitmentRecruitmentPositionSerializer(read_only=True)

class Meta:
model = RecruitmentApplication
fields = [
'id',
'recruitment',
'user',
'applicant_priority',
'recruitment_position',
'recruiter_status',
'recruiter_priority',
]
read_only_fields = [
'id',
'recruitment',
'user',
'applicant_priority',
'recruitment_position',
'recruiter_status',
'recruiter_priority',
]

def get_recruitment_position(self, instance: RecruitmentApplication) -> str:
return instance.recruitment_position.name_nb


class RecruitmentApplicationForGangSerializer(CustomBaseSerializer):
user = ApplicantInfoSerializer(read_only=True)
interview = InterviewSerializer(read_only=False)
Expand Down
5 changes: 5 additions & 0 deletions backend/samfundet/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
########## Recruitment ##########
path('active-recruitments/', views.ActiveRecruitmentsView.as_view(), name='active_recruitments'),
path('recruitment-positions/', views.RecruitmentPositionsPerRecruitmentView.as_view(), name='recruitment_positions'),
path(
'recruitment-show-unprocessed-applicants/',
views.RecruitmentUnprocessedApplicationsPerRecruitment.as_view(),
name='recruitment_show_unprocessed_applicants',
),
path(
'recruitment-positions-gang-for-applicant/',
views.RecruitmentPositionsPerGangForApplicantView.as_view(),
Expand Down
20 changes: 20 additions & 0 deletions backend/samfundet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
RecruitmentApplicationForApplicantSerializer,
RecruitmentApplicationForRecruiterSerializer,
RecruitmentApplicationUpdateForGangSerializer,
RecruitmentShowUnprocessedApplicationsSerializer,
)
from .models.event import (
Event,
Expand Down Expand Up @@ -696,6 +697,25 @@ def get_queryset(self) -> Response | None:
return None


@method_decorator(ensure_csrf_cookie, 'dispatch')
class RecruitmentUnprocessedApplicationsPerRecruitment(ListAPIView):
permission_classes = [IsAuthenticated]
serializer_class = RecruitmentShowUnprocessedApplicationsSerializer

def get_queryset(self) -> Response | None:
"""
Optionally restricts the returned positions to a given recruitment,
by filtering against a `recruitment` query parameter in the URL.
"""
recruitment = self.request.query_params.get('recruitment', None)
if recruitment is not None:
return RecruitmentApplication.objects.filter(
recruitment=recruitment,
recruiter_status=RecruitmentStatusChoices.NOT_SET,
)
return None


class ApplicantsWithoutThreeInterviewsCriteriaView(APIView):
permission_classes = [IsAuthenticated]

Expand Down
42 changes: 42 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// https://biomejs.dev/guides/configure-biome/

// Reference local dependency version.
"$schema": "frontend/node_modules/@biomejs/biome/configuration_schema.json",

"files": {
// For now, only include frontend files.
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
// Match files, not folders.
"ignore": [
"**/*.json",
"**/*.jsonc",
"**/*.config.ts",
"**/src/routes/backend.ts", // Autogenerated file.
"**/build/static/**/*", // Build files from frontend.
"**/dist/assets/**/*", // Build files from frontend.
"**/.history/**/*", // VSCode extension.
"**/staticroot/**/*", // Django static files.
"**/static/**/*", // Django static files.
"**/.venv/**/*"
]
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"indentStyle": "space",
"lineWidth": 120
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ services:
context: ./frontend
image: samfundet-frontend
volumes:
- ./frontend/src:/app/src # Share project code between host machine and container to enable reload on changes.
# Share project code between host machine and container to enable reload on changes.
# Excellent solution when component needs files/folders from outside context.
- ./biome.jsonc:/biome.jsonc
- ./frontend/src:/app/src
- ./frontend/biome.jsonc:/app/biome.jsonc
- ./frontend/package.json:/app/package.json
- ./frontend/index.html:/app/index.html
env_file:
- ./frontend/.env.docker # Environment for frontend docker
environment:
Expand Down
1 change: 1 addition & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules
.git
Dockerfile
.dockerignore
.history
7 changes: 0 additions & 7 deletions frontend/.eslintignore

This file was deleted.

Loading

0 comments on commit debe2f6

Please sign in to comment.