Merge branch 'dev' into feat/leerpad-object-routes
This commit is contained in:
		
						commit
						0c7f5791ea
					
				
					 103 changed files with 3760 additions and 12087 deletions
				
			
		
							
								
								
									
										28
									
								
								.github/PULL_REQUEST_TEMPLATE.md
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.github/PULL_REQUEST_TEMPLATE.md
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | ||||||
|  | <!-- Beschrijf wat deze pull request doet. Voeg een samenvatting van de wijzigingen en de reden voor de wijzigingen toe. --> | ||||||
|  | 
 | ||||||
|  | ## Context | ||||||
|  | 
 | ||||||
|  | <!-- Geef extra context en uitleg waarom bepaalde keuzes zijn gemaakt in deze pull request. --> | ||||||
|  | 
 | ||||||
|  | ## Screenshots | ||||||
|  | 
 | ||||||
|  | <!-- Voeg indien van toepassing screenshots toe om je wijzigingen uit te leggen. --> | ||||||
|  | 
 | ||||||
|  | ## Aanvullende opmerkingen | ||||||
|  | 
 | ||||||
|  | <!-- Voeg eventuele andere informatie toe waarvan reviewers op de hoogte moeten zijn. --> | ||||||
|  | 
 | ||||||
|  | <!-- Lijst eventuele gerelateerde issues. Gebruik het formaat `Fixes #<issue_number>` om het issue automatisch te sluiten wanneer de PR wordt gemerged. --> | ||||||
|  | - Fixes # | ||||||
|  | 
 | ||||||
|  | <!-- | ||||||
|  | ## Richtlijnen | ||||||
|  | 
 | ||||||
|  | Zorg ervoor dat het volgende in orde is voordat je de pull request indient: | ||||||
|  | 
 | ||||||
|  | - De code volgt de stijlrichtlijnen van dit project. | ||||||
|  | - Je hebt een zelfreview van de code uitgevoerd. | ||||||
|  | - Je hebt de documentatie bijgewerkt waar nodig. | ||||||
|  | - Alle nieuwe en bestaande unittests slagen (lokaal). | ||||||
|  | - Je hebt de juiste labels ingesteld op deze pull request. | ||||||
|  | --> | ||||||
							
								
								
									
										4
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -43,6 +43,9 @@ build/Release | ||||||
| node_modules/ | node_modules/ | ||||||
| jspm_packages/ | jspm_packages/ | ||||||
| 
 | 
 | ||||||
|  | # package-lock.json | ||||||
|  | backend/package-lock.json | ||||||
|  | 
 | ||||||
| # Snowpack dependency directory (https://snowpack.dev/) | # Snowpack dependency directory (https://snowpack.dev/) | ||||||
| web_modules/ | web_modules/ | ||||||
| 
 | 
 | ||||||
|  | @ -643,6 +646,7 @@ FodyWeavers.xsd | ||||||
| # Icon must end with two \r | # Icon must end with two \r | ||||||
| Icon | Icon | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| # Thumbnails | # Thumbnails | ||||||
| ._* | ._* | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										104
									
								
								CONTRIBUTING.md
									
										
									
									
									
								
							
							
						
						
									
										104
									
								
								CONTRIBUTING.md
									
										
									
									
									
								
							|  | @ -1,40 +1,67 @@ | ||||||
| # Hoe bijdragen aan Dwengo-1? | # Hoe bijdragen aan Dwengo-1? | ||||||
| 
 | 
 | ||||||
|  | Bedankt dat je wil bijdragen aan Dwengo-1! | ||||||
|  | Hieronder vind je enkele richtlijnen om je op weg te helpen. | ||||||
|  | 
 | ||||||
|  | Over het algemeen bestaat de workflow uit de volgende stappen: | ||||||
|  | 
 | ||||||
|  | 1. [Een issue aanmaken](#issues) | ||||||
|  | 2. [Een branch maken](#workflow) | ||||||
|  | 3. [Code schrijven](#coding-conventions) | ||||||
|  | 4. [Werk committen](#commits) | ||||||
|  | 5. [Een pull request maken](#pull-request) | ||||||
|  | 
 | ||||||
| ## Issues | ## Issues | ||||||
| 
 | 
 | ||||||
| Maak gebruik van de [label set](https://github.com/SELab-2/Dwengo-1/labels). | Als je een issue aanmaakt is het belangrijk om zo veel mogelijk (relevante) informatie te geven. | ||||||
|  | Om je op weg te helpen zijn er [templates](.github/ISSUE_TEMPLATE) voorzien. | ||||||
|  | Gebruik deze om alle nodige informatie te verzamelen. | ||||||
| 
 | 
 | ||||||
| Voor bug reports: | Gebruik de juiste [labels](https://github.com/SELab-2/Dwengo-1/labels) om te helpen een onderscheid te maken tussen verschillende categorieën issues. | ||||||
| 
 | 
 | ||||||
| Geef zo veel mogelijk informatie. Als er error berichten zijn, graag in tekst bijvoegen. Geen screenshots van error | Ken jezelf toe aan een issue als je eraan werkt, zodat er beter een overzicht bewaard kan worden. | ||||||
| messages, enkel van visuele bugs. | Op die manier vermijd je onnodig werk. | ||||||
| 
 |  | ||||||
| Ken jezelf toe aan een issue als je eraan werkt, zodat iedereen een overzicht heeft van waar aan gewerkt wordt en door |  | ||||||
| wie. Zo wordt onnodig werk vermeden. |  | ||||||
| 
 | 
 | ||||||
| ## Workflow | ## Workflow | ||||||
| 
 | 
 | ||||||
| We zullen [Gitflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) gebruiken | Dit project maakt gebruik van (een minder strenge versie van) [Gitflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow). | ||||||
|  | Dat betekent dat verschillende branches een verschillende rol hebben. | ||||||
|  | Nieuwe branches worden aangemaakt vanuit `dev` en worden gemerged naar `dev`. | ||||||
| 
 | 
 | ||||||
| Lees [hier](wiki) meer over deze beslissing | Een overzicht: | ||||||
| 
 | 
 | ||||||
| Concreet: | - `main`: Hier worden enkel de releases gemerged. Elke merge naar `main` moet een release zijn, aangeduid met een tag (`v1.2.3`). | ||||||
| 
 | - `dev`: Jouw branch hoort hiervan af te takken. | ||||||
| - `main` |  | ||||||
|     - Incl. tags (`v1.2.3`) |  | ||||||
| - `dev` |  | ||||||
|     - `feat/my-feat`: Voor features die uit geen of meer dan 1 issue bestaan |     - `feat/my-feat`: Voor features die uit geen of meer dan 1 issue bestaan | ||||||
|     - `feat/this-#x`: Voor features die aan een issue gelinkt kunnen worden |     - `feat/this-#x`: Voor features die aan een issue gelinkt kunnen worden | ||||||
|     - `fix/something-#x`: Voor (minder dringende) bug fixes. Bug fixes worden aan een issue gelinkt. |     - `fix/something-#x`: Voor (minder dringende) bug fixes. Bug fixes worden aan een issue gelinkt. | ||||||
| - `release/x.y.z`: Release prep branch | - `release/x.y.z`: Voorbereidingen voor een release. Hier worden enkel bug fixes en hotfixes gemerged. | ||||||
|  | 
 | ||||||
|  | Lees [hier](https://github.com/SELab-2/Dwengo-1/wiki/Developmentstrategie-keuzes#gitflow) meer over de beslissing om Gitflow te gebruiken. | ||||||
|  | 
 | ||||||
|  | We hebben ervoor gekozen om `main` en `dev` te beschermen. | ||||||
|  | Zie ook [pull request](#pull-request). | ||||||
|  | 
 | ||||||
|  | ## Coding conventions | ||||||
|  | 
 | ||||||
|  | Om de code consistent te houden, maken dit project gebruik van enkele tools: | ||||||
|  | 
 | ||||||
|  | - Formatting: [Prettier](https://prettier.io/), zorgt ervoor dat de code consistent geformatteerd is. | ||||||
|  | - Linting: [ESLint](https://typescript-eslint.io/), zorgt er o.a. voor dat de code geen "slechte" constructies bevat. | ||||||
|  | 
 | ||||||
|  | Je kan ze handmatig uitvoeren met `npm run lint` en `npm run format`. | ||||||
|  | 
 | ||||||
|  | Deze tools worden niet standaard automatisch uitgevoerd bij een commit. | ||||||
|  | Automatisch uitvoeren bij een commit kan met [git hooks](https://git-scm.com/docs/githooks). | ||||||
| 
 | 
 | ||||||
| ## Commits | ## Commits | ||||||
| 
 | 
 | ||||||
| Maken gebruik van [conventional commits](https://www.conventionalcommits.org/) | **Conventionele commits** | ||||||
| 
 | 
 | ||||||
| Lees [hier](wiki) meer over deze beslissing | Dit project maakt gebruik van [conventional commits](https://www.conventionalcommits.org/). | ||||||
| 
 | 
 | ||||||
| Concreet: | Dit betekent dat elke commit een duidelijke boodschap moet hebben, die volgens een bepaald formaat is opgesteld. | ||||||
|  | In het kort ziet dat er zo uit: | ||||||
| 
 | 
 | ||||||
| ``` | ``` | ||||||
| <type>(<optional scope>): <description> | <type>(<optional scope>): <description> | ||||||
|  | @ -43,29 +70,36 @@ type options: | ||||||
|     feat, fix, refactor, test, docs, build, ci, chore, ... |     feat, fix, refactor, test, docs, build, ci, chore, ... | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Als je een commit 'fixt', gebruik dan [ | Lees [hier](https://github.com/SELab-2/Dwengo-1/wiki/Developmentstrategie-keuzes#conventionele-commits) meer over de beslissing om conventionele commits te gebruiken. | ||||||
| `git commit --fixup`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt) |  | ||||||
| 
 | 
 | ||||||
| Als je een commit niet alleen hebt geschreven, maak dan | **Andere tips** | ||||||
| een [commit met meerdere auteurs](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors). |  | ||||||
| 
 | 
 | ||||||
| ## Pull request... | Als je een commit 'fixt', gebruik dan [`git commit --fixup`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt) | ||||||
| 
 | 
 | ||||||
| Als je aan visuele features werkt, voeg dan een screenshot van de omgeving van de feature toe, voor en nadat de feature | Als je een commit niet alleen hebt geschreven, maak dan een [commit met meerdere auteurs](https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors). | ||||||
| geïmplementeerd werd. |  | ||||||
| 
 | 
 | ||||||
| Start een draft pull request vanaf je een nieuwe feature branch pusht naar de server. | ## Pull request | ||||||
| 
 | 
 | ||||||
| Policies | Eens je code hebt geschreven en gecommit, is het tijd om een pull request te maken. | ||||||
|  | Het is fijn als je meteen ([draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests)) pull requests maakt, zodat anderen kunnen meekijken en feedback kunnen geven. | ||||||
| 
 | 
 | ||||||
| - naar `main`: kan enkel vanuit `release/x.y.z` | Om je op weg te helpen is er een [template](.github/PULL_REQUEST_TEMPLATE.md) voorzien. | ||||||
| - naar `dev`: wordt nagekeken alvorens te mergen | Door deze in te vullen, zorg je ervoor dat de reviewer een duidelijk beeld heeft van wat je hebt gedaan. | ||||||
| - elders: vrije keuze |  | ||||||
| 
 | 
 | ||||||
| ## Coding conventions | Als je aan visuele features werkt, voeg dan een screenshot van de omgeving van de feature toe, voor en na dat de feature geïmplementeerd werd. | ||||||
| 
 | 
 | ||||||
| - Formatting: [Prettier](https://prettier.io/) | **Branch protection** | ||||||
| - Linting: Maak gebruik van [ESLint](https://typescript-eslint.io/) of aan de hand van de [ |  | ||||||
|   `npm` commando's](package.json). |  | ||||||
| 
 | 
 | ||||||
| Voel je vrij om zelf commit hooks te installeren, maar we dwingen dit niet af. | Je zult merken dat sommige branches [beschermd](https://docs.github.com/en/github/administering-a-repository/about-protected-branches) zijn. | ||||||
|  | Dit betekent dat je niet zomaar kan mergen naar deze branches: | ||||||
|  | 
 | ||||||
|  | - `main`: kan enkel vanuit `release/x.y.z` | ||||||
|  | - `dev`: wordt nagekeken alvorens te mergen | ||||||
|  | 
 | ||||||
|  | Elders kan je vrij mergen. | ||||||
|  | 
 | ||||||
|  | Het zou kunnen dat je code bepaalde checks moet doorstaan alvorens te mergen. | ||||||
|  | Dit kan gaan van een simpele lint check tot een volledige test suite die moet slagen. | ||||||
|  | Tag gerust een maintainer als je denkt dat je code klaar is om gemerged te worden. | ||||||
|  | 
 | ||||||
|  | ## Dankjewel! | ||||||
|  |  | ||||||
							
								
								
									
										31
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										31
									
								
								README.md
									
										
									
									
									
								
							|  | @ -5,15 +5,15 @@ | ||||||
| OneDrive</a></span> | OneDrive</a></span> | ||||||
| <span><a href="https://www.figma.com/files/project/339220191" alt="Figma sjabloon"> | <span><a href="https://www.figma.com/files/project/339220191" alt="Figma sjabloon"> | ||||||
| Figma</a></span> | Figma</a></span> | ||||||
| <span><a href="../Dwengo-opgave" alt="projectopgave"> | <span><a href="https://github.com/SELab-2/Dwengo-opgave" alt="projectopgave"> | ||||||
| Projectopgave</a></span> | Projectopgave</a></span> | ||||||
| </p> | </p> | ||||||
| 
 | 
 | ||||||
| <ul align="center" style="list-style-type: none"> | <ul align="center" style="list-style-type: none"> | ||||||
| <li>Projectleider: Fransisco Van Langenhove (@Gabriellvl)</li> | <li>Projectleider: Fransisco Van Langenhove (<a href="https://github.com/Gabriellvl">@Gabriellvl</a>)</li> | ||||||
| <li>Technische lead: Tibo De Peuter (@tdpeuter)</li> | <li>Technische lead: Tibo De Peuter (<a href="https://github.com/tdpeuter">@tdpeuter</a>)</li> | ||||||
| <li>Systeembeheerder: Timo De Meyst (@kloep1)</li> | <li>Systeembeheerder: Timo De Meyst (<a href="https://github.com/kloep1">@kloep1</a>)</li> | ||||||
| <li>Customer relations officer: Adriaan Jacquet (@WhisperinCheetah)</li> | <li>Customer relations officer: Adriaan Jacquet (<a href="https://github.com/WhisperinCheetah">@WhisperinCheetah</a>)</li> | ||||||
| </ul> | </ul> | ||||||
| 
 | 
 | ||||||
| Dit is de monorepo voor [Dwengo-1](https://sel2-1.ugent.be), een interactief leerplatform waar leerkrachten opdrachten | Dit is de monorepo voor [Dwengo-1](https://sel2-1.ugent.be), een interactief leerplatform waar leerkrachten opdrachten | ||||||
|  | @ -23,28 +23,31 @@ en lessen kunnen samenstellen hun leerlingen en hun vooruitgang kunnen opvolgen. | ||||||
| 
 | 
 | ||||||
| ### Quick start | ### Quick start | ||||||
| 
 | 
 | ||||||
| 1. Installeer Docker en Docker Compose op je systeem (zie [Docker](https://docs.docker.com/get-docker/)). | 1. Installeer Docker en Docker Compose op je systeem (zie [Docker](https://docs.docker.com/get-docker/) en [Docker Compose](https://docs.docker.com/compose/)). | ||||||
| 2. Clone de repository. | 2. Clone deze repository. | ||||||
| 3. Voer `docker-compose up` uit in de root van de repository. | 3. Voer `docker compose up` uit in de root van de repository. | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| docker compose version | docker compose version | ||||||
| git clone https://github.com/SELab-2/Dwengo-1.git | git clone https://github.com/SELab-2/Dwengo-1.git | ||||||
| cd Dwengo-1 | cd Dwengo-1 | ||||||
| docker-compose up | docker compose up | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ### Handmatige installatie | ### Handmatige installatie | ||||||
| 
 | 
 | ||||||
| Zie de submappen voor de installatie-instructies van de verschillende services. | Zie de submappen voor de installatie-instructies van de [frontend](./frontend/README.md) en [backend](./backend/README.md). | ||||||
| 
 | 
 | ||||||
| ## Architectuur | ## Architectuur | ||||||
| 
 | 
 | ||||||
| ``` |  | ||||||
| hier overzichtsdiagram invoegen |  | ||||||
| ``` |  | ||||||
| 
 | 
 | ||||||
| We maken gebruik van ... Meer informatie over deze ontwerpsbeslissingen kan je vinden in de [architectuurdocumentatie](./architectuur). | De tech-stack bestaat uit: | ||||||
|  | 
 | ||||||
|  | - **Frontend**: TypeScript + Vue.js + Vuetify | ||||||
|  | - **Backend**: TypeScript + Node.js + Express.js + TypeORM + PostgreSQL | ||||||
|  | 
 | ||||||
|  | Voor meer informatie over de keuze van deze tech-stack, zie [designkeuzes](https://github.com/SELab-2/Dwengo-1/wiki/Design-keuzes). | ||||||
| 
 | 
 | ||||||
| ## Bijdragen aan Dwengo-1 | ## Bijdragen aan Dwengo-1 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								assets/img/dwengo-groen-zwart.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/img/dwengo-groen-zwart.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 50 KiB | 
							
								
								
									
										61
									
								
								assets/img/dwengo-groen-zwart.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								assets/img/dwengo-groen-zwart.svg
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| After Width: | Height: | Size: 9 KiB | 
							
								
								
									
										6
									
								
								backend/.env.development.example
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								backend/.env.development.example
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | DWENGO_PORT=3000 | ||||||
|  | DWENGO_DB_HOST=localhost | ||||||
|  | DWENGO_DB_PORT=5431 | ||||||
|  | DWENGO_DB_USERNAME=postgres | ||||||
|  | DWENGO_DB_PASSWORD=postgres | ||||||
|  | DWENGO_DB_UPDATE=true | ||||||
							
								
								
									
										3
									
								
								backend/.env.test
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								backend/.env.test
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | ||||||
|  | PORT=3000 | ||||||
|  | DWENGO_DB_UPDATE=true | ||||||
|  | DWENGO_DB_NAME=":memory:" | ||||||
							
								
								
									
										22
									
								
								backend/README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								backend/README.md
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | ||||||
|  | # dwengo-1-backend | ||||||
|  | 
 | ||||||
|  | ## Project setup | ||||||
|  | 
 | ||||||
|  | ```shell | ||||||
|  | npm install | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Setup the environment variables in a `.env` file in the root of the project. You can use the `.env.example` file as a template. | ||||||
|  | 
 | ||||||
|  | ### Development | ||||||
|  | 
 | ||||||
|  | ```shell | ||||||
|  | npm run dev | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### Production | ||||||
|  | 
 | ||||||
|  | ```shell | ||||||
|  | npm run build | ||||||
|  | npm run start | ||||||
|  | ``` | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| -- Create the database |  | ||||||
| CREATE DATABASE dwengo; |  | ||||||
							
								
								
									
										4447
									
								
								backend/package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										4447
									
								
								backend/package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -11,7 +11,7 @@ | ||||||
|         "format": "prettier --write src/", |         "format": "prettier --write src/", | ||||||
|         "format-check": "prettier --check src/", |         "format-check": "prettier --check src/", | ||||||
|         "lint": "eslint . --fix", |         "lint": "eslint . --fix", | ||||||
|         "test:unit": "vitest --run" |         "test:unit": "vitest" | ||||||
|     }, |     }, | ||||||
|     "dependencies": { |     "dependencies": { | ||||||
|         "@mikro-orm/core": "^6.4.6", |         "@mikro-orm/core": "^6.4.6", | ||||||
|  | @ -19,9 +19,13 @@ | ||||||
|         "@mikro-orm/reflection": "^6.4.6", |         "@mikro-orm/reflection": "^6.4.6", | ||||||
|         "@types/js-yaml": "^4.0.9", |         "@types/js-yaml": "^4.0.9", | ||||||
|         "axios": "^1.8.1", |         "axios": "^1.8.1", | ||||||
|  |         "@mikro-orm/sqlite": "6.4.6", | ||||||
|         "dotenv": "^16.4.7", |         "dotenv": "^16.4.7", | ||||||
|         "express": "^5.0.1", |         "express": "^5.0.1", | ||||||
|         "js-yaml": "^4.1.0" |         "uuid": "^11.1.0", | ||||||
|  |         "express": "^5.0.1", | ||||||
|  |         "js-yaml": "^4.1.0", | ||||||
|  |         "@types/js-yaml": "^4.0.9", | ||||||
|     }, |     }, | ||||||
|     "devDependencies": { |     "devDependencies": { | ||||||
|         "@mikro-orm/cli": "^6.4.6", |         "@mikro-orm/cli": "^6.4.6", | ||||||
|  |  | ||||||
|  | @ -1,11 +1,22 @@ | ||||||
| import express, { Express, Response } from 'express'; | import express, { Express, Response } from 'express'; | ||||||
| import initORM from './orm.js'; | import { initORM } from './orm.js'; | ||||||
|  | import { EnvVars, getNumericEnvVar } from './util/envvars.js'; | ||||||
|  | 
 | ||||||
| import themeRoutes from './routes/themes.js'; | import themeRoutes from './routes/themes.js'; | ||||||
| import learningPathRoutes from './routes/learningPaths.js'; | import learningPathRoutes from './routes/learningPaths.js'; | ||||||
| import learningObjectRoutes from './routes/learningObjects.js'; | import learningObjectRoutes from './routes/learningObjects.js'; | ||||||
| 
 | 
 | ||||||
|  | import studentRouter from './routes/student'; | ||||||
|  | import groupRouter from './routes/group'; | ||||||
|  | import assignmentRouter from './routes/assignment'; | ||||||
|  | import submissionRouter from './routes/submission'; | ||||||
|  | import classRouter from './routes/class'; | ||||||
|  | import questionRouter from './routes/question'; | ||||||
|  | import loginRouter from './routes/login'; | ||||||
|  | 
 | ||||||
| const app: Express = express(); | const app: Express = express(); | ||||||
| const port: string | number = process.env.PORT || 3000; | const port: string | number = getNumericEnvVar(EnvVars.Port); | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| // TODO Replace with Express routes
 | // TODO Replace with Express routes
 | ||||||
| app.get('/', (_, res: Response) => { | app.get('/', (_, res: Response) => { | ||||||
|  | @ -14,6 +25,14 @@ app.get('/', (_, res: Response) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | app.use('/student', studentRouter); | ||||||
|  | app.use('/group', groupRouter); | ||||||
|  | app.use('/assignment', assignmentRouter); | ||||||
|  | app.use('/submission', submissionRouter); | ||||||
|  | app.use('/class', classRouter); | ||||||
|  | app.use('/question', questionRouter); | ||||||
|  | app.use('/login', loginRouter); | ||||||
|  | 
 | ||||||
| app.use('/theme', themeRoutes); | app.use('/theme', themeRoutes); | ||||||
| app.use('/learningPath', learningPathRoutes); | app.use('/learningPath', learningPathRoutes); | ||||||
| app.use('/learningObject', learningObjectRoutes); | app.use('/learningObject', learningObjectRoutes); | ||||||
|  | @ -26,4 +45,4 @@ async function startServer() { | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| startServer(); | await startServer(); | ||||||
|  |  | ||||||
							
								
								
									
										18
									
								
								backend/src/data/assignments/assignment-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								backend/src/data/assignments/assignment-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Assignment } from '../../entities/assignments/assignment.entity.js'; | ||||||
|  | import { Class } from '../../entities/classes/class.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class AssignmentRepository extends DwengoEntityRepository<Assignment> { | ||||||
|  |     public findByClassAndId( | ||||||
|  |         within: Class, | ||||||
|  |         id: number | ||||||
|  |     ): Promise<Assignment | null> { | ||||||
|  |         return this.findOne({ within: within, id: id }); | ||||||
|  |     } | ||||||
|  |     public findAllAssignmentsInClass(within: Class): Promise<Assignment[]> { | ||||||
|  |         return this.findAll({ where: { within: within } }); | ||||||
|  |     } | ||||||
|  |     public deleteByClassAndId(within: Class, id: number): Promise<void> { | ||||||
|  |         return this.deleteWhere({ within: within, id: id }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										29
									
								
								backend/src/data/assignments/group-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								backend/src/data/assignments/group-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Group } from '../../entities/assignments/group.entity.js'; | ||||||
|  | import { Assignment } from '../../entities/assignments/assignment.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class GroupRepository extends DwengoEntityRepository<Group> { | ||||||
|  |     public findByAssignmentAndGroupNumber( | ||||||
|  |         assignment: Assignment, | ||||||
|  |         groupNumber: number | ||||||
|  |     ): Promise<Group | null> { | ||||||
|  |         return this.findOne({ | ||||||
|  |             assignment: assignment, | ||||||
|  |             groupNumber: groupNumber, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |     public findAllGroupsForAssignment( | ||||||
|  |         assignment: Assignment | ||||||
|  |     ): Promise<Group[]> { | ||||||
|  |         return this.findAll({ where: { assignment: assignment } }); | ||||||
|  |     } | ||||||
|  |     public deleteByAssignmentAndGroupNumber( | ||||||
|  |         assignment: Assignment, | ||||||
|  |         groupNumber: number | ||||||
|  |     ) { | ||||||
|  |         return this.deleteWhere({ | ||||||
|  |             assignment: assignment, | ||||||
|  |             groupNumber: groupNumber, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										61
									
								
								backend/src/data/assignments/submission-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								backend/src/data/assignments/submission-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,61 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Group } from '../../entities/assignments/group.entity.js'; | ||||||
|  | import { Submission } from '../../entities/assignments/submission.entity.js'; | ||||||
|  | import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | ||||||
|  | import { Student } from '../../entities/users/student.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class SubmissionRepository extends DwengoEntityRepository<Submission> { | ||||||
|  |     public findSubmissionByLearningObjectAndSubmissionNumber( | ||||||
|  |         loId: LearningObjectIdentifier, | ||||||
|  |         submissionNumber: number | ||||||
|  |     ): Promise<Submission | null> { | ||||||
|  |         return this.findOne({ | ||||||
|  |             learningObjectHruid: loId.hruid, | ||||||
|  |             learningObjectLanguage: loId.language, | ||||||
|  |             learningObjectVersion: loId.version, | ||||||
|  |             submissionNumber: submissionNumber, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public findMostRecentSubmissionForStudent( | ||||||
|  |         loId: LearningObjectIdentifier, | ||||||
|  |         submitter: Student | ||||||
|  |     ): Promise<Submission | null> { | ||||||
|  |         return this.findOne( | ||||||
|  |             { | ||||||
|  |                 learningObjectHruid: loId.hruid, | ||||||
|  |                 learningObjectLanguage: loId.language, | ||||||
|  |                 learningObjectVersion: loId.version, | ||||||
|  |                 submitter: submitter, | ||||||
|  |             }, | ||||||
|  |             { orderBy: { submissionNumber: 'DESC' } } | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public findMostRecentSubmissionForGroup( | ||||||
|  |         loId: LearningObjectIdentifier, | ||||||
|  |         group: Group | ||||||
|  |     ): Promise<Submission | null> { | ||||||
|  |         return this.findOne( | ||||||
|  |             { | ||||||
|  |                 learningObjectHruid: loId.hruid, | ||||||
|  |                 learningObjectLanguage: loId.language, | ||||||
|  |                 learningObjectVersion: loId.version, | ||||||
|  |                 onBehalfOf: group, | ||||||
|  |             }, | ||||||
|  |             { orderBy: { submissionNumber: 'DESC' } } | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public deleteSubmissionByLearningObjectAndSubmissionNumber( | ||||||
|  |         loId: LearningObjectIdentifier, | ||||||
|  |         submissionNumber: number | ||||||
|  |     ): Promise<void> { | ||||||
|  |         return this.deleteWhere({ | ||||||
|  |             learningObjectHruid: loId.hruid, | ||||||
|  |             learningObjectLanguage: loId.language, | ||||||
|  |             learningObjectVersion: loId.version, | ||||||
|  |             submissionNumber: submissionNumber, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								backend/src/data/classes/class-join-request-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/src/data/classes/class-join-request-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Class } from '../../entities/classes/class.entity.js'; | ||||||
|  | import { ClassJoinRequest } from '../../entities/classes/class-join-request.entity.js'; | ||||||
|  | import { Student } from '../../entities/users/student.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class ClassJoinRequestRepository extends DwengoEntityRepository<ClassJoinRequest> { | ||||||
|  |     public findAllRequestsBy(requester: Student): Promise<ClassJoinRequest[]> { | ||||||
|  |         return this.findAll({ where: { requester: requester } }); | ||||||
|  |     } | ||||||
|  |     public findAllOpenRequestsTo(clazz: Class): Promise<ClassJoinRequest[]> { | ||||||
|  |         return this.findAll({ where: { class: clazz } }); | ||||||
|  |     } | ||||||
|  |     public deleteBy(requester: Student, clazz: Class): Promise<void> { | ||||||
|  |         return this.deleteWhere({ requester: requester, class: clazz }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								backend/src/data/classes/class-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								backend/src/data/classes/class-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Class } from '../../entities/classes/class.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class ClassRepository extends DwengoEntityRepository<Class> { | ||||||
|  |     public findById(id: string): Promise<Class | null> { | ||||||
|  |         return this.findOne({ classId: id }); | ||||||
|  |     } | ||||||
|  |     public deleteById(id: string): Promise<void> { | ||||||
|  |         return this.deleteWhere({ classId: id }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										31
									
								
								backend/src/data/classes/teacher-invitation-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								backend/src/data/classes/teacher-invitation-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Class } from '../../entities/classes/class.entity.js'; | ||||||
|  | import { TeacherInvitation } from '../../entities/classes/teacher-invitation.entity.js'; | ||||||
|  | import { Teacher } from '../../entities/users/teacher.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class TeacherInvitationRepository extends DwengoEntityRepository<TeacherInvitation> { | ||||||
|  |     public findAllInvitationsForClass( | ||||||
|  |         clazz: Class | ||||||
|  |     ): Promise<TeacherInvitation[]> { | ||||||
|  |         return this.findAll({ where: { class: clazz } }); | ||||||
|  |     } | ||||||
|  |     public findAllInvitationsBy(sender: Teacher): Promise<TeacherInvitation[]> { | ||||||
|  |         return this.findAll({ where: { sender: sender } }); | ||||||
|  |     } | ||||||
|  |     public findAllInvitationsFor( | ||||||
|  |         receiver: Teacher | ||||||
|  |     ): Promise<TeacherInvitation[]> { | ||||||
|  |         return this.findAll({ where: { receiver: receiver } }); | ||||||
|  |     } | ||||||
|  |     public deleteBy( | ||||||
|  |         clazz: Class, | ||||||
|  |         sender: Teacher, | ||||||
|  |         receiver: Teacher | ||||||
|  |     ): Promise<void> { | ||||||
|  |         return this.deleteWhere({ | ||||||
|  |             sender: sender, | ||||||
|  |             receiver: receiver, | ||||||
|  |             class: clazz, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								backend/src/data/content/attachment-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/src/data/content/attachment-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Attachment } from '../../entities/content/attachment.entity.js'; | ||||||
|  | import { LearningObject } from '../../entities/content/learning-object.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class AttachmentRepository extends DwengoEntityRepository<Attachment> { | ||||||
|  |     public findByLearningObjectAndNumber( | ||||||
|  |         learningObject: LearningObject, | ||||||
|  |         sequenceNumber: number | ||||||
|  |     ) { | ||||||
|  |         return this.findOne({ | ||||||
|  |             learningObject: learningObject, | ||||||
|  |             sequenceNumber: sequenceNumber, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |     // This repository is read-only for now since creating own learning object is an extension feature.
 | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								backend/src/data/content/learning-object-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/src/data/content/learning-object-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { LearningObject } from '../../entities/content/learning-object.entity.js'; | ||||||
|  | import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | ||||||
|  | 
 | ||||||
|  | export class LearningObjectRepository extends DwengoEntityRepository<LearningObject> { | ||||||
|  |     public findByIdentifier( | ||||||
|  |         identifier: LearningObjectIdentifier | ||||||
|  |     ): Promise<LearningObject | null> { | ||||||
|  |         return this.findOne({ | ||||||
|  |             hruid: identifier.hruid, | ||||||
|  |             language: identifier.language, | ||||||
|  |             version: identifier.version, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |     // This repository is read-only for now since creating own learning object is an extension feature.
 | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								backend/src/data/content/learning-path-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								backend/src/data/content/learning-path-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { LearningPath } from '../../entities/content/learning-path.entity.js'; | ||||||
|  | import { Language } from '../../entities/content/language.js'; | ||||||
|  | 
 | ||||||
|  | export class LearningPathRepository extends DwengoEntityRepository<LearningPath> { | ||||||
|  |     public findByHruidAndLanguage( | ||||||
|  |         hruid: string, | ||||||
|  |         language: Language | ||||||
|  |     ): Promise<LearningPath | null> { | ||||||
|  |         return this.findOne({ hruid: hruid, language: language }); | ||||||
|  |     } | ||||||
|  |     // This repository is read-only for now since creating own learning object is an extension feature.
 | ||||||
|  | } | ||||||
							
								
								
									
										19
									
								
								backend/src/data/dwengo-entity-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								backend/src/data/dwengo-entity-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | ||||||
|  | import { EntityRepository, FilterQuery } from '@mikro-orm/core'; | ||||||
|  | 
 | ||||||
|  | export abstract class DwengoEntityRepository< | ||||||
|  |     T extends object, | ||||||
|  | > extends EntityRepository<T> { | ||||||
|  |     public async save(entity: T) { | ||||||
|  |         let em = this.getEntityManager(); | ||||||
|  |         em.persist(entity); | ||||||
|  |         await em.flush(); | ||||||
|  |     } | ||||||
|  |     public async deleteWhere(query: FilterQuery<T>) { | ||||||
|  |         let toDelete = await this.findOne(query); | ||||||
|  |         let em = this.getEntityManager(); | ||||||
|  |         if (toDelete) { | ||||||
|  |             em.remove(toDelete); | ||||||
|  |             await em.flush(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										33
									
								
								backend/src/data/questions/answer-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								backend/src/data/questions/answer-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Answer } from '../../entities/questions/answer.entity.js'; | ||||||
|  | import { Question } from '../../entities/questions/question.entity.js'; | ||||||
|  | import { Teacher } from '../../entities/users/teacher.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class AnswerRepository extends DwengoEntityRepository<Answer> { | ||||||
|  |     public createAnswer(answer: { | ||||||
|  |         toQuestion: Question; | ||||||
|  |         author: Teacher; | ||||||
|  |         content: string; | ||||||
|  |     }): Promise<Answer> { | ||||||
|  |         let answerEntity = new Answer(); | ||||||
|  |         answerEntity.toQuestion = answer.toQuestion; | ||||||
|  |         answerEntity.author = answer.author; | ||||||
|  |         answerEntity.content = answer.content; | ||||||
|  |         return this.insert(answerEntity); | ||||||
|  |     } | ||||||
|  |     public findAllAnswersToQuestion(question: Question): Promise<Answer[]> { | ||||||
|  |         return this.findAll({ | ||||||
|  |             where: { toQuestion: question }, | ||||||
|  |             orderBy: { sequenceNumber: 'ASC' }, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |     public removeAnswerByQuestionAndSequenceNumber( | ||||||
|  |         question: Question, | ||||||
|  |         sequenceNumber: number | ||||||
|  |     ): Promise<void> { | ||||||
|  |         return this.deleteWhere({ | ||||||
|  |             toQuestion: question, | ||||||
|  |             sequenceNumber: sequenceNumber, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										45
									
								
								backend/src/data/questions/question-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								backend/src/data/questions/question-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Question } from '../../entities/questions/question.entity.js'; | ||||||
|  | import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | ||||||
|  | import { Student } from '../../entities/users/student.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class QuestionRepository extends DwengoEntityRepository<Question> { | ||||||
|  |     public createQuestion(question: { | ||||||
|  |         loId: LearningObjectIdentifier; | ||||||
|  |         author: Student; | ||||||
|  |         content: string; | ||||||
|  |     }): Promise<Question> { | ||||||
|  |         let questionEntity = new Question(); | ||||||
|  |         questionEntity.learningObjectHruid = question.loId.hruid; | ||||||
|  |         questionEntity.learningObjectLanguage = question.loId.language; | ||||||
|  |         questionEntity.learningObjectVersion = question.loId.version; | ||||||
|  |         questionEntity.author = question.author; | ||||||
|  |         questionEntity.content = question.content; | ||||||
|  |         return this.insert(questionEntity); | ||||||
|  |     } | ||||||
|  |     public findAllQuestionsAboutLearningObject( | ||||||
|  |         loId: LearningObjectIdentifier | ||||||
|  |     ): Promise<Question[]> { | ||||||
|  |         return this.findAll({ | ||||||
|  |             where: { | ||||||
|  |                 learningObjectHruid: loId.hruid, | ||||||
|  |                 learningObjectLanguage: loId.language, | ||||||
|  |                 learningObjectVersion: loId.version, | ||||||
|  |             }, | ||||||
|  |             orderBy: { | ||||||
|  |                 sequenceNumber: 'ASC', | ||||||
|  |             }, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  |     public removeQuestionByLearningObjectAndSequenceNumber( | ||||||
|  |         loId: LearningObjectIdentifier, | ||||||
|  |         sequenceNumber: number | ||||||
|  |     ): Promise<void> { | ||||||
|  |         return this.deleteWhere({ | ||||||
|  |             learningObjectHruid: loId.hruid, | ||||||
|  |             learningObjectLanguage: loId.language, | ||||||
|  |             learningObjectVersion: loId.version, | ||||||
|  |             sequenceNumber: sequenceNumber, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										119
									
								
								backend/src/data/repositories.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								backend/src/data/repositories.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,119 @@ | ||||||
|  | import { | ||||||
|  |     AnyEntity, | ||||||
|  |     EntityManager, | ||||||
|  |     EntityName, | ||||||
|  |     EntityRepository, | ||||||
|  | } from '@mikro-orm/core'; | ||||||
|  | import { forkEntityManager } from '../orm.js'; | ||||||
|  | import { StudentRepository } from './users/student-repository.js'; | ||||||
|  | import { Student } from '../entities/users/student.entity.js'; | ||||||
|  | import { User } from '../entities/users/user.entity.js'; | ||||||
|  | import { UserRepository } from './users/user-repository.js'; | ||||||
|  | import { Teacher } from '../entities/users/teacher.entity.js'; | ||||||
|  | import { TeacherRepository } from './users/teacher-repository.js'; | ||||||
|  | import { Class } from '../entities/classes/class.entity.js'; | ||||||
|  | import { ClassRepository } from './classes/class-repository.js'; | ||||||
|  | import { ClassJoinRequest } from '../entities/classes/class-join-request.entity.js'; | ||||||
|  | import { ClassJoinRequestRepository } from './classes/class-join-request-repository.js'; | ||||||
|  | import { TeacherInvitationRepository } from './classes/teacher-invitation-repository.js'; | ||||||
|  | import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js'; | ||||||
|  | import { Assignment } from '../entities/assignments/assignment.entity.js'; | ||||||
|  | import { AssignmentRepository } from './assignments/assignment-repository.js'; | ||||||
|  | import { GroupRepository } from './assignments/group-repository.js'; | ||||||
|  | import { Group } from '../entities/assignments/group.entity.js'; | ||||||
|  | import { Submission } from '../entities/assignments/submission.entity.js'; | ||||||
|  | import { SubmissionRepository } from './assignments/submission-repository.js'; | ||||||
|  | import { Question } from '../entities/questions/question.entity.js'; | ||||||
|  | import { QuestionRepository } from './questions/question-repository.js'; | ||||||
|  | import { Answer } from '../entities/questions/answer.entity.js'; | ||||||
|  | import { AnswerRepository } from './questions/answer-repository.js'; | ||||||
|  | import { LearningObject } from '../entities/content/learning-object.entity.js'; | ||||||
|  | import { LearningObjectRepository } from './content/learning-object-repository.js'; | ||||||
|  | import { LearningPath } from '../entities/content/learning-path.entity.js'; | ||||||
|  | import { LearningPathRepository } from './content/learning-path-repository.js'; | ||||||
|  | import { AttachmentRepository } from './content/attachment-repository.js'; | ||||||
|  | import { Attachment } from '../entities/content/attachment.entity.js'; | ||||||
|  | 
 | ||||||
|  | let entityManager: EntityManager | undefined; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Execute all the database operations within the function f in a single transaction. | ||||||
|  |  */ | ||||||
|  | export function transactional<T>(f: () => Promise<T>) { | ||||||
|  |     entityManager?.transactional(f); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function repositoryGetter<T extends AnyEntity, R extends EntityRepository<T>>( | ||||||
|  |     entity: EntityName<T> | ||||||
|  | ): () => R { | ||||||
|  |     let cachedRepo: R | undefined; | ||||||
|  |     return (): R => { | ||||||
|  |         if (!cachedRepo) { | ||||||
|  |             if (!entityManager) { | ||||||
|  |                 entityManager = forkEntityManager(); | ||||||
|  |             } | ||||||
|  |             cachedRepo = entityManager.getRepository(entity) as R; | ||||||
|  |         } | ||||||
|  |         return cachedRepo; | ||||||
|  |     }; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /* Users */ | ||||||
|  | export const getUserRepository = repositoryGetter<User, UserRepository>(User); | ||||||
|  | export const getStudentRepository = repositoryGetter< | ||||||
|  |     Student, | ||||||
|  |     StudentRepository | ||||||
|  | >(Student); | ||||||
|  | export const getTeacherRepository = repositoryGetter< | ||||||
|  |     Teacher, | ||||||
|  |     TeacherRepository | ||||||
|  | >(Teacher); | ||||||
|  | 
 | ||||||
|  | /* Classes */ | ||||||
|  | export const getClassRepository = repositoryGetter<Class, ClassRepository>( | ||||||
|  |     Class | ||||||
|  | ); | ||||||
|  | export const getClassJoinRequestRepository = repositoryGetter< | ||||||
|  |     ClassJoinRequest, | ||||||
|  |     ClassJoinRequestRepository | ||||||
|  | >(ClassJoinRequest); | ||||||
|  | export const getTeacherInvitationRepository = repositoryGetter< | ||||||
|  |     TeacherInvitation, | ||||||
|  |     TeacherInvitationRepository | ||||||
|  | >(TeacherInvitationRepository); | ||||||
|  | 
 | ||||||
|  | /* Assignments */ | ||||||
|  | export const getAssignmentRepository = repositoryGetter< | ||||||
|  |     Assignment, | ||||||
|  |     AssignmentRepository | ||||||
|  | >(Assignment); | ||||||
|  | export const getGroupRepository = repositoryGetter<Group, GroupRepository>( | ||||||
|  |     Group | ||||||
|  | ); | ||||||
|  | export const getSubmissionRepository = repositoryGetter< | ||||||
|  |     Submission, | ||||||
|  |     SubmissionRepository | ||||||
|  | >(Submission); | ||||||
|  | 
 | ||||||
|  | /* Questions and answers */ | ||||||
|  | export const getQuestionRepository = repositoryGetter< | ||||||
|  |     Question, | ||||||
|  |     QuestionRepository | ||||||
|  | >(Question); | ||||||
|  | export const getAnswerRepository = repositoryGetter<Answer, AnswerRepository>( | ||||||
|  |     Answer | ||||||
|  | ); | ||||||
|  | 
 | ||||||
|  | /* Learning content */ | ||||||
|  | export const getLearningObjectRepository = repositoryGetter< | ||||||
|  |     LearningObject, | ||||||
|  |     LearningObjectRepository | ||||||
|  | >(LearningObject); | ||||||
|  | export const getLearningPathRepository = repositoryGetter< | ||||||
|  |     LearningPath, | ||||||
|  |     LearningPathRepository | ||||||
|  | >(LearningPath); | ||||||
|  | export const getAttachmentRepository = repositoryGetter< | ||||||
|  |     Attachment, | ||||||
|  |     AttachmentRepository | ||||||
|  | >(Assignment); | ||||||
							
								
								
									
										11
									
								
								backend/src/data/users/student-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								backend/src/data/users/student-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Student } from '../../entities/users/student.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class StudentRepository extends DwengoEntityRepository<Student> { | ||||||
|  |     public findByUsername(username: string): Promise<Student | null> { | ||||||
|  |         return this.findOne({ username: username }); | ||||||
|  |     } | ||||||
|  |     public deleteByUsername(username: string): Promise<void> { | ||||||
|  |         return this.deleteWhere({ username: username }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								backend/src/data/users/teacher-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								backend/src/data/users/teacher-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { Teacher } from '../../entities/users/teacher.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class TeacherRepository extends DwengoEntityRepository<Teacher> { | ||||||
|  |     public findByUsername(username: string): Promise<Teacher | null> { | ||||||
|  |         return this.findOne({ username: username }); | ||||||
|  |     } | ||||||
|  |     public deleteByUsername(username: string): Promise<void> { | ||||||
|  |         return this.deleteWhere({ username: username }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								backend/src/data/users/user-repository.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								backend/src/data/users/user-repository.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||||
|  | import { User } from '../../entities/users/user.entity.js'; | ||||||
|  | 
 | ||||||
|  | export class UserRepository extends DwengoEntityRepository<User> { | ||||||
|  |     public findByUsername(username: string): Promise<User | null> { | ||||||
|  |         return this.findOne({ username: username }); | ||||||
|  |     } | ||||||
|  |     public deleteByUsername(username: string): Promise<void> { | ||||||
|  |         return this.deleteWhere({ username: username }); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										35
									
								
								backend/src/entities/assignments/assignment.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								backend/src/entities/assignments/assignment.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | ||||||
|  | import { | ||||||
|  |     Entity, | ||||||
|  |     Enum, | ||||||
|  |     ManyToOne, | ||||||
|  |     OneToMany, | ||||||
|  |     PrimaryKey, | ||||||
|  |     Property, | ||||||
|  | } from '@mikro-orm/core'; | ||||||
|  | import { Class } from '../classes/class.entity.js'; | ||||||
|  | import { Group } from './group.entity.js'; | ||||||
|  | import { Language } from '../content/language.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Assignment { | ||||||
|  |     @ManyToOne({ entity: () => Class, primary: true }) | ||||||
|  |     within!: Class; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'number' }) | ||||||
|  |     id!: number; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     title!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'text' }) | ||||||
|  |     description!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     learningPathHruid!: string; | ||||||
|  | 
 | ||||||
|  |     @Enum({ items: () => Language }) | ||||||
|  |     learningPathLanguage!: Language; | ||||||
|  | 
 | ||||||
|  |     @OneToMany({ entity: () => Group, mappedBy: 'assignment' }) | ||||||
|  |     groups!: Group[]; | ||||||
|  | } | ||||||
							
								
								
									
										15
									
								
								backend/src/entities/assignments/group.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								backend/src/entities/assignments/group.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | ||||||
|  | import { Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core'; | ||||||
|  | import { Assignment } from './assignment.entity.js'; | ||||||
|  | import { Student } from '../users/student.entity.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Group { | ||||||
|  |     @ManyToOne({ entity: () => Assignment, primary: true }) | ||||||
|  |     assignment!: Assignment; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'integer' }) | ||||||
|  |     groupNumber!: number; | ||||||
|  | 
 | ||||||
|  |     @ManyToMany({ entity: () => Student }) | ||||||
|  |     members!: Student[]; | ||||||
|  | } | ||||||
							
								
								
									
										31
									
								
								backend/src/entities/assignments/submission.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								backend/src/entities/assignments/submission.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | ||||||
|  | import { Student } from '../users/student.entity.js'; | ||||||
|  | import { Group } from './group.entity.js'; | ||||||
|  | import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||||
|  | import { Language } from '../content/language.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Submission { | ||||||
|  |     @PrimaryKey({ type: 'string' }) | ||||||
|  |     learningObjectHruid!: string; | ||||||
|  | 
 | ||||||
|  |     @Enum({ items: () => Language, primary: true }) | ||||||
|  |     learningObjectLanguage!: Language; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'string' }) | ||||||
|  |     learningObjectVersion: string = '1'; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'integer' }) | ||||||
|  |     submissionNumber!: number; | ||||||
|  | 
 | ||||||
|  |     @ManyToOne({ entity: () => Student }) | ||||||
|  |     submitter!: Student; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'datetime' }) | ||||||
|  |     submissionTime!: Date; | ||||||
|  | 
 | ||||||
|  |     @ManyToOne({ entity: () => Group, nullable: true }) | ||||||
|  |     onBehalfOf?: Group; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'json' }) | ||||||
|  |     content!: string; | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								backend/src/entities/classes/class-join-request.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								backend/src/entities/classes/class-join-request.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | import { Entity, Enum, ManyToOne } from '@mikro-orm/core'; | ||||||
|  | import { Student } from '../users/student.entity'; | ||||||
|  | import { Class } from './class.entity'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class ClassJoinRequest { | ||||||
|  |     @ManyToOne({ entity: () => Student, primary: true }) | ||||||
|  |     requester!: Student; | ||||||
|  | 
 | ||||||
|  |     @ManyToOne({ entity: () => Class, primary: true }) | ||||||
|  |     class!: Class; | ||||||
|  | 
 | ||||||
|  |     @Enum(() => ClassJoinRequestStatus) | ||||||
|  |     status!: ClassJoinRequestStatus; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export enum ClassJoinRequestStatus { | ||||||
|  |     Open = 'open', | ||||||
|  |     Accepted = 'accepted', | ||||||
|  |     Declined = 'declined', | ||||||
|  | } | ||||||
							
								
								
									
										25
									
								
								backend/src/entities/classes/class.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								backend/src/entities/classes/class.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | ||||||
|  | import { | ||||||
|  |     Collection, | ||||||
|  |     Entity, | ||||||
|  |     ManyToMany, | ||||||
|  |     PrimaryKey, | ||||||
|  |     Property, | ||||||
|  | } from '@mikro-orm/core'; | ||||||
|  | import { v4 } from 'uuid'; | ||||||
|  | import { Teacher } from '../users/teacher.entity.js'; | ||||||
|  | import { Student } from '../users/student.entity.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Class { | ||||||
|  |     @PrimaryKey() | ||||||
|  |     classId = v4(); | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     displayName!: string; | ||||||
|  | 
 | ||||||
|  |     @ManyToMany(() => Teacher) | ||||||
|  |     teachers!: Collection<Teacher>; | ||||||
|  | 
 | ||||||
|  |     @ManyToMany(() => Student) | ||||||
|  |     students!: Collection<Student>; | ||||||
|  | } | ||||||
							
								
								
									
										18
									
								
								backend/src/entities/classes/teacher-invitation.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								backend/src/entities/classes/teacher-invitation.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | ||||||
|  | import { Entity, ManyToOne } from '@mikro-orm/core'; | ||||||
|  | import { Teacher } from '../users/teacher.entity.js'; | ||||||
|  | import { Class } from './class.entity.js'; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Invitation of a teacher into a class (in order to teach it). | ||||||
|  |  */ | ||||||
|  | @Entity() | ||||||
|  | export class TeacherInvitation { | ||||||
|  |     @ManyToOne({ entity: () => Teacher, primary: true }) | ||||||
|  |     sender!: Teacher; | ||||||
|  | 
 | ||||||
|  |     @ManyToOne({ entity: () => Teacher, primary: true }) | ||||||
|  |     receiver!: Teacher; | ||||||
|  | 
 | ||||||
|  |     @ManyToOne({ entity: () => Class, primary: true }) | ||||||
|  |     class!: Class; | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								backend/src/entities/content/attachment.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								backend/src/entities/content/attachment.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | ||||||
|  | import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||||
|  | import { LearningObject } from './learning-object.entity.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Attachment { | ||||||
|  |     @ManyToOne({ entity: () => LearningObject, primary: true }) | ||||||
|  |     learningObject!: LearningObject; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'integer' }) | ||||||
|  |     sequenceNumber!: number; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     mimeType!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'blob' }) | ||||||
|  |     content!: Buffer; | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								backend/src/entities/content/language.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								backend/src/entities/content/language.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | export enum Language { | ||||||
|  |     Dutch = 'nl', | ||||||
|  |     French = 'fr', | ||||||
|  |     English = 'en', | ||||||
|  |     Germany = 'de', | ||||||
|  | } | ||||||
|  | @ -0,0 +1,9 @@ | ||||||
|  | import { Language } from './language.js'; | ||||||
|  | 
 | ||||||
|  | export class LearningObjectIdentifier { | ||||||
|  |     constructor( | ||||||
|  |         public hruid: string, | ||||||
|  |         public language: Language, | ||||||
|  |         public version: string | ||||||
|  |     ) {} | ||||||
|  | } | ||||||
							
								
								
									
										106
									
								
								backend/src/entities/content/learning-object.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								backend/src/entities/content/learning-object.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,106 @@ | ||||||
|  | import { | ||||||
|  |     Embeddable, | ||||||
|  |     Embedded, | ||||||
|  |     Entity, | ||||||
|  |     Enum, | ||||||
|  |     ManyToMany, | ||||||
|  |     OneToMany, | ||||||
|  |     PrimaryKey, | ||||||
|  |     Property, | ||||||
|  | } from '@mikro-orm/core'; | ||||||
|  | import { Language } from './language.js'; | ||||||
|  | import { Attachment } from './attachment.entity.js'; | ||||||
|  | import { Teacher } from '../users/teacher.entity.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class LearningObject { | ||||||
|  |     @PrimaryKey({ type: 'string' }) | ||||||
|  |     hruid!: string; | ||||||
|  | 
 | ||||||
|  |     @Enum({ items: () => Language, primary: true }) | ||||||
|  |     language!: Language; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'string' }) | ||||||
|  |     version: string = '1'; | ||||||
|  | 
 | ||||||
|  |     @ManyToMany({ entity: () => Teacher }) | ||||||
|  |     admins!: Teacher[]; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     title!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'text' }) | ||||||
|  |     description!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     contentType!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'array' }) | ||||||
|  |     keywords: string[] = []; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'array', nullable: true }) | ||||||
|  |     targetAges?: number[]; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'bool' }) | ||||||
|  |     teacherExclusive: boolean = false; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'array' }) | ||||||
|  |     skosConcepts!: string[]; | ||||||
|  | 
 | ||||||
|  |     @Embedded({ entity: () => EducationalGoal, array: true }) | ||||||
|  |     educationalGoals: EducationalGoal[] = []; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     copyright: string = ''; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     license: string = ''; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'smallint', nullable: true }) | ||||||
|  |     difficulty?: number; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'integer' }) | ||||||
|  |     estimatedTime!: number; | ||||||
|  | 
 | ||||||
|  |     @Embedded({ entity: () => ReturnValue }) | ||||||
|  |     returnValue!: ReturnValue; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'bool' }) | ||||||
|  |     available: boolean = true; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string', nullable: true }) | ||||||
|  |     contentLocation?: string; | ||||||
|  | 
 | ||||||
|  |     @OneToMany({ entity: () => Attachment, mappedBy: 'learningObject' }) | ||||||
|  |     attachments: Attachment[] = []; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'blob' }) | ||||||
|  |     content!: Buffer; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @Embeddable() | ||||||
|  | export class EducationalGoal { | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     source!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     id!: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @Embeddable() | ||||||
|  | export class ReturnValue { | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     callbackUrl!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'json' }) | ||||||
|  |     callbackSchema!: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export enum ContentType { | ||||||
|  |     Markdown = 'text/markdown', | ||||||
|  |     Image = 'image/image', | ||||||
|  |     Mpeg = 'audio/mpeg', | ||||||
|  |     Pdf = 'application/pdf', | ||||||
|  |     Extern = 'extern', | ||||||
|  |     Blockly = 'Blockly', | ||||||
|  | } | ||||||
							
								
								
									
										66
									
								
								backend/src/entities/content/learning-path.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								backend/src/entities/content/learning-path.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,66 @@ | ||||||
|  | import { | ||||||
|  |     Embeddable, | ||||||
|  |     Embedded, | ||||||
|  |     Entity, | ||||||
|  |     Enum, | ||||||
|  |     ManyToMany, | ||||||
|  |     OneToOne, | ||||||
|  |     PrimaryKey, | ||||||
|  |     Property, | ||||||
|  | } from '@mikro-orm/core'; | ||||||
|  | import { Language } from './language.js'; | ||||||
|  | import { Teacher } from '../users/teacher.entity.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class LearningPath { | ||||||
|  |     @PrimaryKey({ type: 'string' }) | ||||||
|  |     hruid!: string; | ||||||
|  | 
 | ||||||
|  |     @Enum({ items: () => Language, primary: true }) | ||||||
|  |     language!: Language; | ||||||
|  | 
 | ||||||
|  |     @ManyToMany({ entity: () => Teacher }) | ||||||
|  |     admins!: Teacher[]; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     title!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'text' }) | ||||||
|  |     description!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'blob' }) | ||||||
|  |     image!: string; | ||||||
|  | 
 | ||||||
|  |     @Embedded({ entity: () => LearningPathNode, array: true }) | ||||||
|  |     nodes: LearningPathNode[] = []; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @Embeddable() | ||||||
|  | export class LearningPathNode { | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     learningObjectHruid!: string; | ||||||
|  | 
 | ||||||
|  |     @Enum({ items: () => Language }) | ||||||
|  |     language!: Language; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     version!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'longtext' }) | ||||||
|  |     instruction!: string; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'bool' }) | ||||||
|  |     startNode!: boolean; | ||||||
|  | 
 | ||||||
|  |     @Embedded({ entity: () => LearningPathTransition, array: true }) | ||||||
|  |     transitions!: LearningPathTransition[]; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @Embeddable() | ||||||
|  | export class LearningPathTransition { | ||||||
|  |     @Property({ type: 'string' }) | ||||||
|  |     condition!: string; | ||||||
|  | 
 | ||||||
|  |     @OneToOne({ entity: () => LearningPathNode }) | ||||||
|  |     next!: LearningPathNode; | ||||||
|  | } | ||||||
							
								
								
									
										21
									
								
								backend/src/entities/questions/answer.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								backend/src/entities/questions/answer.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||||
|  | import { Question } from './question.entity'; | ||||||
|  | import { Teacher } from '../users/teacher.entity'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Answer { | ||||||
|  |     @ManyToOne({ entity: () => Teacher, primary: true }) | ||||||
|  |     author!: Teacher; | ||||||
|  | 
 | ||||||
|  |     @ManyToOne({ entity: () => Question, primary: true }) | ||||||
|  |     toQuestion!: Question; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'integer' }) | ||||||
|  |     sequenceNumber!: number; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'datetime' }) | ||||||
|  |     timestamp: Date = new Date(); | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'text' }) | ||||||
|  |     content!: string; | ||||||
|  | } | ||||||
							
								
								
									
										27
									
								
								backend/src/entities/questions/question.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								backend/src/entities/questions/question.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | ||||||
|  | import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||||
|  | import { Language } from '../content/language.js'; | ||||||
|  | import { Student } from '../users/student.entity.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Question { | ||||||
|  |     @PrimaryKey({ type: 'string' }) | ||||||
|  |     learningObjectHruid!: string; | ||||||
|  | 
 | ||||||
|  |     @Enum({ items: () => Language, primary: true }) | ||||||
|  |     learningObjectLanguage!: Language; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'string' }) | ||||||
|  |     learningObjectVersion: string = '1'; | ||||||
|  | 
 | ||||||
|  |     @PrimaryKey({ type: 'integer' }) | ||||||
|  |     sequenceNumber!: number; | ||||||
|  | 
 | ||||||
|  |     @ManyToOne({ entity: () => Student }) | ||||||
|  |     author!: Student; | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'datetime' }) | ||||||
|  |     timestamp: Date = new Date(); | ||||||
|  | 
 | ||||||
|  |     @Property({ type: 'text' }) | ||||||
|  |     content!: string; | ||||||
|  | } | ||||||
							
								
								
									
										22
									
								
								backend/src/entities/users/student.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								backend/src/entities/users/student.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | ||||||
|  | import { User } from './user.entity.js'; | ||||||
|  | import { Collection, Entity, ManyToMany } from '@mikro-orm/core'; | ||||||
|  | import { Class } from '../classes/class.entity.js'; | ||||||
|  | import { Group } from '../assignments/group.entity.js'; | ||||||
|  | import { StudentRepository } from '../../data/users/student-repository.js'; | ||||||
|  | 
 | ||||||
|  | @Entity({ repository: () => StudentRepository }) | ||||||
|  | export class Student extends User { | ||||||
|  |     @ManyToMany(() => Class) | ||||||
|  |     classes!: Collection<Class>; | ||||||
|  | 
 | ||||||
|  |     @ManyToMany(() => Group) | ||||||
|  |     groups!: Collection<Group>; | ||||||
|  | 
 | ||||||
|  |     constructor( | ||||||
|  |         public username: string, | ||||||
|  |         public firstName: string, | ||||||
|  |         public lastName: string | ||||||
|  |     ) { | ||||||
|  |         super(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										9
									
								
								backend/src/entities/users/teacher.entity.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								backend/src/entities/users/teacher.entity.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | ||||||
|  | import { Collection, Entity, ManyToMany } from '@mikro-orm/core'; | ||||||
|  | import { User } from './user.entity.js'; | ||||||
|  | import { Class } from '../classes/class.entity.js'; | ||||||
|  | 
 | ||||||
|  | @Entity() | ||||||
|  | export class Teacher extends User { | ||||||
|  |     @ManyToMany(() => Class) | ||||||
|  |     classes!: Collection<Class>; | ||||||
|  | } | ||||||
|  | @ -1,9 +1,9 @@ | ||||||
| import { Entity, PrimaryKey, Property } from '@mikro-orm/core'; | import { Entity, PrimaryKey, Property } from '@mikro-orm/core'; | ||||||
| 
 | 
 | ||||||
| @Entity() | @Entity({ abstract: true }) | ||||||
| export class User { | export abstract class User { | ||||||
|     @PrimaryKey({ type: 'number' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|     id!: number; |     username!: string; | ||||||
| 
 | 
 | ||||||
|     @Property() |     @Property() | ||||||
|     firstName: string = ''; |     firstName: string = ''; | ||||||
|  | @ -1,12 +1,35 @@ | ||||||
| import { Options } from '@mikro-orm/core'; | import { Options } from '@mikro-orm/core'; | ||||||
| import { PostgreSqlDriver } from '@mikro-orm/postgresql'; | import { PostgreSqlDriver } from '@mikro-orm/postgresql'; | ||||||
|  | import { EnvVars, getEnvVar, getNumericEnvVar } from './util/envvars.js'; | ||||||
|  | import { SqliteDriver } from '@mikro-orm/sqlite'; | ||||||
| 
 | 
 | ||||||
| const config: Options = { | const entities = ['dist/**/*.entity.js']; | ||||||
|  | const entitiesTs = ['src/**/*.entity.ts']; | ||||||
|  | function config(testingMode: boolean = false): Options { | ||||||
|  |     if (testingMode) { | ||||||
|  |         return { | ||||||
|  |             driver: SqliteDriver, | ||||||
|  |             dbName: getEnvVar(EnvVars.DbName), | ||||||
|  |             entities: entities, | ||||||
|  |             entitiesTs: entitiesTs, | ||||||
|  | 
 | ||||||
|  |             // Workaround: vitest: `TypeError: Unknown file extension ".ts"` (ERR_UNKNOWN_FILE_EXTENSION)
 | ||||||
|  |             // (see https://mikro-orm.io/docs/guide/project-setup#testing-the-endpoint)
 | ||||||
|  |             dynamicImportProvider: (id) => import(id), | ||||||
|  |         }; | ||||||
|  |     } else { | ||||||
|  |         return { | ||||||
|             driver: PostgreSqlDriver, |             driver: PostgreSqlDriver, | ||||||
|     dbName: 'dwengo', |             host: getEnvVar(EnvVars.DbHost), | ||||||
|     entities: ['dist/**/*.entity.js'], |             port: getNumericEnvVar(EnvVars.DbPort), | ||||||
|     entitiesTs: ['src/**/*.entity.ts'], |             dbName: getEnvVar(EnvVars.DbName), | ||||||
|  |             user: getEnvVar(EnvVars.DbUsername), | ||||||
|  |             password: getEnvVar(EnvVars.DbPassword), | ||||||
|  |             entities: entities, | ||||||
|  |             entitiesTs: entitiesTs, | ||||||
|             debug: true, |             debug: true, | ||||||
|         }; |         }; | ||||||
|  |     } | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| export default config; | export default config; | ||||||
|  |  | ||||||
|  | @ -1,6 +1,30 @@ | ||||||
| import { MikroORM } from '@mikro-orm/core'; | import { EntityManager, MikroORM } from '@mikro-orm/core'; | ||||||
| import config from './mikro-orm.config.js'; | import config from './mikro-orm.config.js'; | ||||||
|  | import { EnvVars, getEnvVar } from './util/envvars.js'; | ||||||
| 
 | 
 | ||||||
| export default async function initORM() { | let orm: MikroORM | undefined; | ||||||
|     await MikroORM.init(config); | export async function initORM(testingMode: boolean = false) { | ||||||
|  |     orm = await MikroORM.init(config(testingMode)); | ||||||
|  |     // Update the database scheme if necessary and enabled.
 | ||||||
|  |     if (getEnvVar(EnvVars.DbUpdate)) { | ||||||
|  |         await orm.schema.updateSchema(); | ||||||
|  |     } else { | ||||||
|  |         const diff = await orm.schema.getUpdateSchemaSQL(); | ||||||
|  |         if (diff) { | ||||||
|  |             throw Error( | ||||||
|  |                 'The database structure needs to be updated in order to fit the new database structure ' + | ||||||
|  |                     'of the app. In order to do so automatically, set the environment variable DWENGO_DB_UPDATE to true. ' + | ||||||
|  |                     'The following queries will then be executed:\n' + | ||||||
|  |                     diff | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | export function forkEntityManager(): EntityManager { | ||||||
|  |     if (!orm) { | ||||||
|  |         throw Error( | ||||||
|  |             'Accessing the Entity Manager before the ORM is fully initialized.' | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  |     return orm.em.fork(); | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										54
									
								
								backend/src/routes/assignment.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								backend/src/routes/assignment.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // root endpoint used to search objects
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         assignments: [ | ||||||
|  |             '0', | ||||||
|  |             '1', | ||||||
|  |         ] | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // information about an assignment with id 'id'
 | ||||||
|  | router.get('/:id', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         id: req.params.id, | ||||||
|  |         title: 'Dit is een test assignment', | ||||||
|  |         description: 'Een korte beschrijving', | ||||||
|  |         groups: [ '0' ], | ||||||
|  |         learningPath: '0', | ||||||
|  |         class: '0', | ||||||
|  |         links: { | ||||||
|  |             self: `${req.baseUrl}/${req.params.id}`, | ||||||
|  |             submissions: `${req.baseUrl}/${req.params.id}`, | ||||||
|  |         }, | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | router.get('/:id/submissions', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         submissions: [ | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | router.get('/:id/groups', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         groups: [ | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | router.get('/:id/questions', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         questions: [ | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										55
									
								
								backend/src/routes/class.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								backend/src/routes/class.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // root endpoint used to search objects
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         classes: [ | ||||||
|  |             '0', | ||||||
|  |             '1', | ||||||
|  |         ] | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // information about an class with id 'id'
 | ||||||
|  | router.get('/:id', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         id: req.params.id, | ||||||
|  |         displayName: 'Klas 4B', | ||||||
|  |         teachers: [ '0' ], | ||||||
|  |         students: [ '0' ], | ||||||
|  |         joinRequests: [ '0' ], | ||||||
|  |         links: { | ||||||
|  |             self: `${req.baseUrl}/${req.params.id}`, | ||||||
|  |             classes: `${req.baseUrl}/${req.params.id}/invitations`, | ||||||
|  |             questions: `${req.baseUrl}/${req.params.id}/assignments`, | ||||||
|  |             students: `${req.baseUrl}/${req.params.id}/students`, | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | router.get('/:id/invitations', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         invitations: [  | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | router.get('/:id/assignments', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         assignments: [  | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | router.get('/:id/students', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         students: [  | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										34
									
								
								backend/src/routes/group.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								backend/src/routes/group.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // root endpoint used to search objects
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         groups: [ | ||||||
|  |             '0', | ||||||
|  |             '1', | ||||||
|  |         ] | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // information about a group (members, ... [TODO DOC])
 | ||||||
|  | router.get('/:id', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         id: req.params.id, | ||||||
|  |         assignment: '0', | ||||||
|  |         students: [ '0' ], | ||||||
|  |         submissions: [ '0' ], | ||||||
|  |         // reference to other endpoint
 | ||||||
|  |         // should be less hardcoded
 | ||||||
|  |         questions: `/group/${req.params.id}/question`,  | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | // the list of questions a group has made
 | ||||||
|  | router.get('/:id/question', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         questions: [ '0' ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										14
									
								
								backend/src/routes/login.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								backend/src/routes/login.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // returns login paths for IDP
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         // dummy variables, needs to be changed
 | ||||||
|  |         // with IDP endpoints
 | ||||||
|  |         leerkracht: '/login-leerkracht', | ||||||
|  |         leerling: '/login-leerling', | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										38
									
								
								backend/src/routes/question.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								backend/src/routes/question.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // root endpoint used to search objects
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         questions: [ | ||||||
|  |             '0', | ||||||
|  |             '1', | ||||||
|  |         ] | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // information about an question with id 'id'
 | ||||||
|  | router.get('/:id', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         id: req.params.id, | ||||||
|  |         student: '0', | ||||||
|  |         group: '0', | ||||||
|  |         time: new Date(2025, 1, 1), | ||||||
|  |         content: 'Zijn alle gehele getallen groter dan 2 gelijk aan de som van 2 priemgetallen????', | ||||||
|  |         learningObject: '0', | ||||||
|  |         links: { | ||||||
|  |             self: `${req.baseUrl}/${req.params.id}`, | ||||||
|  |             answers: `${req.baseUrl}/${req.params.id}/answers`, | ||||||
|  |         } | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | router.get('/:id/answers', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         answers: [ | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }) | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										59
									
								
								backend/src/routes/student.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								backend/src/routes/student.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,59 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // root endpoint used to search objects
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         students: [ | ||||||
|  |             '0', | ||||||
|  |             '1', | ||||||
|  |         ] | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // information about a student's profile
 | ||||||
|  | router.get('/:id', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         id: req.params.id, | ||||||
|  |         firstName: 'Jimmy', | ||||||
|  |         lastName: 'Faster', | ||||||
|  |         username: 'JimmyFaster2', | ||||||
|  |         endpoints: { | ||||||
|  |             classes: `/student/${req.params.id}/classes`, | ||||||
|  |             questions: `/student/${req.params.id}/submissions`, | ||||||
|  |             invitations: `/student/${req.params.id}/assignments`, | ||||||
|  |             groups: `/student/${req.params.id}/groups`, | ||||||
|  |         }, | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // the list of classes a student is in
 | ||||||
|  | router.get('/:id/classes', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         classes: [ '0' ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | // the list of submissions a student has made
 | ||||||
|  | router.get('/:id/submissions', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         submissions: [ '0' ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  |    | ||||||
|  | // the list of assignments a student has
 | ||||||
|  | router.get('/:id/assignments', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         assignments: [ '0' ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  |    | ||||||
|  | // the list of groups a student is in
 | ||||||
|  | router.get('/:id/groups', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         groups: [ '0' ], | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										26
									
								
								backend/src/routes/submission.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								backend/src/routes/submission.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // root endpoint used to search objects
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         submissions: [ | ||||||
|  |             '0', | ||||||
|  |             '1', | ||||||
|  |         ] | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // information about an submission with id 'id'
 | ||||||
|  | router.get('/:id', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         id: req.params.id, | ||||||
|  |         student: '0', | ||||||
|  |         group: '0', | ||||||
|  |         time: new Date(2025, 1, 1), | ||||||
|  |         content: 'Wortel 2 is rationeel', | ||||||
|  |         learningObject: '0', | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										58
									
								
								backend/src/routes/teacher.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								backend/src/routes/teacher.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,58 @@ | ||||||
|  | import express from 'express' | ||||||
|  | const router = express.Router(); | ||||||
|  | 
 | ||||||
|  | // root endpoint used to search objects
 | ||||||
|  | router.get('/', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         teachers: [ | ||||||
|  |             '0', | ||||||
|  |             '1', | ||||||
|  |         ] | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // information about a teacher
 | ||||||
|  | router.get('/:id', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         id: req.params.id, | ||||||
|  |         firstName: 'John', | ||||||
|  |         lastName: 'Doe', | ||||||
|  |         username: 'JohnDoe1', | ||||||
|  |         links: { | ||||||
|  |             self: `${req.baseUrl}/${req.params.id}`, | ||||||
|  |             classes: `${req.baseUrl}/${req.params.id}/classes`, | ||||||
|  |             questions: `${req.baseUrl}/${req.params.id}/questions`, | ||||||
|  |             invitations: `${req.baseUrl}/${req.params.id}/invitations`, | ||||||
|  |         }, | ||||||
|  |     }); | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | // the questions students asked a teacher
 | ||||||
|  | router.get('/:id/questions', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         questions: [ | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // invitations to other classes a teacher received
 | ||||||
|  | router.get('/:id/invitations', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         invitations: [ | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // a list with ids of classes a teacher is in
 | ||||||
|  | router.get('/:id/classes', (req, res) => { | ||||||
|  |     res.json({ | ||||||
|  |         classes: [ | ||||||
|  |             '0' | ||||||
|  |         ], | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | export default router | ||||||
							
								
								
									
										45
									
								
								backend/src/util/envvars.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								backend/src/util/envvars.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | ||||||
|  | const PREFIX = 'DWENGO_'; | ||||||
|  | const DB_PREFIX = PREFIX + 'DB_'; | ||||||
|  | 
 | ||||||
|  | type EnvVar = { key: string; required?: boolean; defaultValue?: any }; | ||||||
|  | 
 | ||||||
|  | export const EnvVars: { [key: string]: EnvVar } = { | ||||||
|  |     Port: { key: PREFIX + 'PORT', defaultValue: 3000 }, | ||||||
|  |     DbHost: { key: DB_PREFIX + 'HOST', required: true }, | ||||||
|  |     DbPort: { key: DB_PREFIX + 'PORT', defaultValue: 5432 }, | ||||||
|  |     DbName: { key: DB_PREFIX + 'NAME', defaultValue: 'dwengo' }, | ||||||
|  |     DbUsername: { key: DB_PREFIX + 'USERNAME', required: true }, | ||||||
|  |     DbPassword: { key: DB_PREFIX + 'PASSWORD', required: true }, | ||||||
|  |     DbUpdate: { key: DB_PREFIX + 'UPDATE', defaultValue: false }, | ||||||
|  | } as const; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Returns the value of the given environment variable if it is set. | ||||||
|  |  * Otherwise, | ||||||
|  |  * - throw an error if the environment variable was required, | ||||||
|  |  * - return the default value if there is one and it was not required, | ||||||
|  |  * - return an empty string if the environment variable is not required and there is also no default. | ||||||
|  |  * @param envVar The properties of the environment variable (from the EnvVar object). | ||||||
|  |  */ | ||||||
|  | export function getEnvVar(envVar: EnvVar): string { | ||||||
|  |     const value: string | undefined = process.env[envVar.key]; | ||||||
|  |     if (value) { | ||||||
|  |         return value; | ||||||
|  |     } else if (envVar.required) { | ||||||
|  |         throw new Error(`Missing environment variable: ${envVar.key}`); | ||||||
|  |     } else { | ||||||
|  |         return envVar.defaultValue || ''; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export function getNumericEnvVar(envVar: EnvVar): number { | ||||||
|  |     const valueString = getEnvVar(envVar); | ||||||
|  |     const value = parseInt(valueString); | ||||||
|  |     if (isNaN(value)) { | ||||||
|  |         throw new Error( | ||||||
|  |             `Invalid value for environment variable ${envVar.key}: ${valueString}. Expected a number.` | ||||||
|  |         ); | ||||||
|  |     } else { | ||||||
|  |         return value; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										33
									
								
								backend/tests/data/users.test.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								backend/tests/data/users.test.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | ||||||
|  | import {setupTestApp} from "../setup-tests.js" | ||||||
|  | import {Student} from "../../src/entities/users/student.entity.js"; | ||||||
|  | import {describe, it, expect, beforeAll} from "vitest"; | ||||||
|  | import {StudentRepository} from "../../src/data/users/student-repository.js"; | ||||||
|  | import {getStudentRepository} from "../../src/data/repositories.js"; | ||||||
|  | 
 | ||||||
|  | const username = "teststudent"; | ||||||
|  | const firstName = "John"; | ||||||
|  | const lastName = "Doe"; | ||||||
|  | describe("StudentRepository", () => { | ||||||
|  |     let studentRepository: StudentRepository; | ||||||
|  | 
 | ||||||
|  |     beforeAll(async () => { | ||||||
|  |         await setupTestApp(); | ||||||
|  |         studentRepository = getStudentRepository(); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it("should return the queried student after he was added", async () => { | ||||||
|  |         await studentRepository.insert(new Student(username, firstName, lastName)); | ||||||
|  | 
 | ||||||
|  |         let retrievedStudent = await studentRepository.findByUsername(username); | ||||||
|  |         expect(retrievedStudent).toBeTruthy(); | ||||||
|  |         expect(retrievedStudent?.firstName).toBe(firstName); | ||||||
|  |         expect(retrievedStudent?.lastName).toBe(lastName); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it("should no longer return the queried student after he was removed again", async () => { | ||||||
|  |         await studentRepository.deleteByUsername(username); | ||||||
|  | 
 | ||||||
|  |         let retrievedStudent = await studentRepository.findByUsername(username); | ||||||
|  |         expect(retrievedStudent).toBeNull(); | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  | @ -4,6 +4,6 @@ describe("Sample test", () => { | ||||||
|     it("should sum to 2", () => { |     it("should sum to 2", () => { | ||||||
|         const expected = 2; |         const expected = 2; | ||||||
|         const result = 1 + 1; |         const result = 1 + 1; | ||||||
|         expect(result).toBe(expected); |         expect(result).equals(expected); | ||||||
|     }); |     }); | ||||||
| }) | }) | ||||||
|  |  | ||||||
							
								
								
									
										7
									
								
								backend/tests/setup-tests.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								backend/tests/setup-tests.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | ||||||
|  | import {initORM} from "../src/orm.js"; | ||||||
|  | import dotenv from "dotenv"; | ||||||
|  | 
 | ||||||
|  | export async function setupTestApp() { | ||||||
|  |     dotenv.config({path: ".env.test"}); | ||||||
|  |     await initORM(true); | ||||||
|  | } | ||||||
							
								
								
									
										8
									
								
								backend/vitest.config.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								backend/vitest.config.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | ||||||
|  | import { defineConfig } from 'vitest/config'; | ||||||
|  | 
 | ||||||
|  | export default defineConfig({ | ||||||
|  |     test: { | ||||||
|  |         environment: 'node', | ||||||
|  |         globals: true | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  | @ -6,11 +6,9 @@ services: | ||||||
|       POSTGRES_PASSWORD: postgres |       POSTGRES_PASSWORD: postgres | ||||||
|       POSTGRES_DB: postgres |       POSTGRES_DB: postgres | ||||||
|     ports: |     ports: | ||||||
|       - "5432:5432" |       - "5431:5432" | ||||||
|     network_mode: "host" |  | ||||||
|     volumes: |     volumes: | ||||||
|         - postgres_data:/var/lib/postgresql/data |         - postgres_data:/var/lib/postgresql/data | ||||||
|         - ./backend/config/db/init.sql:/docker-entrypoint-initdb.d/init.sql |  | ||||||
| 
 | 
 | ||||||
| volumes: | volumes: | ||||||
|     postgres_data: |     postgres_data: | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								docs/architecture/schema.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/architecture/schema.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 105 KiB | 
							
								
								
									
										30
									
								
								docs/architecture/schema.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								docs/architecture/schema.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | ||||||
|  | from diagrams import Cluster, Diagram | ||||||
|  | from diagrams.custom import Custom | ||||||
|  | from diagrams.onprem.certificates import LetsEncrypt | ||||||
|  | from diagrams.onprem.container import Docker | ||||||
|  | from diagrams.onprem.database import PostgreSQL | ||||||
|  | from diagrams.onprem.logging import Loki | ||||||
|  | from diagrams.onprem.monitoring import Grafana | ||||||
|  | from diagrams.onprem.network import Nginx | ||||||
|  | from diagrams.programming.framework import Vue | ||||||
|  | from diagrams.programming.language import Nodejs | ||||||
|  | from diagrams.programming.flowchart import InputOutput | ||||||
|  | 
 | ||||||
|  | with Diagram("Dwengo-1 architectuur", filename="docs/architecture/schema", show=False): | ||||||
|  |     reverse_proxy = Nginx("reverse proxy") | ||||||
|  |     reverse_proxy >> LetsEncrypt("SSL") | ||||||
|  | 
 | ||||||
|  |     with Cluster("Docker"): | ||||||
|  |         Docker() | ||||||
|  | 
 | ||||||
|  |         frontend = Vue("/") | ||||||
|  |         backend = Nodejs("/api") | ||||||
|  |         reverse_proxy >> frontend | ||||||
|  |         frontend >> backend >> InputOutput("MikroORM") >> PostgreSQL() | ||||||
|  | 
 | ||||||
|  |         backend >> Loki("logging") >> Grafana("monitoring") | ||||||
|  | 
 | ||||||
|  |     with Cluster("Dwengo"): | ||||||
|  |         dwengo = Custom("Dwengo", "../../assets/img/dwengo-groen-zwart.png") | ||||||
|  | 
 | ||||||
|  |     backend >> dwengo | ||||||
							
								
								
									
										1
									
								
								docs/requirements.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								docs/requirements.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | diagrams==0.24.1 | ||||||
|  | @ -6,6 +6,8 @@ This template should help get you started developing with Vue 3 in Vite. | ||||||
| 
 | 
 | ||||||
| [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). | [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). | ||||||
| 
 | 
 | ||||||
|  | Webstorm should work out of the box. | ||||||
|  | 
 | ||||||
| ## Type Support for `.vue` Imports in TS | ## Type Support for `.vue` Imports in TS | ||||||
| 
 | 
 | ||||||
| TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. | TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. | ||||||
|  |  | ||||||
							
								
								
									
										6825
									
								
								frontend/package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										6825
									
								
								frontend/package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -1,91 +1,10 @@ | ||||||
| <script setup lang="ts"> | <script setup lang="ts"> | ||||||
|     import { RouterLink, RouterView } from "vue-router"; |  | ||||||
|     import HelloWorld from "./components/HelloWorld.vue"; |  | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <template> | <template> | ||||||
|     <header> |     <router-view/> | ||||||
|         <img |  | ||||||
|             alt="Vue logo" |  | ||||||
|             class="logo" |  | ||||||
|             src="@/assets/logo.svg" |  | ||||||
|             width="125" |  | ||||||
|             height="125" |  | ||||||
|         /> |  | ||||||
| 
 |  | ||||||
|         <div class="wrapper"> |  | ||||||
|             <HelloWorld msg="You did it!" /> |  | ||||||
| 
 |  | ||||||
|             <nav> |  | ||||||
|                 <RouterLink to="/">Home</RouterLink> |  | ||||||
|                 <RouterLink to="/about">About</RouterLink> |  | ||||||
|             </nav> |  | ||||||
|         </div> |  | ||||||
|     </header> |  | ||||||
| 
 |  | ||||||
|     <RouterView /> |  | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <style scoped> | <style scoped> | ||||||
|     header { |  | ||||||
|         line-height: 1.5; |  | ||||||
|         max-height: 100vh; |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     .logo { |  | ||||||
|         display: block; |  | ||||||
|         margin: 0 auto 2rem; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     nav { |  | ||||||
|         width: 100%; |  | ||||||
|         font-size: 12px; |  | ||||||
|         text-align: center; |  | ||||||
|         margin-top: 2rem; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     nav a.router-link-exact-active { |  | ||||||
|         color: var(--color-text); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     nav a.router-link-exact-active:hover { |  | ||||||
|         background-color: transparent; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     nav a { |  | ||||||
|         display: inline-block; |  | ||||||
|         padding: 0 1rem; |  | ||||||
|         border-left: 1px solid var(--color-border); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     nav a:first-of-type { |  | ||||||
|         border: 0; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @media (min-width: 1024px) { |  | ||||||
|         header { |  | ||||||
|             display: flex; |  | ||||||
|             place-items: center; |  | ||||||
|             padding-right: calc(var(--section-gap) / 2); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         .logo { |  | ||||||
|             margin: 0 2rem 0 0; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         header .wrapper { |  | ||||||
|             display: flex; |  | ||||||
|             place-items: flex-start; |  | ||||||
|             flex-wrap: wrap; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         nav { |  | ||||||
|             text-align: left; |  | ||||||
|             margin-left: -1rem; |  | ||||||
|             font-size: 1rem; |  | ||||||
| 
 |  | ||||||
|             padding: 1rem 0; |  | ||||||
|             margin-top: 1rem; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| </style> | </style> | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								frontend/src/components/BrowseThemes.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/components/BrowseThemes.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | // This component contains a list with all themes and will be shown on a student's and teacher's homepage. | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/components/LearningPath.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/components/LearningPath.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/components/MenuBar.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/components/MenuBar.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  | <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
|  | @ -1,178 +0,0 @@ | ||||||
| <script setup lang="ts"> |  | ||||||
|     import WelcomeItem from "./WelcomeItem.vue"; |  | ||||||
|     import DocumentationIcon from "./icons/IconDocumentation.vue"; |  | ||||||
|     import ToolingIcon from "./icons/IconTooling.vue"; |  | ||||||
|     import EcosystemIcon from "./icons/IconEcosystem.vue"; |  | ||||||
|     import CommunityIcon from "./icons/IconCommunity.vue"; |  | ||||||
|     import SupportIcon from "./icons/IconSupport.vue"; |  | ||||||
| 
 |  | ||||||
|     function openReadmeInEditor() { |  | ||||||
|         return fetch("/__open-in-editor?file=README.md"); |  | ||||||
|     } |  | ||||||
| </script> |  | ||||||
| 
 |  | ||||||
| <template> |  | ||||||
|     <WelcomeItem> |  | ||||||
|         <template #icon> |  | ||||||
|             <DocumentationIcon /> |  | ||||||
|         </template> |  | ||||||
|         <template #heading>Documentation</template> |  | ||||||
| 
 |  | ||||||
|         Vue’s |  | ||||||
|         <a |  | ||||||
|             href="https://vuejs.org/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >official documentation</a |  | ||||||
|         > |  | ||||||
|         provides you with all information you need to get started. |  | ||||||
|     </WelcomeItem> |  | ||||||
| 
 |  | ||||||
|     <WelcomeItem> |  | ||||||
|         <template #icon> |  | ||||||
|             <ToolingIcon /> |  | ||||||
|         </template> |  | ||||||
|         <template #heading>Tooling</template> |  | ||||||
| 
 |  | ||||||
|         This project is served and bundled with |  | ||||||
|         <a |  | ||||||
|             href="https://vite.dev/guide/features.html" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Vite</a |  | ||||||
|         >. The recommended IDE setup is |  | ||||||
|         <a |  | ||||||
|             href="https://code.visualstudio.com/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >VSCode</a |  | ||||||
|         > |  | ||||||
|         + |  | ||||||
|         <a |  | ||||||
|             href="https://github.com/johnsoncodehk/volar" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Volar</a |  | ||||||
|         >. If you need to test your components and web pages, check out |  | ||||||
|         <a |  | ||||||
|             href="https://vitest.dev/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Vitest</a |  | ||||||
|         > |  | ||||||
|         and |  | ||||||
|         <a |  | ||||||
|             href="https://www.cypress.io/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Cypress</a |  | ||||||
|         > |  | ||||||
|         / |  | ||||||
|         <a |  | ||||||
|             href="https://playwright.dev/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Playwright</a |  | ||||||
|         >. |  | ||||||
| 
 |  | ||||||
|         <br /> |  | ||||||
| 
 |  | ||||||
|         More instructions are available in |  | ||||||
|         <a |  | ||||||
|             href="javascript:void(0)" |  | ||||||
|             @click="openReadmeInEditor" |  | ||||||
|             ><code>README.md</code></a |  | ||||||
|         >. |  | ||||||
|     </WelcomeItem> |  | ||||||
| 
 |  | ||||||
|     <WelcomeItem> |  | ||||||
|         <template #icon> |  | ||||||
|             <EcosystemIcon /> |  | ||||||
|         </template> |  | ||||||
|         <template #heading>Ecosystem</template> |  | ||||||
| 
 |  | ||||||
|         Get official tools and libraries for your project: |  | ||||||
|         <a |  | ||||||
|             href="https://pinia.vuejs.org/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Pinia</a |  | ||||||
|         >, |  | ||||||
|         <a |  | ||||||
|             href="https://router.vuejs.org/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Vue Router</a |  | ||||||
|         >, |  | ||||||
|         <a |  | ||||||
|             href="https://test-utils.vuejs.org/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Vue Test Utils</a |  | ||||||
|         >, and |  | ||||||
|         <a |  | ||||||
|             href="https://github.com/vuejs/devtools" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Vue Dev Tools</a |  | ||||||
|         >. If you need more resources, we suggest paying |  | ||||||
|         <a |  | ||||||
|             href="https://github.com/vuejs/awesome-vue" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Awesome Vue</a |  | ||||||
|         > |  | ||||||
|         a visit. |  | ||||||
|     </WelcomeItem> |  | ||||||
| 
 |  | ||||||
|     <WelcomeItem> |  | ||||||
|         <template #icon> |  | ||||||
|             <CommunityIcon /> |  | ||||||
|         </template> |  | ||||||
|         <template #heading>Community</template> |  | ||||||
| 
 |  | ||||||
|         Got stuck? Ask your question on |  | ||||||
|         <a |  | ||||||
|             href="https://chat.vuejs.org" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >Vue Land</a |  | ||||||
|         > |  | ||||||
|         (our official Discord server), or |  | ||||||
|         <a |  | ||||||
|             href="https://stackoverflow.com/questions/tagged/vue.js" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >StackOverflow</a |  | ||||||
|         >. You should also follow the official |  | ||||||
|         <a |  | ||||||
|             href="https://bsky.app/profile/vuejs.org" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >@vuejs.org</a |  | ||||||
|         > |  | ||||||
|         Bluesky account or the |  | ||||||
|         <a |  | ||||||
|             href="https://x.com/vuejs" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >@vuejs</a |  | ||||||
|         > |  | ||||||
|         X account for latest news in the Vue world. |  | ||||||
|     </WelcomeItem> |  | ||||||
| 
 |  | ||||||
|     <WelcomeItem> |  | ||||||
|         <template #icon> |  | ||||||
|             <SupportIcon /> |  | ||||||
|         </template> |  | ||||||
|         <template #heading>Support Vue</template> |  | ||||||
| 
 |  | ||||||
|         As an independent project, Vue relies on community backing for its sustainability. You can help us by |  | ||||||
|         <a |  | ||||||
|             href="https://vuejs.org/sponsor/" |  | ||||||
|             target="_blank" |  | ||||||
|             rel="noopener" |  | ||||||
|             >becoming a sponsor</a |  | ||||||
|         >. |  | ||||||
|     </WelcomeItem> |  | ||||||
| </template> |  | ||||||
|  | @ -1,87 +0,0 @@ | ||||||
| <template> |  | ||||||
|     <div class="item"> |  | ||||||
|         <i> |  | ||||||
|             <slot name="icon"></slot> |  | ||||||
|         </i> |  | ||||||
|         <div class="details"> |  | ||||||
|             <h3> |  | ||||||
|                 <slot name="heading"></slot> |  | ||||||
|             </h3> |  | ||||||
|             <slot></slot> |  | ||||||
|         </div> |  | ||||||
|     </div> |  | ||||||
| </template> |  | ||||||
| 
 |  | ||||||
| <style scoped> |  | ||||||
|     .item { |  | ||||||
|         margin-top: 2rem; |  | ||||||
|         display: flex; |  | ||||||
|         position: relative; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     .details { |  | ||||||
|         flex: 1; |  | ||||||
|         margin-left: 1rem; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     i { |  | ||||||
|         display: flex; |  | ||||||
|         place-items: center; |  | ||||||
|         place-content: center; |  | ||||||
|         width: 32px; |  | ||||||
|         height: 32px; |  | ||||||
| 
 |  | ||||||
|         color: var(--color-text); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     h3 { |  | ||||||
|         font-size: 1.2rem; |  | ||||||
|         font-weight: 500; |  | ||||||
|         margin-bottom: 0.4rem; |  | ||||||
|         color: var(--color-heading); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @media (min-width: 1024px) { |  | ||||||
|         .item { |  | ||||||
|             margin-top: 0; |  | ||||||
|             padding: 0.4rem 0 1rem calc(var(--section-gap) / 2); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         i { |  | ||||||
|             top: calc(50% - 25px); |  | ||||||
|             left: -26px; |  | ||||||
|             position: absolute; |  | ||||||
|             border: 1px solid var(--color-border); |  | ||||||
|             background: var(--color-background); |  | ||||||
|             border-radius: 8px; |  | ||||||
|             width: 50px; |  | ||||||
|             height: 50px; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         .item:before { |  | ||||||
|             content: " "; |  | ||||||
|             border-left: 1px solid var(--color-border); |  | ||||||
|             position: absolute; |  | ||||||
|             left: 0; |  | ||||||
|             bottom: calc(50% + 25px); |  | ||||||
|             height: calc(50% - 25px); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         .item:after { |  | ||||||
|             content: " "; |  | ||||||
|             border-left: 1px solid var(--color-border); |  | ||||||
|             position: absolute; |  | ||||||
|             left: 0; |  | ||||||
|             top: calc(50% + 25px); |  | ||||||
|             height: calc(50% - 25px); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         .item:first-of-type:before { |  | ||||||
|             display: none; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         .item:last-of-type:after { |  | ||||||
|             display: none; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| </style> |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import { describe, it, expect } from "vitest"; | import { describe, it, expect } from "vitest"; | ||||||
| 
 | 
 | ||||||
| import { mount } from "@vue/test-utils"; | import { mount } from "@vue/test-utils"; | ||||||
| import HelloWorld from "../HelloWorld.vue"; | import HelloWorld from "./HelloWorld.vue"; | ||||||
| 
 | 
 | ||||||
| describe("HelloWorld", () => { | describe("HelloWorld", () => { | ||||||
|     it("renders properly", () => { |     it("renders properly", () => { | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								frontend/src/components/errors/NotFound.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/components/errors/NotFound.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <b>404 - Page Not Found</b> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
|  | @ -1,12 +0,0 @@ | ||||||
| <template> |  | ||||||
|     <svg |  | ||||||
|         xmlns="http://www.w3.org/2000/svg" |  | ||||||
|         width="20" |  | ||||||
|         height="20" |  | ||||||
|         fill="currentColor" |  | ||||||
|     > |  | ||||||
|         <path |  | ||||||
|             d="M15 4a1 1 0 1 0 0 2V4zm0 11v-1a1 1 0 0 0-1 1h1zm0 4l-.707.707A1 1 0 0 0 16 19h-1zm-4-4l.707-.707A1 1 0 0 0 11 14v1zm-4.707-1.293a1 1 0 0 0-1.414 1.414l1.414-1.414zm-.707.707l-.707-.707.707.707zM9 11v-1a1 1 0 0 0-.707.293L9 11zm-4 0h1a1 1 0 0 0-1-1v1zm0 4H4a1 1 0 0 0 1.707.707L5 15zm10-9h2V4h-2v2zm2 0a1 1 0 0 1 1 1h2a3 3 0 0 0-3-3v2zm1 1v6h2V7h-2zm0 6a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2zm-1 1h-2v2h2v-2zm-3 1v4h2v-4h-2zm1.707 3.293l-4-4-1.414 1.414 4 4 1.414-1.414zM11 14H7v2h4v-2zm-4 0c-.276 0-.525-.111-.707-.293l-1.414 1.414C5.42 15.663 6.172 16 7 16v-2zm-.707 1.121l3.414-3.414-1.414-1.414-3.414 3.414 1.414 1.414zM9 12h4v-2H9v2zm4 0a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2zm3-3V3h-2v6h2zm0-6a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2zm-3-3H3v2h10V0zM3 0a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1V0zM0 3v6h2V3H0zm0 6a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1H0zm3 3h2v-2H3v2zm1-1v4h2v-4H4zm1.707 4.707l.586-.586-1.414-1.414-.586.586 1.414 1.414z" |  | ||||||
|         /> |  | ||||||
|     </svg> |  | ||||||
| </template> |  | ||||||
|  | @ -1,12 +0,0 @@ | ||||||
| <template> |  | ||||||
|     <svg |  | ||||||
|         xmlns="http://www.w3.org/2000/svg" |  | ||||||
|         width="20" |  | ||||||
|         height="17" |  | ||||||
|         fill="currentColor" |  | ||||||
|     > |  | ||||||
|         <path |  | ||||||
|             d="M11 2.253a1 1 0 1 0-2 0h2zm-2 13a1 1 0 1 0 2 0H9zm.447-12.167a1 1 0 1 0 1.107-1.666L9.447 3.086zM1 2.253L.447 1.42A1 1 0 0 0 0 2.253h1zm0 13H0a1 1 0 0 0 1.553.833L1 15.253zm8.447.833a1 1 0 1 0 1.107-1.666l-1.107 1.666zm0-14.666a1 1 0 1 0 1.107 1.666L9.447 1.42zM19 2.253h1a1 1 0 0 0-.447-.833L19 2.253zm0 13l-.553.833A1 1 0 0 0 20 15.253h-1zm-9.553-.833a1 1 0 1 0 1.107 1.666L9.447 14.42zM9 2.253v13h2v-13H9zm1.553-.833C9.203.523 7.42 0 5.5 0v2c1.572 0 2.961.431 3.947 1.086l1.107-1.666zM5.5 0C3.58 0 1.797.523.447 1.42l1.107 1.666C2.539 2.431 3.928 2 5.5 2V0zM0 2.253v13h2v-13H0zm1.553 13.833C2.539 15.431 3.928 15 5.5 15v-2c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM5.5 15c1.572 0 2.961.431 3.947 1.086l1.107-1.666C9.203 13.523 7.42 13 5.5 13v2zm5.053-11.914C11.539 2.431 12.928 2 14.5 2V0c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM14.5 2c1.573 0 2.961.431 3.947 1.086l1.107-1.666C18.203.523 16.421 0 14.5 0v2zm3.5.253v13h2v-13h-2zm1.553 12.167C18.203 13.523 16.421 13 14.5 13v2c1.573 0 2.961.431 3.947 1.086l1.107-1.666zM14.5 13c-1.92 0-3.703.523-5.053 1.42l1.107 1.666C11.539 15.431 12.928 15 14.5 15v-2z" |  | ||||||
|         /> |  | ||||||
|     </svg> |  | ||||||
| </template> |  | ||||||
|  | @ -1,12 +0,0 @@ | ||||||
| <template> |  | ||||||
|     <svg |  | ||||||
|         xmlns="http://www.w3.org/2000/svg" |  | ||||||
|         width="18" |  | ||||||
|         height="20" |  | ||||||
|         fill="currentColor" |  | ||||||
|     > |  | ||||||
|         <path |  | ||||||
|             d="M11.447 8.894a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm0 1.789a1 1 0 1 0 .894-1.789l-.894 1.789zM7.447 7.106a1 1 0 1 0-.894 1.789l.894-1.789zM10 9a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0H8zm9.447-5.606a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm2 .789a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zM18 5a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0h-2zm-5.447-4.606a1 1 0 1 0 .894-1.789l-.894 1.789zM9 1l.447-.894a1 1 0 0 0-.894 0L9 1zm-2.447.106a1 1 0 1 0 .894 1.789l-.894-1.789zm-6 3a1 1 0 1 0 .894 1.789L.553 4.106zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zm-2-.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 2.789a1 1 0 1 0 .894-1.789l-.894 1.789zM2 5a1 1 0 1 0-2 0h2zM0 7.5a1 1 0 1 0 2 0H0zm8.553 12.394a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 1a1 1 0 1 0 .894 1.789l-.894-1.789zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zM8 19a1 1 0 1 0 2 0H8zm2-2.5a1 1 0 1 0-2 0h2zm-7.447.394a1 1 0 1 0 .894-1.789l-.894 1.789zM1 15H0a1 1 0 0 0 .553.894L1 15zm1-2.5a1 1 0 1 0-2 0h2zm12.553 2.606a1 1 0 1 0 .894 1.789l-.894-1.789zM17 15l.447.894A1 1 0 0 0 18 15h-1zm1-2.5a1 1 0 1 0-2 0h2zm-7.447-5.394l-2 1 .894 1.789 2-1-.894-1.789zm-1.106 1l-2-1-.894 1.789 2 1 .894-1.789zM8 9v2.5h2V9H8zm8.553-4.894l-2 1 .894 1.789 2-1-.894-1.789zm.894 0l-2-1-.894 1.789 2 1 .894-1.789zM16 5v2.5h2V5h-2zm-4.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zm-2.894-1l-2 1 .894 1.789 2-1L8.553.106zM1.447 5.894l2-1-.894-1.789-2 1 .894 1.789zm-.894 0l2 1 .894-1.789-2-1-.894 1.789zM0 5v2.5h2V5H0zm9.447 13.106l-2-1-.894 1.789 2 1 .894-1.789zm0 1.789l2-1-.894-1.789-2 1 .894 1.789zM10 19v-2.5H8V19h2zm-6.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zM2 15v-2.5H0V15h2zm13.447 1.894l2-1-.894-1.789-2 1 .894 1.789zM18 15v-2.5h-2V15h2z" |  | ||||||
|         /> |  | ||||||
|     </svg> |  | ||||||
| </template> |  | ||||||
|  | @ -1,12 +0,0 @@ | ||||||
| <template> |  | ||||||
|     <svg |  | ||||||
|         xmlns="http://www.w3.org/2000/svg" |  | ||||||
|         width="20" |  | ||||||
|         height="20" |  | ||||||
|         fill="currentColor" |  | ||||||
|     > |  | ||||||
|         <path |  | ||||||
|             d="M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.666.105 5.5 5.5 0 0 0-.114 7.665L10 18.78l8.39-8.4a5.5 5.5 0 0 0-.114-7.665 5.5 5.5 0 0 0-7.666-.105l-.61.61z" |  | ||||||
|         /> |  | ||||||
|     </svg> |  | ||||||
| </template> |  | ||||||
|  | @ -1,19 +0,0 @@ | ||||||
| <!-- This icon is from <https://github.com/Templarian/MaterialDesign>, distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license--> |  | ||||||
| <template> |  | ||||||
|     <svg |  | ||||||
|         xmlns="http://www.w3.org/2000/svg" |  | ||||||
|         xmlns:xlink="http://www.w3.org/1999/xlink" |  | ||||||
|         aria-hidden="true" |  | ||||||
|         role="img" |  | ||||||
|         class="iconify iconify--mdi" |  | ||||||
|         width="24" |  | ||||||
|         height="24" |  | ||||||
|         preserveAspectRatio="xMidYMid meet" |  | ||||||
|         viewBox="0 0 24 24" |  | ||||||
|     > |  | ||||||
|         <path |  | ||||||
|             d="M20 18v-4h-3v1h-2v-1H9v1H7v-1H4v4h16M6.33 8l-1.74 4H7v-1h2v1h6v-1h2v1h2.41l-1.74-4H6.33M9 5v1h6V5H9m12.84 7.61c.1.22.16.48.16.8V18c0 .53-.21 1-.6 1.41c-.4.4-.85.59-1.4.59H4c-.55 0-1-.19-1.4-.59C2.21 19 2 18.53 2 18v-4.59c0-.32.06-.58.16-.8L4.5 7.22C4.84 6.41 5.45 6 6.33 6H7V5c0-.55.18-1 .57-1.41C7.96 3.2 8.44 3 9 3h6c.56 0 1.04.2 1.43.59c.39.41.57.86.57 1.41v1h.67c.88 0 1.49.41 1.83 1.22l2.34 5.39z" |  | ||||||
|             fill="currentColor" |  | ||||||
|         ></path> |  | ||||||
|     </svg> |  | ||||||
| </template> |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| import "./assets/main.css"; |  | ||||||
| import { createApp } from "vue"; | import { createApp } from "vue"; | ||||||
| 
 | 
 | ||||||
| // Vuetify
 | // Vuetify
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,20 @@ | ||||||
| import {createRouter, createWebHistory} from "vue-router"; | import {createRouter, createWebHistory} from "vue-router"; | ||||||
| import HomeView from "../views/HomeView.vue"; | import MenuBar from "@/components/MenuBar.vue"; | ||||||
|  | import StudentHomepage from "@/views/StudentHomepage.vue"; | ||||||
|  | import StudentAssignments from "@/views/assignments/StudentAssignments.vue"; | ||||||
|  | import StudentClasses from "@/views/classes/StudentClasses.vue"; | ||||||
|  | import StudentDiscussions from "@/views/discussions/StudentDiscussions.vue"; | ||||||
|  | import TeacherHomepage from "@/views/TeacherHomepage.vue"; | ||||||
|  | import TeacherAssignments from "@/views/assignments/TeacherAssignments.vue"; | ||||||
|  | import TeacherClasses from "@/views/classes/TeacherClasses.vue"; | ||||||
|  | import TeacherDiscussions from "@/views/discussions/TeacherDiscussions.vue"; | ||||||
|  | import SingleAssignment from "@/views/assignments/SingleAssignment.vue"; | ||||||
|  | import SingleClass from "@/views/classes/SingleClass.vue"; | ||||||
|  | import SingleDiscussion from "@/views/discussions/SingleDiscussion.vue"; | ||||||
|  | import NotFound from "@/components/errors/NotFound.vue"; | ||||||
|  | import CreateClass from "@/views/classes/CreateClass.vue"; | ||||||
|  | import CreateAssignment from "@/views/assignments/CreateAssignment.vue"; | ||||||
|  | import CreateDiscussion from "@/views/discussions/CreateDiscussion.vue"; | ||||||
| 
 | 
 | ||||||
| const router = createRouter({ | const router = createRouter({ | ||||||
|     history: createWebHistory(import.meta.env.BASE_URL), |     history: createWebHistory(import.meta.env.BASE_URL), | ||||||
|  | @ -7,17 +22,102 @@ const router = createRouter({ | ||||||
|         { |         { | ||||||
|             path: "/", |             path: "/", | ||||||
|             name: "home", |             name: "home", | ||||||
|             component: HomeView, |             component: () => {return import("../views/HomePage.vue")}, | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|             path: "/about", |             path: "/login", | ||||||
|             name: "about", |             name: "LoginPage", | ||||||
|             // Route level code-splitting
 |             component: () => {return import("../views/LoginPage.vue")} | ||||||
|             // This generates a separate chunk (About.[hash].js) for this route
 |  | ||||||
|             // Which is lazy-loaded when the route is visited.
 |  | ||||||
|             component: () => { |  | ||||||
|                 return import("../views/AboutView.vue"); |  | ||||||
|         }, |         }, | ||||||
|  |         { | ||||||
|  |             path: "/student/:id", | ||||||
|  |             component: MenuBar, | ||||||
|  |             children: [ | ||||||
|  |                 { | ||||||
|  |                     path: "home", | ||||||
|  |                     name: "StudentHomePage", | ||||||
|  |                     component: StudentHomepage | ||||||
|  |                 }, | ||||||
|  |                 { | ||||||
|  |                     path: "assignment", | ||||||
|  |                     name: "StudentAssignments", | ||||||
|  |                     component: StudentAssignments | ||||||
|  |                 }, | ||||||
|  |                 { | ||||||
|  |                     path: "class", | ||||||
|  |                     name: "StudentClasses", | ||||||
|  |                     component: StudentClasses | ||||||
|  |                 }, | ||||||
|  |                 { | ||||||
|  |                     path: "discussion", | ||||||
|  |                     name: "StudentDiscussions", | ||||||
|  |                     component: StudentDiscussions | ||||||
|  |                 }, | ||||||
|  |             ] | ||||||
|  |         }, | ||||||
|  | 
 | ||||||
|  |         { | ||||||
|  |             path: "/teacher/:id", | ||||||
|  |             component: MenuBar, | ||||||
|  |             children: [ | ||||||
|  |                 { | ||||||
|  |                     path: "home", | ||||||
|  |                     name: "TeacherHomepage", | ||||||
|  |                     component: TeacherHomepage | ||||||
|  |                 }, | ||||||
|  |                 { | ||||||
|  |                     path: "assignment", | ||||||
|  |                     name: "TeacherAssignments", | ||||||
|  |                     component: TeacherAssignments | ||||||
|  |                 }, | ||||||
|  |                 { | ||||||
|  |                     path: "class", | ||||||
|  |                     name: "TeacherClasses", | ||||||
|  |                     component: TeacherClasses | ||||||
|  |                 }, | ||||||
|  |                 { | ||||||
|  |                     path: "discussion", | ||||||
|  |                     name: "TeacherDiscussions", | ||||||
|  |                     component: TeacherDiscussions | ||||||
|  |                 }, | ||||||
|  |             ] | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             path: "/assignment/create", | ||||||
|  |             name: "CreateAssigment", | ||||||
|  |             component: CreateAssignment | ||||||
|  | 
 | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             path: "/assignment/:id", | ||||||
|  |             name: "SingleAssigment", | ||||||
|  |             component: SingleAssignment | ||||||
|  | 
 | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             path: "/class/create", | ||||||
|  |             name: "CreateClass", | ||||||
|  |             component: CreateClass | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             path: "/class/:id", | ||||||
|  |             name: "SingleClass", | ||||||
|  |             component: SingleClass | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             path: "/discussion/create", | ||||||
|  |             name: "CreateDiscussion", | ||||||
|  |             component: CreateDiscussion | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             path: "/discussion/:id", | ||||||
|  |             name: "SingleDiscussion", | ||||||
|  |             component: SingleDiscussion | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             path: "/:catchAll(.*)", | ||||||
|  |             name: "NotFound", | ||||||
|  |             component: NotFound, | ||||||
|         }, |         }, | ||||||
|     ], |     ], | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | @ -1,16 +0,0 @@ | ||||||
| <template> |  | ||||||
|     <div class="about"> |  | ||||||
|         <h1>This is an about page</h1> |  | ||||||
|         <v-slider></v-slider> |  | ||||||
|     </div> |  | ||||||
| </template> |  | ||||||
| 
 |  | ||||||
| <style> |  | ||||||
|     @media (min-width: 1024px) { |  | ||||||
|         .about { |  | ||||||
|             min-height: 100vh; |  | ||||||
|             display: flex; |  | ||||||
|             align-items: center; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| </style> |  | ||||||
|  | @ -1,9 +1,12 @@ | ||||||
| <script setup lang="ts"> | <script setup lang="ts"> | ||||||
|     import TheWelcome from "../components/TheWelcome.vue"; | 
 | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <template> | <template> | ||||||
|     <main> |     <main> | ||||||
|         <TheWelcome /> |         <b> Welcome to the dwengo homepage</b> | ||||||
|     </main> |     </main> | ||||||
| </template> | </template> | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										10
									
								
								frontend/src/views/LoginPage.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								frontend/src/views/LoginPage.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/StudentHomepage.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/StudentHomepage.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/TeacherHomepage.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/TeacherHomepage.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/assignments/CreateAssignment.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/assignments/CreateAssignment.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/assignments/SingleAssignment.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/assignments/SingleAssignment.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/assignments/StudentAssignments.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/assignments/StudentAssignments.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/assignments/TeacherAssignments.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/assignments/TeacherAssignments.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/classes/CreateClass.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/classes/CreateClass.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/classes/SingleClass.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/classes/SingleClass.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/classes/StudentClasses.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/classes/StudentClasses.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/classes/TeacherClasses.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/classes/TeacherClasses.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/discussions/CreateDiscussion.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/discussions/CreateDiscussion.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/discussions/SingleDiscussion.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/discussions/SingleDiscussion.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/discussions/StudentDiscussions.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/discussions/StudentDiscussions.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										11
									
								
								frontend/src/views/discussions/TeacherDiscussions.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								frontend/src/views/discussions/TeacherDiscussions.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | <script setup lang="ts"> | ||||||
|  | 
 | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <template> | ||||||
|  |     <main></main> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <style scoped> | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
|  | @ -10,5 +10,8 @@ | ||||||
|         { |         { | ||||||
|             "path": "./tsconfig.vitest.json" |             "path": "./tsconfig.vitest.json" | ||||||
|         } |         } | ||||||
|     ] |     ], | ||||||
|  |     "compilerOptions": { | ||||||
|  |         "resolveJsonModule": true | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show more
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl