Skip to content

Commit

Permalink
Merge branch 'master' into feature/makeoverviewdynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
magsyg authored Dec 22, 2024
2 parents d573603 + ce08b37 commit 4845fa0
Show file tree
Hide file tree
Showing 240 changed files with 5,261 additions and 1,579 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Force all files to use LF line endings
* text=auto
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"yzhang.markdown-all-in-one",
"stylelint.vscode-stylelint",
"ms-python.mypy-type-checker",
"visualstudioexptteam.vscodeintellicode"
"visualstudioexptteam.vscodeintellicode",
"ms-vscode-remote.vscode-remote-extensionpack"
]
}
83 changes: 43 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,58 @@

<img src="./docs/splash.png"/>

## Documentation
## Introduction

- **[Technical Documentation](./docs/technical/README.md)**
- [Work Methodology](./docs/work-methodology.md)
- [Useful Commands](./docs/useful-commands.md)
- [Technologies used on Samf4 🤖](./docs/technical/Samf4Tech.md)
- [Project Specific Commands](./docs/docker-project-specific-commands.md)
- [Useful Docker aliases](./docs/docker-project-specific-commands.md)
- [🌐 API documentation](./docs/api-docs.md)
Samfundet4 is the latest and greatest iteration of samfundet.no. It's built using Django and React.


## Documentation Overview

> [!TIP]
> If you're new, start by going through the [Introduction to Samfundet4](./docs/introduction.md) guide.
## Installation
### Frontend

We have a script that handles all installation for you. To run the script, a Github Personal Access Token (PAT) is required.
You can make one here https://github.com/settings/tokens/new. Tick scopes `repo`, `read:org` and `admin:public_key`),
then store the token somewhere safe (Github will never show it again).
- [Creating react components (conventions)](./docs/technical/frontend/components.md)
- [Forms and schemas](./docs/technical/frontend/forms.md)
- [*Deprecated: SamfForm*](./docs/technical/frontend/samfform.md)
- [Cypress Setup Documentation](./docs/technical/frontend/cypress.md)
- [Data fetching and State management](./docs/technical/frontend/data-fetching.md)

Copy these commands (press button on the right-hand side of the block)
and run from the directory you would clone the project.
### Backend

```sh
# Interactive
read -s -p "Github PAT token: " TOKEN ; X_INTERACTIVE=y /bin/bash -c "$(curl -fsSL https://$TOKEN@raw.githubusercontent.com/Samfundet/Samfundet4/master/{bash_utils.sh,install.sh})" && . ~/.bash_profile && cd Samfundet4; unset TOKEN; unset X_INTERACTIVE;
```
- [🌐 API documentation](./docs/api-docs.md)
- [Billig (payment system)](./docs/technical/backend/billig.md)
- [Seed scripts](./docs/technical/backend/seed.md)
- [Role system](./docs/technical/backend/rolesystem.md)

### Other

- [Automatic Interview Scheduling](./docs/intervew-scheduling.md)

### Workflow

<details>
<summary>Non-interactive (show/hide)</summary>
- [Work Methodology](./docs/work-methodology.md)
- How to contribute to the project
- [Useful Commands](./docs/useful-commands.md)
- [Useful Docker aliases](./docs/docker-project-specific-commands.md)
- [Common error messages](./docs/common-errors.md)

```sh
# Non-interactive
read -s -p "Github PAT token: " TOKEN ; X_INTERACTIVE=n /bin/bash -c "$(curl -fsSL https://$TOKEN@raw.githubusercontent.com/Samfundet/Samfundet4/master/{bash_utils.sh,install.sh})" && . ~/.bash_profile && cd Samfundet4; unset TOKEN; unset X_INTERACTIVE;
```
### Pipelines & Deployment

<!--
cd ~/my-projects/test; rm -rf Samfundet4; read -s -p "Github PAT token: " TOKEN ; X_INTERACTIVE=y /bin/bash -c "$(curl -fsSL https://[email protected]/Samfundet/Samfundet4/master/{bash_utils.sh,install.sh})" && . ~/.bash_profile && cd Samfundet4; unset TOKEN; unset X_INTERACTIVE;
-->
</details>
- [Pipeline (mypy, Biome, tsc, ...)](./docs/technical/pipeline.md)

<details>
<summary>Flags explained (show/hide)</summary>
### Install

> - X_INTERACTIVE (y/n): determines how many prompts you receive before performing an action.
> curl:
> - -f: fail fast
> - -s: silent, no progress-meter
> - -S: show error on fail
> - -L: follow redirect
- Linux: [Docker](./docs/install/linux-docker.md)[Native](./docs/install/linux-native.md)
- MacOS: [Docker](./docs/install/mac-docker.md)[Native](./docs/install/mac-native.md)
- Windows: [Docker](./docs/install/windows-docker.md)[WSL](./docs/install/windows-wsl.md)
- [Install script](./docs/install/install-script.md)
- [Post-install instructions](./docs/install/post-install.md)

</details>
### Editor configuration

<br>
<br>
<br>
* [JetBrains (WebStorm, PyCharm, etc...)](./docs/editors/jetbrains.md)
* [VS Code](./docs/editors/vscode.md)
* [Vim/Neovim](./docs/editors/vim.md)
* [Emacs](./docs/editors/emacs.md)
2 changes: 2 additions & 0 deletions backend/root/management/commands/seed_scripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
recruitment_separate_position,
recruitment_interviewavailability,
recruitment_position_interviewers,
recruitment_sharedinterviewgroups,
)

# Insert seed scripts here (in order of priority)
Expand All @@ -50,6 +51,7 @@
('merch', merch.seed),
('recruitment', recruitment.seed),
('recruitment_position', recruitment_position.seed),
('recruitment_position_shared_interview', recruitment_sharedinterviewgroups.seed),
('recruitment_interviewavailability', recruitment_interviewavailability.seed),
('recruitment_separate_position', recruitment_separate_position.seed),
('recruitment_applications', recruitment_applications.seed),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from __future__ import annotations

import random

from root.utils.samfundet_random import words

from samfundet.models.recruitment import Recruitment, RecruitmentPosition, RecruitmentPositionSharedInterviewGroup


def seed():
yield 0, 'recruitment_positions_shared_interview'
RecruitmentPositionSharedInterviewGroup.objects.all().delete()
yield 0, 'Deleted old recruitmentpositionsharedgroup'

recruitments = Recruitment.objects.all()
created_count = 0
for recruitment in recruitments:
for i in range(3):
RecruitmentPositionSharedInterviewGroup.objects.create(recruitment=recruitment, name_nb=f'{words(2)} {i}', name_en=f'{words(2)} {i}')
created_count += 1
shared_groups = list(RecruitmentPositionSharedInterviewGroup.objects.filter(recruitment=recruitment))
positions = random.sample(list(RecruitmentPosition.objects.filter(recruitment=recruitment)), 6)
for pos in positions:
pos.shared_interview_group = random.choice(shared_groups)
pos.save()

yield 100, f'Created {created_count} recruitment_position_shared_groups'
17 changes: 17 additions & 0 deletions backend/root/utils/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,15 @@
admin__samfundet_recruitmentapplication_delete = 'admin:samfundet_recruitmentapplication_delete'
admin__samfundet_recruitmentapplication_change = 'admin:samfundet_recruitmentapplication_change'
adminsamfundetrecruitmentapplication__objectId = ''
admin__samfundet_recruitmentpositionsharedinterviewgroup_permissions = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_permissions'
admin__samfundet_recruitmentpositionsharedinterviewgroup_permissions_manage_user = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_permissions_manage_user'
admin__samfundet_recruitmentpositionsharedinterviewgroup_permissions_manage_group = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_permissions_manage_group'
admin__samfundet_recruitmentpositionsharedinterviewgroup_changelist = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_changelist'
admin__samfundet_recruitmentpositionsharedinterviewgroup_add = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_add'
admin__samfundet_recruitmentpositionsharedinterviewgroup_history = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_history'
admin__samfundet_recruitmentpositionsharedinterviewgroup_delete = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_delete'
admin__samfundet_recruitmentpositionsharedinterviewgroup_change = 'admin:samfundet_recruitmentpositionsharedinterviewgroup_change'
adminsamfundetrecruitmentpositionsharedinterviewgroup__objectId = ''
admin__samfundet_organization_permissions = 'admin:samfundet_organization_permissions'
admin__samfundet_organization_permissions_manage_user = 'admin:samfundet_organization_permissions_manage_user'
admin__samfundet_organization_permissions_manage_group = 'admin:samfundet_organization_permissions_manage_group'
Expand Down Expand Up @@ -502,6 +511,8 @@
samfundet__saksdokument_detail = 'samfundet:saksdokument-detail'
samfundet__profile_list = 'samfundet:profile-list'
samfundet__profile_detail = 'samfundet:profile-detail'
samfundet__permissions_list = 'samfundet:permissions-list'
samfundet__permissions_detail = 'samfundet:permissions-detail'
samfundet__menu_list = 'samfundet:menu-list'
samfundet__menu_detail = 'samfundet:menu-detail'
samfundet__menu_items_list = 'samfundet:menu_items-list'
Expand Down Expand Up @@ -529,6 +540,7 @@
samfundet__merch_detail = 'samfundet:merch-detail'
samfundet__role_list = 'samfundet:role-list'
samfundet__role_detail = 'samfundet:role-detail'
samfundet__role_users = 'samfundet:role-users'
samfundet__recruitment_list = 'samfundet:recruitment-list'
samfundet__recruitment_detail = 'samfundet:recruitment-detail'
samfundet__recruitment_gangs = 'samfundet:recruitment-gangs'
Expand All @@ -553,13 +565,15 @@
samfundet__interview_list = 'samfundet:interview-list'
samfundet__interview_detail = 'samfundet:interview-detail'
samfundet__api_root = 'samfundet:api-root'
samfundet__api_root = 'samfundet:api-root'
samfundet__schema = 'samfundet:schema'
samfundet__swagger_ui = 'samfundet:swagger_ui'
samfundet__redoc = 'samfundet:redoc'
samfundet__csrf = 'samfundet:csrf'
samfundet__login = 'samfundet:login'
samfundet__register = 'samfundet:register'
samfundet__logout = 'samfundet:logout'
samfundet__change_password = 'samfundet:change-password'
samfundet__user = 'samfundet:user'
samfundet__groups = 'samfundet:groups'
samfundet__users = 'samfundet:users'
Expand All @@ -575,6 +589,7 @@
samfundet__recruitment_positions = 'samfundet:recruitment_positions'
samfundet__recruitment_show_unprocessed_applicants = 'samfundet:recruitment_show_unprocessed_applicants'
samfundet__recruitment_positions_gang_for_applicants = 'samfundet:recruitment_positions_gang_for_applicants'
samfundet__recruitment_shared_interviews = 'samfundet:recruitment_shared_interviews'
samfundet__recruitment_positions_gang_for_gangs = 'samfundet:recruitment_positions_gang_for_gangs'
samfundet__recruitment_set_interview = 'samfundet:recruitment_set_interview'
samfundet__recruitment_application_states_choices = 'samfundet:recruitment_application_states_choices'
Expand All @@ -585,6 +600,7 @@
samfundet__recruitment_user_priority_update = 'samfundet:recruitment_user_priority_update'
samfundet__recruitment_withdraw_application_recruiter = 'samfundet:recruitment_withdraw_application_recruiter'
samfundet__active_recruitment_positions = 'samfundet:active_recruitment_positions'
samfundet__rejected_applicants = 'samfundet:rejected_applicants/'
samfundet__applicants_without_interviews = 'samfundet:applicants_without_interviews'
samfundet__applicants_without_three_interview_criteria = 'samfundet:applicants_without_three_interview_criteria'
samfundet__recruitment_recruiter_dashboard = 'samfundet:recruitment_recruiter_dashboard'
Expand All @@ -594,5 +610,6 @@
samfundet__recruitment_availability = 'samfundet:recruitment_availability'
samfundet__feedback = 'samfundet:feedback'
samfundet__purchase_feedback = 'samfundet:purchase_feedback'
samfundet__gang_application_stats = 'samfundet:gang-application-stats'
static__path = ''
media__path = ''
29 changes: 26 additions & 3 deletions backend/samfundet/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
RecruitmentApplication,
RecruitmentSeparatePosition,
RecruitmentInterviewAvailability,
RecruitmentPositionSharedInterviewGroup,
)

# Common fields:
Expand Down Expand Up @@ -170,17 +171,17 @@ class RoleAdmin(admin.ModelAdmin):

@admin.register(UserOrgRole)
class UserOrgRoleAdmin(admin.ModelAdmin):
list_display = ('user', 'role', 'obj')
list_display = ('user', 'role', 'obj', 'created_at', 'created_by')


@admin.register(UserGangRole)
class UserGangRoleAdmin(admin.ModelAdmin):
list_display = ('user', 'role', 'obj')
list_display = ('user', 'role', 'obj', 'created_at', 'created_by')


@admin.register(UserGangSectionRole)
class UserGangSectionRoleAdmin(admin.ModelAdmin):
list_display = ('user', 'role', 'obj')
list_display = ('user', 'role', 'obj', 'created_at', 'created_by')


@admin.register(Permission)
Expand Down Expand Up @@ -715,6 +716,28 @@ class RecruitmentApplicationAdmin(CustomBaseAdmin):
list_select_related = True


@admin.register(RecruitmentPositionSharedInterviewGroup)
class RecruitmentPositionSharedInterviewGroupAdmin(CustomBaseAdmin):
sortable_by = [
'recruitment',
'name_en',
'name_nb',
'__str__',
]
list_display = [
'recruitment',
'name_en',
'name_nb',
'__str__',
]
search_fields = [
'recruitment',
'name_en',
'name_nb',
'__str__',
]


@admin.register(Organization)
class OrganizationAdmin(CustomBaseAdmin):
sortable_by = ['id', 'name']
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.1.1 on 2024-10-25 12:46

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('samfundet', '0007_alter_infobox_color_alter_infobox_image_and_more'),
]

operations = [
migrations.AddField(
model_name='event',
name='entrance_en',
field=models.CharField(blank=True, max_length=140, null=True),
),
migrations.AddField(
model_name='event',
name='entrance_nb',
field=models.CharField(blank=True, max_length=140, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 5.1.1 on 2024-10-29 17:39

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("samfundet", "0008_event_entrance_en_event_entrance_nb"),
]

operations = [
migrations.AddField(
model_name="recruitmentpositionsharedinterviewgroup",
name="name_en",
field=models.CharField(
default="hi",
help_text="Name of the recruitmentgroup (EN)",
max_length=100,
),
preserve_default=False,
),
migrations.AddField(
model_name="recruitmentpositionsharedinterviewgroup",
name="name_nb",
field=models.CharField(
default="hi",
help_text="Name of the recruitmentgroup (NB)",
max_length=100,
),
preserve_default=False,
),
]
18 changes: 18 additions & 0 deletions backend/samfundet/migrations/0010_recruitment_promo_media.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.1 on 2024-10-31 19:56

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('samfundet', '0009_recruitmentpositionsharedinterviewgroup_name_en_and_more'),
]

operations = [
migrations.AddField(
model_name='recruitment',
name='promo_media',
field=models.CharField(blank=True, default=None, help_text='Youtube video id', max_length=11, null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 5.1.1 on 2024-12-07 12:20

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("samfundet", "0010_recruitment_promo_media"),
]

operations = [
migrations.AddField(
model_name="recruitmentposition",
name="file_description_en",
field=models.TextField(
blank=True, help_text="Description of file needed (EN)", null=True
),
),
migrations.AddField(
model_name="recruitmentposition",
name="file_description_nb",
field=models.TextField(
blank=True, help_text="Description of file needed (NB)", null=True
),
),
migrations.AddField(
model_name="recruitmentposition",
name="has_file_upload",
field=models.BooleanField(
default=False, help_text="Does position have file upload"
),
),
]
Loading

0 comments on commit 4845fa0

Please sign in to comment.