Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy first version of the frontend #200

Merged
merged 245 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
245 commits
Select commit Hold shift + click to select a range
e1cfd08
chore: add extra tests coverage
tyboro2002 Mar 14, 2024
4f6039a
chore: added structure_check add tests
tyboro2002 Mar 14, 2024
cdd69cf
chore: added linting
tyboro2002 Mar 14, 2024
6a644a2
chore: course add teacher+student permission tests
BramMeir Mar 14, 2024
3fe5ede
chore: test create project and course
BramMeir Mar 14, 2024
a379b01
fix: error is project submissions
BramMeir Mar 14, 2024
cea4e7e
chore: extra tests
BramMeir Mar 14, 2024
c56c277
chore: some extra tests
BramMeir Mar 14, 2024
7f136b4
Merge pull request #111 from SELab-2/structure_tests
tyboro2002 Mar 15, 2024
863fbc1
Merge branch 'development' into extra_permission_tests
BramMeir Mar 15, 2024
79f7a4c
chore: little fixes
BramMeir Mar 15, 2024
b1cb2d3
Merge pull request #118 from SELab-2/extra_permission_tests
EwoutV Mar 15, 2024
d8cc1d0
chore: add serializers so swagger knows necessary fields
BramMeir Mar 17, 2024
334a163
chore: further clean up swagger documentation
BramMeir Mar 17, 2024
4b154ad
fix: extensions part of swagger doc
BramMeir Mar 17, 2024
dfcb236
chore: fix that swagger json is shown at api root
BramMeir Mar 17, 2024
141e2db
backend(api) chore: first set of changes to student_view permissions
DeLany123 Mar 17, 2024
023099b
backend(api) chore: updated student_premissions
DeLany123 Mar 17, 2024
f30ef17
chore: update assistant_permissions
DeLany123 Mar 18, 2024
8cb3bcc
chore: updating teacher_view
DeLany123 Mar 18, 2024
89ece45
build(deps): bump django from 5.0.2 to 5.0.3 in /backend
dependabot[bot] Mar 18, 2024
c76c210
chore: added necessary packages
EwoutV Mar 19, 2024
0a97027
chore: application scaffolding
EwoutV Mar 19, 2024
ea71161
chore: axios dependency
EwoutV Mar 19, 2024
f307722
chore: dashboard example component
EwoutV Mar 19, 2024
9fd55a2
Merge pull request #126 from SELab-2/dependabot/pip/backend/django-5.0.3
EwoutV Mar 19, 2024
61321d6
fix: header translation
EwoutV Mar 19, 2024
c4b30c8
feat: custom theme
EwoutV Mar 20, 2024
eb7f30f
feat: basic layout with localization support
EwoutV Mar 20, 2024
6da1cd8
feat: dashboard layout (wip)
EwoutV Mar 20, 2024
534b47a
Merge pull request #129 from SELab-2/frontend-scaffold
DeLany123 Mar 20, 2024
23935f1
Merge pull request #130 from SELab-2/base-layout
DeLany123 Mar 20, 2024
01fb98d
fix: znoe identifiers
EwoutV Mar 20, 2024
3284c53
Merge pull request #132 from SELab-2/base-layout
tyboro2002 Mar 20, 2024
3600035
fix: hot reloading in development docker
EwoutV Mar 20, 2024
573bf7a
fix: data dir error
EwoutV Mar 20, 2024
564ebeb
chore: linting
EwoutV Mar 20, 2024
7f12670
chore: reverted DATADIR to DATA_DIR
EwoutV Mar 20, 2024
db5bcd2
feat: router link examples
EwoutV Mar 21, 2024
3f3be32
feat: service example with real data
EwoutV Mar 21, 2024
30d7c6b
chore: removed redundant routes
EwoutV Mar 21, 2024
cb5289b
feat: login component
EwoutV Mar 21, 2024
a4f52d0
Merge pull request #139 from SELab-2/login-component
DeLany123 Mar 21, 2024
88bf6c5
Merge branch 'development' into api_cleanup
BramMeir Mar 21, 2024
25fe026
chore: add student service
tyboro2002 Mar 21, 2024
636bc90
chore: add faculty and teacher services
tyboro2002 Mar 21, 2024
5efd926
chore: rework listing fields to __all__ in serializers
BramMeir Mar 21, 2024
fe1328f
Merge pull request #144 from SELab-2/api_cleanup
EwoutV Mar 21, 2024
4efcda8
Merge branch 'development' of https://github.com/SELab-2/UGent-7 into…
tyboro2002 Mar 21, 2024
da3b996
chore:completed teacher service scaffolding
tyboro2002 Mar 21, 2024
4b8df18
chore:completed teacher service scaffolding
tyboro2002 Mar 21, 2024
ada1663
chore: added admin service and fixed some things in teacher and stude…
tyboro2002 Mar 21, 2024
1bb063f
chore: add assistant service
tyboro2002 Mar 21, 2024
558aa56
feat(deployment): frontend hmr
Topvennie Mar 22, 2024
65cd4f6
chore: testing if courses service works + adding all course service
tyboro2002 Mar 22, 2024
25cf971
Merge branch 'services' of https://github.com/SELab-2/UGent-7 into se…
tyboro2002 Mar 22, 2024
818b032
fix: error with adding assistants to cloned course
BramMeir Mar 22, 2024
944222b
chore: make dashboard display courses from api
tyboro2002 Mar 22, 2024
12bc8de
chore: add project type
tyboro2002 Mar 22, 2024
0377726
chore: add project service
tyboro2002 Mar 22, 2024
61f1151
chore: add submision service
tyboro2002 Mar 22, 2024
e94010a
chore: parameter number_of_groups when project created + individual p…
BramMeir Mar 22, 2024
bb5478d
chore: add structure_check service
tyboro2002 Mar 22, 2024
5b101d6
chore: add all admins service
tyboro2002 Mar 22, 2024
fe6368b
chore: add all assistants service
tyboro2002 Mar 22, 2024
e8ba1a9
chore: add all assistants service
tyboro2002 Mar 22, 2024
d69d6eb
chore: add all teachers service
tyboro2002 Mar 22, 2024
e114d4e
chore: add all facultys service
tyboro2002 Mar 22, 2024
5561720
chore: add projects by date course service
tyboro2002 Mar 22, 2024
c9b5187
chore: init route to calendar
BramMeir Mar 22, 2024
59d9095
fix: fix comments of bram
tyboro2002 Mar 22, 2024
5491f2a
Merge pull request #147 from SELab-2/services
tyboro2002 Mar 22, 2024
c6dce82
Merge branch 'development' into calendar_view
BramMeir Mar 22, 2024
b1395d1
add vitest and `npm run test` to possible commands
bsilkyn Mar 22, 2024
100085b
test: add a simple vitest test testing Course getCourseYear function …
bsilkyn Mar 22, 2024
5c1a8c0
chore: add cypress ass dev package #153
bsilkyn Mar 22, 2024
1274022
chore: able to open cypress with `npm run cypress:open` #153
bsilkyn Mar 22, 2024
2f56cfa
test: adjust import path #153
bsilkyn Mar 22, 2024
b171fef
chore: cleanup services with get and getList function
tyboro2002 Mar 22, 2024
1e90028
chore: add errors
tyboro2002 Mar 22, 2024
84ee930
chore: removed succes message
tyboro2002 Mar 22, 2024
6e4af72
Merge pull request #156 from SELab-2/services
BramMeir Mar 22, 2024
f1f29cd
Merge pull request #151 from SELab-2/api_updates
tyboro2002 Mar 22, 2024
1d3eb43
chore: display calendar + selected date + translations
BramMeir Mar 22, 2024
dd29d9d
Merge branch 'development' into calendar_view
BramMeir Mar 22, 2024
3e95438
chore: placeholder component
francisvaut Mar 23, 2024
098b4f8
chore: router abstraction
francisvaut Mar 23, 2024
f7f25c1
chore: page not found
francisvaut Mar 23, 2024
a25462a
chore: routes structure
francisvaut Mar 23, 2024
3c3b198
chore: fix primevue components follow locale change
BramMeir Mar 23, 2024
65ef96e
feat(deployement): delete .env file for -c
Topvennie Mar 23, 2024
a7c77bc
chore: cleanup services
tyboro2002 Mar 23, 2024
1866c01
fix: typo
francisvaut Mar 23, 2024
cdf8b6a
Merge branch 'development' of https://github.com/SELab-2/UGent-7 into…
tyboro2002 Mar 23, 2024
53d6d8b
chore: change deployment branch
Topvennie Mar 23, 2024
f442e33
chore: add submision status service
tyboro2002 Mar 23, 2024
0508a7e
chore: add all projects of student service
tyboro2002 Mar 23, 2024
a71a793
fix: fix typo
tyboro2002 Mar 23, 2024
60de32a
Merge pull request #158 from SELab-2/services
BramMeir Mar 23, 2024
0f3319a
Merge branch 'development' into calendar_view
BramMeir Mar 23, 2024
c6d4f1b
fix: merge conflicts
francisvaut Mar 23, 2024
2699998
chore: remove page not found component
francisvaut Mar 23, 2024
d721170
add vitest and `npm run test` to possible commands
bsilkyn Mar 22, 2024
9bfb894
test: add a simple vitest test testing Course getCourseYear function …
bsilkyn Mar 22, 2024
b87c322
chore: add cypress ass dev package #153
bsilkyn Mar 22, 2024
eb2caf6
chore: able to open cypress with `npm run cypress:open` #153
bsilkyn Mar 22, 2024
c095153
test: adjust import path #153
bsilkyn Mar 22, 2024
393eee1
test: add command to run cypress tests: `npm run cypress:test` #153
bsilkyn Mar 23, 2024
7d013e8
chore: remove package-lock.json from github repository #153
bsilkyn Mar 23, 2024
3fb6873
chore: projectview init
DeLany123 Mar 23, 2024
ad9e570
feat: hmr for windows
Topvennie Mar 23, 2024
d589cdc
test: add commentary to vitest test to explain how vitest should be u…
bsilkyn Mar 23, 2024
7f6e59f
test: add cypress test with commentary that explains how it works #153
bsilkyn Mar 23, 2024
c647e4b
Merge branch 'development' into project_view
DeLany123 Mar 23, 2024
3c7795d
chore: merge #153
bsilkyn Mar 23, 2024
c97c882
chore: try to remove package-lock.json #153
bsilkyn Mar 23, 2024
4ddee95
Revert "feat: hmr for windows"
Topvennie Mar 23, 2024
e0df988
chore: start with projects loading
BramMeir Mar 23, 2024
b67c7ed
chore: fetching projects in dashboard
DeLany123 Mar 23, 2024
987c1a2
chore: navigation guard
francisvaut Mar 23, 2024
34919d0
fix: swagger in production
Topvennie Mar 23, 2024
1f182f1
chore: change default output to frontend and backend
Topvennie Mar 23, 2024
4bad27f
chore: change branch to main
Topvennie Mar 23, 2024
72a0b90
chore: undo redirect from navigation guard
francisvaut Mar 23, 2024
a1deba2
Merge branch 'development' into routes
francisvaut Mar 23, 2024
180f240
fix: fix services not waiting
tyboro2002 Mar 23, 2024
20bf8bd
Merge pull request #161 from SELab-2/calendar_view
tyboro2002 Mar 23, 2024
2e28ceb
fix: merge conflicts
francisvaut Mar 23, 2024
bfab65d
Merge pull request #160 from SELab-2/routes
francisvaut Mar 23, 2024
5b4e215
fix: course route
BramMeir Mar 23, 2024
f7eb7c2
Merge pull request #162 from SELab-2/routes-fix
tyboro2002 Mar 23, 2024
73ab2ac
fix: duplicate route param names
francisvaut Mar 24, 2024
6651f0b
Merge pull request #163 from SELab-2/hotfix
francisvaut Mar 24, 2024
67f140d
test: create test directory in src and refactor all test file to go i…
bsilkyn Mar 24, 2024
87cdf4a
add vitest and `npm run test` to possible commands
bsilkyn Mar 22, 2024
1d22315
test: add a simple vitest test testing Course getCourseYear function …
bsilkyn Mar 22, 2024
137af5e
chore: add cypress as dev package #153
bsilkyn Mar 22, 2024
938bd72
chore: able to open cypress with `npm run cypress:open` #153
bsilkyn Mar 22, 2024
0b2310b
test: adjust import path #153
bsilkyn Mar 22, 2024
504e18c
test: add command to run cypress tests: `npm run cypress:test` #153
bsilkyn Mar 23, 2024
cc8fd33
chore: remove package-lock.json from github repository #153
bsilkyn Mar 23, 2024
ac4d019
test: add commentary to vitest test to explain how vitest should be u…
bsilkyn Mar 23, 2024
99afec4
test: add cypress test with commentary that explains how it works #153
bsilkyn Mar 23, 2024
eef5c74
add vitest and `npm run test` to possible commands
bsilkyn Mar 22, 2024
c11b0ba
test: create test directory in src and refactor all test file to go i…
bsilkyn Mar 24, 2024
11f6de0
fix: courseId naming
francisvaut Mar 24, 2024
d903783
Merge branch 'vitest-cypress-add' of gitsel2:SELab-2/UGent-7 into vit…
bsilkyn Mar 24, 2024
3d6e64f
Merge pull request #164 from SELab-2/fix-courseId
tyboro2002 Mar 24, 2024
1462c23
add vitest and `npm run test` to possible commands
bsilkyn Mar 22, 2024
d6d9a0c
test: add a simple vitest test testing Course getCourseYear function …
bsilkyn Mar 22, 2024
763da90
chore: add cypress as dev package #153
bsilkyn Mar 22, 2024
714c1c5
chore: able to open cypress with `npm run cypress:open` #153
bsilkyn Mar 22, 2024
4982365
test: adjust import path #153
bsilkyn Mar 22, 2024
15dfb22
test: add command to run cypress tests: `npm run cypress:test` #153
bsilkyn Mar 23, 2024
c40fb87
chore: remove package-lock.json from github repository #153
bsilkyn Mar 23, 2024
832c539
test: add commentary to vitest test to explain how vitest should be u…
bsilkyn Mar 23, 2024
fef76dd
test: add cypress test with commentary that explains how it works #153
bsilkyn Mar 23, 2024
e0ea5a6
add vitest and `npm run test` to possible commands
bsilkyn Mar 22, 2024
22b0e82
test: create test directory in src and refactor all test file to go i…
bsilkyn Mar 24, 2024
d4efeb2
test: add a simple vitest test testing Course getCourseYear function …
bsilkyn Mar 22, 2024
b98122e
test: adjust import path #153
bsilkyn Mar 22, 2024
ceb4219
test: add commentary to vitest test to explain how vitest should be u…
bsilkyn Mar 23, 2024
3280a3a
test: add cypress test with commentary that explains how it works #153
bsilkyn Mar 23, 2024
13c8d00
test: create test directory in src and refactor all test file to go i…
bsilkyn Mar 24, 2024
a7790cf
Merge branch 'vitest-cypress-add' of gitsel2:SELab-2/UGent-7 into vit…
bsilkyn Mar 24, 2024
a6b830a
fix: course view
francisvaut Mar 24, 2024
54e2614
Merge pull request #165 from SELab-2/hotfix
francisvaut Mar 24, 2024
4207ac7
Merge branch 'development' into vitest-cypress-add
bsilkyn Mar 24, 2024
2839a02
Merge branch 'development' into deployment
Topvennie Mar 24, 2024
237d00b
chore: new package-lock.json file #153
bsilkyn Mar 24, 2024
18c8b47
chore: remove unneeded file #153
bsilkyn Mar 24, 2024
66a24e0
Merge pull request #150 from SELab-2/deployement_hmr
francisvaut Mar 24, 2024
d69fdbd
Merge pull request #159 from SELab-2/deployment
francisvaut Mar 24, 2024
0fae1db
Merge pull request #155 from SELab-2/vitest-cypress-add
tyboro2002 Mar 24, 2024
3cdac7f
Merge branch 'development' into project_view
DeLany123 Mar 24, 2024
75c703a
fix: add moment again
BramMeir Mar 24, 2024
9a165dc
chore: fetching projects in dashboard 2
DeLany123 Mar 24, 2024
8b8a16e
Merge pull request #166 from SELab-2/fix_moment_import
DeLany123 Mar 24, 2024
24b1b31
Merge branch 'development' into project_view
DeLany123 Mar 24, 2024
8c782e2
chore: fetching projects with course context
DeLany123 Mar 24, 2024
768e112
chore: add student join course and create course service
tyboro2002 Mar 24, 2024
dae3aae
chore: add delete course and student by course service added
tyboro2002 Mar 24, 2024
5f51f29
chore: add ProjectCard.vue
DeLany123 Mar 24, 2024
f18a5cd
chore: create and delete (course, assistant, project, admin) services…
tyboro2002 Mar 25, 2024
da63342
chore: faculty, groups, students create and delete services added
tyboro2002 Mar 25, 2024
aced180
chore: teachers create and delete services added
tyboro2002 Mar 25, 2024
a6c92b8
chore: structure_checks create and delete services added
tyboro2002 Mar 25, 2024
6f5e326
chore: submission create and delete services added
tyboro2002 Mar 25, 2024
73ed0c6
chore: add ProjectDetails in ProjectView.vue #168
DeLany123 Mar 25, 2024
0603a61
chore: translations of errors #149
bsilkyn Mar 25, 2024
916a4f1
chore: ComposerTranslation object gets passed through service functio…
bsilkyn Mar 25, 2024
7e662cb
chore: ComposerTranslation object gets passed through service functio…
bsilkyn Mar 25, 2024
f6efa3e
chore: remove unnecessary translation #149
bsilkyn Mar 25, 2024
4d08e68
chore: added some extra services
tyboro2002 Mar 25, 2024
e3dcc25
chore: removed console.log's
tyboro2002 Mar 25, 2024
14e2b92
chore: make all id's strings to work with 0 prefixed values
tyboro2002 Mar 25, 2024
147b1a8
chore: add clone course service
tyboro2002 Mar 25, 2024
c7bdde9
chore: did some cleanup
tyboro2002 Mar 25, 2024
97c58cb
Merge pull request #174 from SELab-2/services
DeLany123 Mar 26, 2024
1b68d59
chore: add leave services
tyboro2002 Mar 27, 2024
1781998
Merge branch 'development' of github.com:SELab-2/UGent-7 into services
tyboro2002 Mar 27, 2024
6412b96
Merge branch 'development' into helper-error-translate
tyboro2002 Mar 27, 2024
696a365
Merge pull request #175 from SELab-2/helper-error-translate
tyboro2002 Mar 27, 2024
1420c06
Merge branch 'development' of github.com:SELab-2/UGent-7 into services
tyboro2002 Mar 27, 2024
f34fcfc
chore: test cleanup later
tyboro2002 Mar 27, 2024
7ed4f6d
chore: tested + cleanup prev commit
tyboro2002 Mar 27, 2024
ddf2bf8
chore: removed commented imports
tyboro2002 Mar 27, 2024
99a4d7a
chore: cleanup
tyboro2002 Mar 27, 2024
96b9da4
fix: removed ,,
tyboro2002 Mar 27, 2024
ba55d2a
fix: dev issues
BramMeir Mar 27, 2024
abcecb0
Merge branch 'development' of github.com:SELab-2/UGent-7 into services
tyboro2002 Mar 27, 2024
b81442b
chore: make id's strings
tyboro2002 Mar 27, 2024
0e5038c
Merge pull request #179 from SELab-2/services
DeLany123 Mar 27, 2024
1859ece
feat: (wip) authentication
EwoutV Mar 26, 2024
2c5b0b2
feat: authentication
EwoutV Mar 27, 2024
cc3e6c6
chore: backend logout route improvement
EwoutV Mar 27, 2024
d3d0c79
chore: updated settings.py
EwoutV Mar 27, 2024
ea69c72
fix: token endpoints
EwoutV Mar 27, 2024
15f91f8
chore: added translations
EwoutV Mar 27, 2024
0c82f91
chore: fadeé
EwoutV Mar 27, 2024
f71ee82
fix: backend logout test
EwoutV Mar 27, 2024
a7eccbc
Merge pull request #181 from SELab-2/pinia-auth
tyboro2002 Mar 27, 2024
c6db537
chore: changing the way projects are fetched + linting
DeLany123 Mar 27, 2024
7c0d3c0
Merge branch 'development' into project_view
DeLany123 Mar 27, 2024
394455d
chore: make helpers use axios from ewout
tyboro2002 Mar 27, 2024
4d3cd5f
chore: mergeconflict in #182
DeLany123 Mar 27, 2024
c2a741a
Merge branch 'development' into permissions_cleanup
DeLany123 Mar 27, 2024
744f994
fix: linting errors on #131
DeLany123 Mar 27, 2024
b227759
chore: removed toast arguments to services and made functions await
tyboro2002 Mar 27, 2024
d92ec36
chore: removed the translation argument
tyboro2002 Mar 27, 2024
bc0e90a
chore: make creates take a data:T as argument instead of data:any to …
tyboro2002 Mar 27, 2024
af54410
chore: Implemented GroupCard.vue closes #178
DeLany123 Mar 28, 2024
b364bf7
fix: made tests succeed by replacing the int id with the string id
tyboro2002 Mar 28, 2024
a409d3c
Merge pull request #183 from SELab-2/services
DeLany123 Mar 28, 2024
dea3159
cleanup for #131
DeLany123 Mar 29, 2024
2961b4f
chore: merged for #182
DeLany123 Mar 29, 2024
02bb337
chore: little fix for #182
DeLany123 Mar 29, 2024
47d6377
Merge pull request #131 from SELab-2/permissions_cleanup
BramMeir Mar 29, 2024
4c6e732
Merge pull request #182 from SELab-2/project_view
tyboro2002 Mar 29, 2024
cd753d1
feat: role selector, language persistence
EwoutV Mar 29, 2024
bea24c0
chore: rebase
EwoutV Mar 29, 2024
39321ab
fix: improved user creation process
EwoutV Mar 29, 2024
83739cc
chore: cleaned up the dashboard view
EwoutV Mar 29, 2024
c437297
chore: linting
EwoutV Mar 29, 2024
f9c2070
Merge pull request #192 from SELab-2/pinia-auth
BramMeir Mar 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ DJANGO_CAS_URL_PREFIX="" # URL prefix for the CAS server. Should be empty for de
DJANGO_CAS_PORT=8080 # Port for the CAS server. Should be 8080 if DJANGO_DOMAIN_NAME is localhost
DJANGO_DB_ENGINE=django.db.backends.sqlite3 # Database engine
DJANGO_REDIS_HOST=${REDIS_IP} # Redis configuration
DJANGO_REDIS_PORT=${REDIS_PORT}
DJANGO_REDIS_PORT=${REDIS_PORT}
2 changes: 1 addition & 1 deletion .github/workflows/deployement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
script: |
cd UGent-7
docker-compose -f production.yml down
${{ secrets.PULL_SCRIPT }}
git pull
docker-compose -f production.yml build --no-cache
docker-compose -f production.yml up -d
2 changes: 1 addition & 1 deletion .prod.env
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ DJANGO_DB_PASSWORD=${POSTGRES_PASSWORD}
DJANGO_DB_HOST=${POSTGRES_IP}
DJANGO_DB_PORT=${POSTGRES_PORT}
DJANGO_REDIS_HOST=${REDIS_IP} # Redis configuration
DJANGO_REDIS_PORT=${REDIS_PORT}
DJANGO_REDIS_PORT=${REDIS_PORT}
Binary file modified backend/.coverage
Binary file not shown.
5 changes: 4 additions & 1 deletion backend/api/fixtures/groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
fields:
project: 1
score: 8
students: []
students:
- '1'
- '2'
- '3'
9 changes: 8 additions & 1 deletion backend/api/fixtures/students.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@
pk: '2'
fields:
student_id: null
courses: []
courses:
- 1
- model: api.student
pk: '3'
fields:
student_id: null
courses:
- 1
6 changes: 4 additions & 2 deletions backend/api/models/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ def is_past(self) -> bool:

def clone(self, clone_assistants=True) -> Self:
"""Clone the course to the next academic start year"""
course = Course(
course = Course.objects.create(
name=self.name,
description=self.description,
academic_startyear=self.academic_startyear + 1,
parent_course=self
)

if clone_assistants:
course.assistants.add(self.assistants)
# Add all the assistants of the current course to the follow-up course
for assistant in self.assistants.all():
course.assistants.add(assistant)

return course

Expand Down
2 changes: 1 addition & 1 deletion backend/api/permissions/assistant_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def has_permission(self, request: Request, view: ViewSet) -> bool:
"""Check if user has permission to view a general assistant endpoint."""
user = request.user

if view.action == "list":
if view.action in ['list', 'create', 'destroy']:
# Only teachers can query the assistant list.
return user.is_authenticated and is_teacher(user)

Expand Down
16 changes: 0 additions & 16 deletions backend/api/permissions/course_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,3 @@ def has_object_permission(self, request: Request, view: ViewSet, course: Course)

# Teachers and assistants can add and remove any student.
return super().has_object_permission(request, view, course)


class CourseProjectPermission(CoursePermission):
"""Permission class for project related endpoints."""
def has_permission(self, request: Request, view: ViewSet) -> bool:
return request.user and request.user.is_authenticated

def has_object_permission(self, request: Request, view: ViewSet, course: Course):
user: User = request.user

# Logged-in users can fetch course projects.
if request.method in SAFE_METHODS:
return user.is_authenticated

# Teachers and assistants can modify projects.
return super().has_object_permission(request, view, course)
15 changes: 15 additions & 0 deletions backend/api/permissions/student_permissions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from rest_framework.permissions import IsAuthenticated, SAFE_METHODS
from api.permissions.role_permissions import is_teacher
from authentication.models import User


class StudentPermission(IsAuthenticated):

def has_permission(self, request, view):
"""Check if user has permission to view a general student endpoint."""
return view.action == 'retrieve'

def has_object_permission(self, request, view, obj):
"""Check if user has permission to view a detailed group endpoint"""
user: User = request.user
return request.method in SAFE_METHODS and (user.id == request.user.id or is_teacher(user))
15 changes: 15 additions & 0 deletions backend/api/permissions/teacher_permissions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from rest_framework.permissions import IsAuthenticated, SAFE_METHODS
from authentication.models import User


# (Almost) same as StudentPermission
class TeacherPermission(IsAuthenticated):

def has_permission(self, request, view):
"""Check if user has permission to view a general Teacher endpoint."""
return view.action == 'retrieve'

def has_object_permission(self, request, view, obj):
"""Check if user has permission to view a detailed group endpoint"""
user: User = request.user
return request.method in SAFE_METHODS and user.id == request.user.id
11 changes: 1 addition & 10 deletions backend/api/serializers/assistant_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@ class AssistantSerializer(serializers.ModelSerializer):

class Meta:
model = Assistant
fields = [
"id",
"first_name",
"last_name",
"email",
"faculties",
"last_enrolled",
"create_time",
"courses",
]
fields = "__all__"


class AssistantIDSerializer(serializers.Serializer):
Expand Down
12 changes: 3 additions & 9 deletions backend/api/serializers/checks_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,13 @@ class StructureCheckSerializer(serializers.ModelSerializer):
read_only=True
)

obligated_extensions = FileExtensionSerializer(many=True, required=False, default=[], read_only=True)
obligated_extensions = FileExtensionSerializer(many=True, required=False, default=[])

blocked_extensions = FileExtensionSerializer(many=True, required=False, default=[], read_only=True)
blocked_extensions = FileExtensionSerializer(many=True, required=False, default=[])

class Meta:
model = StructureCheck
fields = [
"id",
"name",
"project",
"obligated_extensions",
"blocked_extensions"
]
fields = "__all__"


class ExtraCheckSerializer(serializers.ModelSerializer):
Expand Down
16 changes: 5 additions & 11 deletions backend/api/serializers/course_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,7 @@ class CourseSerializer(serializers.ModelSerializer):

class Meta:
model = Course
fields = [
"id",
"name",
"academic_startyear",
"description",
"parent_course",
"teachers",
"assistants",
"students",
"projects",
]
fields = "__all__"


class CourseIDSerializer(serializers.Serializer):
Expand All @@ -51,6 +41,10 @@ class CourseIDSerializer(serializers.Serializer):
)


class CourseCloneSerializer(serializers.Serializer):
clone_assistants = serializers.BooleanField()


class StudentJoinSerializer(StudentIDSerializer):
def validate(self, data):
# The validator needs the course context.
Expand Down
2 changes: 1 addition & 1 deletion backend/api/serializers/faculty_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
class facultySerializer(serializers.ModelSerializer):
class Meta:
model = Faculty
fields = ["name"]
fields = "__all__"
2 changes: 1 addition & 1 deletion backend/api/serializers/group_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GroupSerializer(serializers.ModelSerializer):

class Meta:
model = Group
fields = ["id", "project", "students", "score", "submissions"]
fields = "__all__"

def to_representation(self, instance):
data = super().to_representation(instance)
Expand Down
56 changes: 34 additions & 22 deletions backend/api/serializers/project_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
from api.models.group import Group
from rest_framework.exceptions import ValidationError
from django.utils import timezone
from api.models.submission import Submission, SubmissionFile
from api.models.checks import FileExtension, StructureCheck
from api.models.checks import FileExtension
from api.serializers.submission_serializer import SubmissionSerializer
from api.serializers.checks_serializer import StructureCheckSerializer
from rest_framework.request import Request


class ProjectSerializer(serializers.ModelSerializer):
Expand All @@ -33,24 +31,14 @@ class ProjectSerializer(serializers.ModelSerializer):
read_only=True
)

submissions = serializers.HyperlinkedIdentityField(
view_name="project-submissions",
read_only=True
)

class Meta:
model = Project
fields = [
"id",
"name",
"description",
"visible",
"archived",
"start_date",
"deadline",
"max_score",
"score_visible",
"group_size",
"structure_checks",
"extra_checks",
"course",
"groups"
]
fields = "__all__"

def validate(self, data):
if "course" in self.context:
Expand All @@ -69,12 +57,36 @@ def validate(self, data):
return data


class CreateProjectSerializer(ProjectSerializer):
number_groups = serializers.IntegerField(min_value=1, required=False)

def create(self, validated_data):
# Pop the 'number_groups' field from validated_data
number_groups = validated_data.pop('number_groups', None)

# Create the project object without passing 'number_groups' field
project = super().create(validated_data)

# Create groups for the project, if specified
if number_groups is not None:

for _ in range(number_groups):
Group.objects.create(project=project)

elif project.group_size == 1:
# If the group_size is set to one, create a group for each student
students = project.course.students.all()

for student in students:
group = Group.objects.create(project=project)
group.students.add(student)

return project


class TeacherCreateGroupSerializer(serializers.Serializer):
number_groups = serializers.IntegerField(min_value=1)

def validate(self, data):
return data


class SubmissionStatusSerializer(serializers.Serializer):
non_empty_groups = serializers.IntegerField(read_only=True)
Expand Down
10 changes: 1 addition & 9 deletions backend/api/serializers/submission_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,7 @@ class SubmissionSerializer(serializers.ModelSerializer):

class Meta:
model = Submission
fields = [
"id",
"group",
"submission_number",
"submission_time",
"files",
"structure_checks_passed",
"extra_checks_results"
]
fields = "__all__"
extra_kwargs = {
"submission_number": {
"required": False,
Expand Down
11 changes: 1 addition & 10 deletions backend/api/serializers/teacher_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,4 @@ class TeacherSerializer(serializers.ModelSerializer):

class Meta:
model = Teacher
fields = [
"id",
"first_name",
"last_name",
"email",
"faculties",
"last_enrolled",
"create_time",
"courses",
]
fields = "__all__"
42 changes: 42 additions & 0 deletions backend/api/tests/test_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.urls import reverse
from rest_framework.test import APITestCase
from api.models.assistant import Assistant
from api.models.teacher import Teacher
from api.models.course import Course
from authentication.models import Faculty, User

Expand Down Expand Up @@ -287,3 +288,44 @@ def test_assistant_courses(self):
self.assertEqual(content["name"], course2.name)
self.assertEqual(int(content["academic_startyear"]), course2.academic_startyear)
self.assertEqual(content["description"], course2.description)


class AssitantModelAsTeacherTests(APITestCase):
def setUp(self) -> None:
self.user = Teacher.objects.create(
id=1,
first_name="John",
last_name="Doe",
username="john_doe",
email="[email protected]"
)

self.client.force_authenticate(self.user)

def test_retrieve_assistant_list(self):
"""
Able to retrieve assistant list as a teacher.
"""
# Create an assistant for testing with the name "Bob Peeters"
create_assistant(
id=5, first_name="Bob", last_name="Peeters", email="[email protected]"
)

create_assistant(
id=6, first_name="Jane", last_name="Doe", email="[email protected]"
)

# Make a GET request to retrieve the assistant details
response = self.client.get(reverse("assistant-list"), follow=True)

# Check if the response was successful
self.assertEqual(response.status_code, 200)

# Assert that the response is JSON
self.assertEqual(response.accepted_media_type, "application/json")

# Parse the JSON content from the response
content_json = json.loads(response.content.decode("utf-8"))

# Assert that the parsed JSON is a list with multiple assistant
self.assertEqual(len(content_json), 2)
Loading
Loading