Skip to content

Commit

Permalink
Merge branch 'notifications' of github.com:SELab-2/UGent-7 into notif…
Browse files Browse the repository at this point in the history
…ications
  • Loading branch information
Topvennie committed Mar 6, 2024
2 parents 8bbd2ed + 854c451 commit d7ef235
Show file tree
Hide file tree
Showing 79 changed files with 3,819 additions and 706 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/backend-linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: backend-linting

on:
push:
branches: [main, development]
pull_request:
branches: [main, development]
workflow_dispatch:

jobs:
test:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r ./backend/requirements.txt
- name: Execute linting checks
run: flake8 --config ./backend/.flake8 ./backend
25 changes: 25 additions & 0 deletions .github/workflows/backend-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: backend-tests

on:
push:
branches: [main, development]
pull_request:
branches: [main, development]
workflow_dispatch:

jobs:
test:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r ./backend/requirements.txt
- name: Execute tests
run: cd backend; python manage.py test
Binary file added backend/.coverage
Binary file not shown.
15 changes: 15 additions & 0 deletions backend/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[flake8]

# Ignore unused imports
ignore = F401

max-line-length = 119

max-complexity = 10

exclude = .git,
__pycache__,
.venv,
venv,
migrations

10 changes: 7 additions & 3 deletions backend/api/apps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from django.apps import AppConfig


class ApiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'api'
default_auto_field = "django.db.models.BigAutoField"
name = "api"

def ready(self):
from . import signals
from authentication.signals import user_created
from api.signals import user_creation

user_created.connect(user_creation)
10 changes: 10 additions & 0 deletions backend/api/fixtures/assistants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- model: api.assistant
pk: '235'
fields:
courses:
- 1
- model: api.assistant
pk: '236'
fields:
courses:
- 2
26 changes: 26 additions & 0 deletions backend/api/fixtures/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- model: api.checks
pk: 1
fields:
dockerfile: 'path/to/Dockerfile'
allowed_file_extensions:
- 1
- 2
forbidden_file_extensions:
- 3
- 4
- model: api.fileextension
pk: 1
fields:
extension: 'py'
- model: api.fileextension
pk: 2
fields:
extension: 'js'
- model: api.fileextension
pk: 3
fields:
extension: 'html'
- model: api.fileextension
pk: 4
fields:
extension: 'php'
21 changes: 21 additions & 0 deletions backend/api/fixtures/courses.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- model: api.course
pk: 1
fields:
name: Math
academic_startyear: 2023
description: Math course
parent_course: null
- model: api.course
pk: 2
fields:
name: Sel2
academic_startyear: 2023
description: Software course
parent_course: 3
- model: api.course
pk: 3
fields:
name: Sel1
academic_startyear: 2022
description: Software course
parent_course: null
8 changes: 8 additions & 0 deletions backend/api/fixtures/groups.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- model: api.group
pk: 1
fields:
project: 123456
score: 7
students:
- '1'
- '2'
11 changes: 11 additions & 0 deletions backend/api/fixtures/projects.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- model: api.project
pk: 123456
fields:
name: sel2
description: make a project
visible: true
archived: false
start_date: 2024-02-26 00:00:00+00:00
deadline: 2024-02-27 00:00:00+00:00
checks: 1
course: 2
11 changes: 11 additions & 0 deletions backend/api/fixtures/students.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- model: api.student
pk: '1'
fields:
student_id: null
courses:
- 1
- model: api.student
pk: '2'
fields:
student_id: null
courses: []
24 changes: 24 additions & 0 deletions backend/api/fixtures/submissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- model: api.submission
pk: 1
fields:
group: 1
submission_number: 1
submission_time: '2021-01-01T00:00:00Z'
- model: api.submission
pk: 2
fields:
group: 1
submission_number: 2
submission_time: '2021-01-02T00:00:00Z'


- model: api.submissionfile
pk: 1
fields:
submission: 1
file: 'submissions/1/1/1.txt'
- model: api.submissionfile
pk: 2
fields:
submission: 2
file: 'submissions/1/2/1.txt'
11 changes: 11 additions & 0 deletions backend/api/fixtures/teachers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- model: api.teacher
pk: '123'
fields:
courses:
- 1
- model: api.teacher
pk: '124'
fields:
courses:
- 1
- 2
12 changes: 1 addition & 11 deletions backend/api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.0.2 on 2024-02-28 21:55
# Generated by Django 5.0.2 on 2024-03-05 14:25

import datetime
import django.db.models.deletion
Expand All @@ -15,16 +15,6 @@ class Migration(migrations.Migration):
]

operations = [
migrations.CreateModel(
name='Admin',
fields=[
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
bases=('authentication.user',),
),
migrations.CreateModel(
name='FileExtension',
fields=[
Expand Down
156 changes: 0 additions & 156 deletions backend/api/migrations/0002_populate.py

This file was deleted.

Loading

0 comments on commit d7ef235

Please sign in to comment.