style: fix linting issues met ESLint
This commit is contained in:
		
							parent
							
								
									81bbe84dfd
								
							
						
					
					
						commit
						74765577d5
					
				
					 26 changed files with 73 additions and 73 deletions
				
			
		|  | @ -4,13 +4,13 @@ export abstract class DwengoEntityRepository< | ||||||
|     T extends object, |     T extends object, | ||||||
| > extends EntityRepository<T> { | > extends EntityRepository<T> { | ||||||
|     public async save(entity: T) { |     public async save(entity: T) { | ||||||
|         let em = this.getEntityManager(); |         const em = this.getEntityManager(); | ||||||
|         em.persist(entity); |         em.persist(entity); | ||||||
|         await em.flush(); |         await em.flush(); | ||||||
|     } |     } | ||||||
|     public async deleteWhere(query: FilterQuery<T>) { |     public async deleteWhere(query: FilterQuery<T>) { | ||||||
|         let toDelete = await this.findOne(query); |         const toDelete = await this.findOne(query); | ||||||
|         let em = this.getEntityManager(); |         const em = this.getEntityManager(); | ||||||
|         if (toDelete) { |         if (toDelete) { | ||||||
|             em.remove(toDelete); |             em.remove(toDelete); | ||||||
|             await em.flush(); |             await em.flush(); | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ export class AnswerRepository extends DwengoEntityRepository<Answer> { | ||||||
|         author: Teacher; |         author: Teacher; | ||||||
|         content: string; |         content: string; | ||||||
|     }): Promise<Answer> { |     }): Promise<Answer> { | ||||||
|         let answerEntity = new Answer(); |         const answerEntity = new Answer(); | ||||||
|         answerEntity.toQuestion = answer.toQuestion; |         answerEntity.toQuestion = answer.toQuestion; | ||||||
|         answerEntity.author = answer.author; |         answerEntity.author = answer.author; | ||||||
|         answerEntity.content = answer.content; |         answerEntity.content = answer.content; | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ export class QuestionRepository extends DwengoEntityRepository<Question> { | ||||||
|         author: Student; |         author: Student; | ||||||
|         content: string; |         content: string; | ||||||
|     }): Promise<Question> { |     }): Promise<Question> { | ||||||
|         let questionEntity = new Question(); |         const questionEntity = new Question(); | ||||||
|         questionEntity.learningObjectHruid = question.loId.hruid; |         questionEntity.learningObjectHruid = question.loId.hruid; | ||||||
|         questionEntity.learningObjectLanguage = question.loId.language; |         questionEntity.learningObjectLanguage = question.loId.language; | ||||||
|         questionEntity.learningObjectVersion = question.loId.version; |         questionEntity.learningObjectVersion = question.loId.version; | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ import { Language } from '../content/language.js'; | ||||||
| 
 | 
 | ||||||
| @Entity() | @Entity() | ||||||
| export class Assignment { | export class Assignment { | ||||||
|     @ManyToOne({ entity: () => Class, primary: true }) |     @ManyToOne({ entity: () => {return Class}, primary: true }) | ||||||
|     within!: Class; |     within!: Class; | ||||||
| 
 | 
 | ||||||
|     @PrimaryKey({ type: 'number' }) |     @PrimaryKey({ type: 'number' }) | ||||||
|  | @ -27,9 +27,9 @@ export class Assignment { | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|     learningPathHruid!: string; |     learningPathHruid!: string; | ||||||
| 
 | 
 | ||||||
|     @Enum({ items: () => Language }) |     @Enum({ items: () => {return Language} }) | ||||||
|     learningPathLanguage!: Language; |     learningPathLanguage!: Language; | ||||||
| 
 | 
 | ||||||
|     @OneToMany({ entity: () => Group, mappedBy: 'assignment' }) |     @OneToMany({ entity: () => {return Group}, mappedBy: 'assignment' }) | ||||||
|     groups!: Group[]; |     groups!: Group[]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ import { Student } from '../users/student.entity.js'; | ||||||
| 
 | 
 | ||||||
| @Entity() | @Entity() | ||||||
| export class Group { | export class Group { | ||||||
|     @ManyToOne({ entity: () => Assignment, primary: true }) |     @ManyToOne({ entity: () => {return Assignment}, primary: true }) | ||||||
|     assignment!: Assignment; |     assignment!: Assignment; | ||||||
| 
 | 
 | ||||||
|     @PrimaryKey({ type: 'integer' }) |     @PrimaryKey({ type: 'integer' }) | ||||||
|     groupNumber!: number; |     groupNumber!: number; | ||||||
| 
 | 
 | ||||||
|     @ManyToMany({ entity: () => Student }) |     @ManyToMany({ entity: () => {return Student} }) | ||||||
|     members!: Student[]; |     members!: Student[]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ export class Submission { | ||||||
|     @PrimaryKey({ type: 'string' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|     learningObjectHruid!: string; |     learningObjectHruid!: string; | ||||||
| 
 | 
 | ||||||
|     @Enum({ items: () => Language, primary: true }) |     @Enum({ items: () => {return Language}, primary: true }) | ||||||
|     learningObjectLanguage!: Language; |     learningObjectLanguage!: Language; | ||||||
| 
 | 
 | ||||||
|     @PrimaryKey({ type: 'string' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|  | @ -17,13 +17,13 @@ export class Submission { | ||||||
|     @PrimaryKey({ type: 'integer' }) |     @PrimaryKey({ type: 'integer' }) | ||||||
|     submissionNumber!: number; |     submissionNumber!: number; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ entity: () => Student }) |     @ManyToOne({ entity: () => {return Student} }) | ||||||
|     submitter!: Student; |     submitter!: Student; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'datetime' }) |     @Property({ type: 'datetime' }) | ||||||
|     submissionTime!: Date; |     submissionTime!: Date; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ entity: () => Group, nullable: true }) |     @ManyToOne({ entity: () => {return Group}, nullable: true }) | ||||||
|     onBehalfOf?: Group; |     onBehalfOf?: Group; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'json' }) |     @Property({ type: 'json' }) | ||||||
|  |  | ||||||
|  | @ -4,13 +4,13 @@ import { Class } from './class.entity'; | ||||||
| 
 | 
 | ||||||
| @Entity() | @Entity() | ||||||
| export class ClassJoinRequest { | export class ClassJoinRequest { | ||||||
|     @ManyToOne({ entity: () => Student, primary: true }) |     @ManyToOne({ entity: () => {return Student}, primary: true }) | ||||||
|     requester!: Student; |     requester!: Student; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ entity: () => Class, primary: true }) |     @ManyToOne({ entity: () => {return Class}, primary: true }) | ||||||
|     class!: Class; |     class!: Class; | ||||||
| 
 | 
 | ||||||
|     @Enum(() => ClassJoinRequestStatus) |     @Enum(() => {return ClassJoinRequestStatus}) | ||||||
|     status!: ClassJoinRequestStatus; |     status!: ClassJoinRequestStatus; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,9 +17,9 @@ export class Class { | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|     displayName!: string; |     displayName!: string; | ||||||
| 
 | 
 | ||||||
|     @ManyToMany(() => Teacher) |     @ManyToMany(() => {return Teacher}) | ||||||
|     teachers!: Collection<Teacher>; |     teachers!: Collection<Teacher>; | ||||||
| 
 | 
 | ||||||
|     @ManyToMany(() => Student) |     @ManyToMany(() => {return Student}) | ||||||
|     students!: Collection<Student>; |     students!: Collection<Student>; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -7,12 +7,12 @@ import { Class } from './class.entity.js'; | ||||||
|  */ |  */ | ||||||
| @Entity() | @Entity() | ||||||
| export class TeacherInvitation { | export class TeacherInvitation { | ||||||
|     @ManyToOne({ entity: () => Teacher, primary: true }) |     @ManyToOne({ entity: () => {return Teacher}, primary: true }) | ||||||
|     sender!: Teacher; |     sender!: Teacher; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ entity: () => Teacher, primary: true }) |     @ManyToOne({ entity: () => {return Teacher}, primary: true }) | ||||||
|     receiver!: Teacher; |     receiver!: Teacher; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ entity: () => Class, primary: true }) |     @ManyToOne({ entity: () => {return Class}, primary: true }) | ||||||
|     class!: Class; |     class!: Class; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ import { LearningObject } from './learning-object.entity.js'; | ||||||
| 
 | 
 | ||||||
| @Entity() | @Entity() | ||||||
| export class Attachment { | export class Attachment { | ||||||
|     @ManyToOne({ entity: () => LearningObject, primary: true }) |     @ManyToOne({ entity: () => {return LearningObject}, primary: true }) | ||||||
|     learningObject!: LearningObject; |     learningObject!: LearningObject; | ||||||
| 
 | 
 | ||||||
|     @PrimaryKey({ type: 'integer' }) |     @PrimaryKey({ type: 'integer' }) | ||||||
|  |  | ||||||
|  | @ -17,13 +17,13 @@ export class LearningObject { | ||||||
|     @PrimaryKey({ type: 'string' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|     hruid!: string; |     hruid!: string; | ||||||
| 
 | 
 | ||||||
|     @Enum({ items: () => Language, primary: true }) |     @Enum({ items: () => {return Language}, primary: true }) | ||||||
|     language!: Language; |     language!: Language; | ||||||
| 
 | 
 | ||||||
|     @PrimaryKey({ type: 'string' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|     version: string = '1'; |     version: string = '1'; | ||||||
| 
 | 
 | ||||||
|     @ManyToMany({ entity: () => Teacher }) |     @ManyToMany({ entity: () => {return Teacher} }) | ||||||
|     admins!: Teacher[]; |     admins!: Teacher[]; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|  | @ -47,7 +47,7 @@ export class LearningObject { | ||||||
|     @Property({ type: 'array' }) |     @Property({ type: 'array' }) | ||||||
|     skosConcepts!: string[]; |     skosConcepts!: string[]; | ||||||
| 
 | 
 | ||||||
|     @Embedded({ entity: () => EducationalGoal, array: true }) |     @Embedded({ entity: () => {return EducationalGoal}, array: true }) | ||||||
|     educationalGoals: EducationalGoal[] = []; |     educationalGoals: EducationalGoal[] = []; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|  | @ -62,7 +62,7 @@ export class LearningObject { | ||||||
|     @Property({ type: 'integer' }) |     @Property({ type: 'integer' }) | ||||||
|     estimatedTime!: number; |     estimatedTime!: number; | ||||||
| 
 | 
 | ||||||
|     @Embedded({ entity: () => ReturnValue }) |     @Embedded({ entity: () => {return ReturnValue} }) | ||||||
|     returnValue!: ReturnValue; |     returnValue!: ReturnValue; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'bool' }) |     @Property({ type: 'bool' }) | ||||||
|  | @ -71,7 +71,7 @@ export class LearningObject { | ||||||
|     @Property({ type: 'string', nullable: true }) |     @Property({ type: 'string', nullable: true }) | ||||||
|     contentLocation?: string; |     contentLocation?: string; | ||||||
| 
 | 
 | ||||||
|     @OneToMany({ entity: () => Attachment, mappedBy: 'learningObject' }) |     @OneToMany({ entity: () => {return Attachment}, mappedBy: 'learningObject' }) | ||||||
|     attachments: Attachment[] = []; |     attachments: Attachment[] = []; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'blob' }) |     @Property({ type: 'blob' }) | ||||||
|  |  | ||||||
|  | @ -16,10 +16,10 @@ export class LearningPath { | ||||||
|     @PrimaryKey({ type: 'string' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|     hruid!: string; |     hruid!: string; | ||||||
| 
 | 
 | ||||||
|     @Enum({ items: () => Language, primary: true }) |     @Enum({ items: () => {return Language}, primary: true }) | ||||||
|     language!: Language; |     language!: Language; | ||||||
| 
 | 
 | ||||||
|     @ManyToMany({ entity: () => Teacher }) |     @ManyToMany({ entity: () => {return Teacher} }) | ||||||
|     admins!: Teacher[]; |     admins!: Teacher[]; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|  | @ -31,7 +31,7 @@ export class LearningPath { | ||||||
|     @Property({ type: 'blob' }) |     @Property({ type: 'blob' }) | ||||||
|     image!: string; |     image!: string; | ||||||
| 
 | 
 | ||||||
|     @Embedded({ entity: () => LearningPathNode, array: true }) |     @Embedded({ entity: () => {return LearningPathNode}, array: true }) | ||||||
|     nodes: LearningPathNode[] = []; |     nodes: LearningPathNode[] = []; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -40,7 +40,7 @@ export class LearningPathNode { | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|     learningObjectHruid!: string; |     learningObjectHruid!: string; | ||||||
| 
 | 
 | ||||||
|     @Enum({ items: () => Language }) |     @Enum({ items: () => {return Language} }) | ||||||
|     language!: Language; |     language!: Language; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|  | @ -52,7 +52,7 @@ export class LearningPathNode { | ||||||
|     @Property({ type: 'bool' }) |     @Property({ type: 'bool' }) | ||||||
|     startNode!: boolean; |     startNode!: boolean; | ||||||
| 
 | 
 | ||||||
|     @Embedded({ entity: () => LearningPathTransition, array: true }) |     @Embedded({ entity: () => {return LearningPathTransition}, array: true }) | ||||||
|     transitions!: LearningPathTransition[]; |     transitions!: LearningPathTransition[]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -61,6 +61,6 @@ export class LearningPathTransition { | ||||||
|     @Property({ type: 'string' }) |     @Property({ type: 'string' }) | ||||||
|     condition!: string; |     condition!: string; | ||||||
| 
 | 
 | ||||||
|     @OneToOne({ entity: () => LearningPathNode }) |     @OneToOne({ entity: () => {return LearningPathNode} }) | ||||||
|     next!: LearningPathNode; |     next!: LearningPathNode; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,10 +4,10 @@ import { Teacher } from '../users/teacher.entity'; | ||||||
| 
 | 
 | ||||||
| @Entity() | @Entity() | ||||||
| export class Answer { | export class Answer { | ||||||
|     @ManyToOne({ entity: () => Teacher, primary: true }) |     @ManyToOne({ entity: () => {return Teacher}, primary: true }) | ||||||
|     author!: Teacher; |     author!: Teacher; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ entity: () => Question, primary: true }) |     @ManyToOne({ entity: () => {return Question}, primary: true }) | ||||||
|     toQuestion!: Question; |     toQuestion!: Question; | ||||||
| 
 | 
 | ||||||
|     @PrimaryKey({ type: 'integer' }) |     @PrimaryKey({ type: 'integer' }) | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ export class Question { | ||||||
|     @PrimaryKey({ type: 'string' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|     learningObjectHruid!: string; |     learningObjectHruid!: string; | ||||||
| 
 | 
 | ||||||
|     @Enum({ items: () => Language, primary: true }) |     @Enum({ items: () => {return Language}, primary: true }) | ||||||
|     learningObjectLanguage!: Language; |     learningObjectLanguage!: Language; | ||||||
| 
 | 
 | ||||||
|     @PrimaryKey({ type: 'string' }) |     @PrimaryKey({ type: 'string' }) | ||||||
|  | @ -16,7 +16,7 @@ export class Question { | ||||||
|     @PrimaryKey({ type: 'integer' }) |     @PrimaryKey({ type: 'integer' }) | ||||||
|     sequenceNumber!: number; |     sequenceNumber!: number; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ entity: () => Student }) |     @ManyToOne({ entity: () => {return Student} }) | ||||||
|     author!: Student; |     author!: Student; | ||||||
| 
 | 
 | ||||||
|     @Property({ type: 'datetime' }) |     @Property({ type: 'datetime' }) | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ import { Class } from '../classes/class.entity.js'; | ||||||
| import { Group } from '../assignments/group.entity.js'; | import { Group } from '../assignments/group.entity.js'; | ||||||
| import { StudentRepository } from '../../data/users/student-repository.js'; | import { StudentRepository } from '../../data/users/student-repository.js'; | ||||||
| 
 | 
 | ||||||
| @Entity({ repository: () => StudentRepository }) | @Entity({ repository: () => {return StudentRepository} }) | ||||||
| export class Student extends User { | export class Student extends User { | ||||||
|     @ManyToMany(() => Class) |     @ManyToMany(() => {return Class}) | ||||||
|     classes!: Collection<Class>; |     classes!: Collection<Class>; | ||||||
| 
 | 
 | ||||||
|     @ManyToMany(() => Group) |     @ManyToMany(() => {return Group}) | ||||||
|     groups!: Collection<Group>; |     groups!: Collection<Group>; | ||||||
| 
 | 
 | ||||||
|     constructor( |     constructor( | ||||||
|  |  | ||||||
|  | @ -4,6 +4,6 @@ import { Class } from '../classes/class.entity.js'; | ||||||
| 
 | 
 | ||||||
| @Entity() | @Entity() | ||||||
| export class Teacher extends User { | export class Teacher extends User { | ||||||
|     @ManyToMany(() => Class) |     @ManyToMany(() => {return Class}) | ||||||
|     classes!: Collection<Class>; |     classes!: Collection<Class>; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -15,9 +15,9 @@ function config(testingMode: boolean = false): Options { | ||||||
| 
 | 
 | ||||||
|             // Workaround: vitest: `TypeError: Unknown file extension ".ts"` (ERR_UNKNOWN_FILE_EXTENSION)
 |             // Workaround: vitest: `TypeError: Unknown file extension ".ts"` (ERR_UNKNOWN_FILE_EXTENSION)
 | ||||||
|             // (see https://mikro-orm.io/docs/guide/project-setup#testing-the-endpoint)
 |             // (see https://mikro-orm.io/docs/guide/project-setup#testing-the-endpoint)
 | ||||||
|             dynamicImportProvider: (id) => import(id), |             dynamicImportProvider: (id) => {return import(id)}, | ||||||
|         }; |         }; | ||||||
|     } else { |     }  | ||||||
|         return { |         return { | ||||||
|             driver: PostgreSqlDriver, |             driver: PostgreSqlDriver, | ||||||
|             host: getEnvVar(EnvVars.DbHost), |             host: getEnvVar(EnvVars.DbHost), | ||||||
|  | @ -29,7 +29,7 @@ function config(testingMode: boolean = false): Options { | ||||||
|             entitiesTs: entitiesTs, |             entitiesTs: entitiesTs, | ||||||
|             debug: true, |             debug: true, | ||||||
|         }; |         }; | ||||||
|     } |      | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default config; | export default config; | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         assignments: [ |         assignments: [ | ||||||
|  | @ -11,7 +11,7 @@ router.get('/', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // information about an assignment with id 'id'
 | // Information about an assignment with id 'id'
 | ||||||
| router.get('/:id', (req, res) => { | router.get('/:id', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         id: req.params.id, |         id: req.params.id, | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         classes: [ |         classes: [ | ||||||
|  | @ -11,7 +11,7 @@ router.get('/', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // information about an class with id 'id'
 | // Information about an class with id 'id'
 | ||||||
| router.get('/:id', (req, res) => { | router.get('/:id', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         id: req.params.id, |         id: req.params.id, | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         groups: [ |         groups: [ | ||||||
|  | @ -11,20 +11,20 @@ router.get('/', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // information about a group (members, ... [TODO DOC])
 | // Information about a group (members, ... [TODO DOC])
 | ||||||
| router.get('/:id', (req, res) => { | router.get('/:id', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         id: req.params.id, |         id: req.params.id, | ||||||
|         assignment: '0', |         assignment: '0', | ||||||
|         students: [ '0' ], |         students: [ '0' ], | ||||||
|         submissions: [ '0' ], |         submissions: [ '0' ], | ||||||
|         // reference to other endpoint
 |         // Reference to other endpoint
 | ||||||
|         // should be less hardcoded
 |         // Should be less hardcoded
 | ||||||
|         questions: `/group/${req.params.id}/question`,  |         questions: `/group/${req.params.id}/question`,  | ||||||
|     }); |     }); | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| // the list of questions a group has made
 | // The list of questions a group has made
 | ||||||
| router.get('/:id/question', (req, res) => { | router.get('/:id/question', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         questions: [ '0' ], |         questions: [ '0' ], | ||||||
|  |  | ||||||
|  | @ -1,11 +1,11 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // returns login paths for IDP
 | // Returns login paths for IDP
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         // dummy variables, needs to be changed
 |         // Dummy variables, needs to be changed
 | ||||||
|         // with IDP endpoints
 |         // With IDP endpoints
 | ||||||
|         leerkracht: '/login-leerkracht', |         leerkracht: '/login-leerkracht', | ||||||
|         leerling: '/login-leerling', |         leerling: '/login-leerling', | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         questions: [ |         questions: [ | ||||||
|  | @ -11,7 +11,7 @@ router.get('/', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // information about an question with id 'id'
 | // Information about an question with id 'id'
 | ||||||
| router.get('/:id', (req, res) => { | router.get('/:id', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         id: req.params.id, |         id: req.params.id, | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         students: [ |         students: [ | ||||||
|  | @ -11,7 +11,7 @@ router.get('/', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // information about a student's profile
 | // Information about a student's profile
 | ||||||
| router.get('/:id', (req, res) => { | router.get('/:id', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         id: req.params.id, |         id: req.params.id, | ||||||
|  | @ -27,14 +27,14 @@ router.get('/:id', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // the list of classes a student is in
 | // The list of classes a student is in
 | ||||||
| router.get('/:id/classes', (req, res) => { | router.get('/:id/classes', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         classes: [ '0' ], |         classes: [ '0' ], | ||||||
|     }); |     }); | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| // the list of submissions a student has made
 | // The list of submissions a student has made
 | ||||||
| router.get('/:id/submissions', (req, res) => { | router.get('/:id/submissions', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         submissions: [ '0' ], |         submissions: [ '0' ], | ||||||
|  | @ -42,14 +42,14 @@ router.get('/:id/submissions', (req, res) => { | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
|    |    | ||||||
| // the list of assignments a student has
 | // The list of assignments a student has
 | ||||||
| router.get('/:id/assignments', (req, res) => { | router.get('/:id/assignments', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         assignments: [ '0' ], |         assignments: [ '0' ], | ||||||
|     }); |     }); | ||||||
| }) | }) | ||||||
|    |    | ||||||
| // the list of groups a student is in
 | // The list of groups a student is in
 | ||||||
| router.get('/:id/groups', (req, res) => { | router.get('/:id/groups', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         groups: [ '0' ], |         groups: [ '0' ], | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         submissions: [ |         submissions: [ | ||||||
|  | @ -11,7 +11,7 @@ router.get('/', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // information about an submission with id 'id'
 | // Information about an submission with id 'id'
 | ||||||
| router.get('/:id', (req, res) => { | router.get('/:id', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         id: req.params.id, |         id: req.params.id, | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| import express from 'express' | import express from 'express' | ||||||
| const router = express.Router(); | const router = express.Router(); | ||||||
| 
 | 
 | ||||||
| // root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (req, res) => { | router.get('/', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         teachers: [ |         teachers: [ | ||||||
|  | @ -11,7 +11,7 @@ router.get('/', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // information about a teacher
 | // Information about a teacher
 | ||||||
| router.get('/:id', (req, res) => { | router.get('/:id', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         id: req.params.id, |         id: req.params.id, | ||||||
|  | @ -27,7 +27,7 @@ router.get('/:id', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| // the questions students asked a teacher
 | // The questions students asked a teacher
 | ||||||
| router.get('/:id/questions', (req, res) => { | router.get('/:id/questions', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         questions: [ |         questions: [ | ||||||
|  | @ -36,7 +36,7 @@ router.get('/:id/questions', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // invitations to other classes a teacher received
 | // Invitations to other classes a teacher received
 | ||||||
| router.get('/:id/invitations', (req, res) => { | router.get('/:id/invitations', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         invitations: [ |         invitations: [ | ||||||
|  | @ -45,7 +45,7 @@ router.get('/:id/invitations', (req, res) => { | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // a list with ids of classes a teacher is in
 | // A list with ids of classes a teacher is in
 | ||||||
| router.get('/:id/classes', (req, res) => { | router.get('/:id/classes', (req, res) => { | ||||||
|     res.json({ |     res.json({ | ||||||
|         classes: [ |         classes: [ | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ describe("StudentRepository", () => { | ||||||
|     it("should return the queried student after he was added", async () => { |     it("should return the queried student after he was added", async () => { | ||||||
|         await studentRepository.insert(new Student(username, firstName, lastName)); |         await studentRepository.insert(new Student(username, firstName, lastName)); | ||||||
| 
 | 
 | ||||||
|         let retrievedStudent = await studentRepository.findByUsername(username); |         const retrievedStudent = await studentRepository.findByUsername(username); | ||||||
|         expect(retrievedStudent).toBeTruthy(); |         expect(retrievedStudent).toBeTruthy(); | ||||||
|         expect(retrievedStudent?.firstName).toBe(firstName); |         expect(retrievedStudent?.firstName).toBe(firstName); | ||||||
|         expect(retrievedStudent?.lastName).toBe(lastName); |         expect(retrievedStudent?.lastName).toBe(lastName); | ||||||
|  | @ -27,7 +27,7 @@ describe("StudentRepository", () => { | ||||||
|     it("should no longer return the queried student after he was removed again", async () => { |     it("should no longer return the queried student after he was removed again", async () => { | ||||||
|         await studentRepository.deleteByUsername(username); |         await studentRepository.deleteByUsername(username); | ||||||
| 
 | 
 | ||||||
|         let retrievedStudent = await studentRepository.findByUsername(username); |         const retrievedStudent = await studentRepository.findByUsername(username); | ||||||
|         expect(retrievedStudent).toBeNull(); |         expect(retrievedStudent).toBeNull(); | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Lint Action
						Lint Action