fix: Shared pkgs importeren
This commit is contained in:
		
							parent
							
								
									b6e07d28df
								
							
						
					
					
						commit
						9470a4ddf9
					
				
					 95 changed files with 160 additions and 142 deletions
				
			
		|  | @ -1,7 +1,6 @@ | |||
| import { Request, Response } from 'express'; | ||||
| import { createAssignment, getAllAssignments, getAssignment, getAssignmentsSubmissions } from '../services/assignments.js'; | ||||
| 
 | ||||
| import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; | ||||
| import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||
| 
 | ||||
| // Typescript is annoying with parameter forwarding from class.ts
 | ||||
| interface AssignmentParams { | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| import { Request, Response } from 'express'; | ||||
| import { createClass, getAllClasses, getClass, getClassStudents, getClassStudentsIds, getClassTeacherInvitations } from '../services/classes.js'; | ||||
| 
 | ||||
| import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; | ||||
| import { ClassDTO } from '@dwengo-1/common/interfaces/class'; | ||||
| 
 | ||||
| export async function getAllClassesHandler(req: Request, res: Response): Promise<void> { | ||||
|     const full = req.query.full === 'true'; | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| import { Request, Response } from 'express'; | ||||
| import { createGroup, getAllGroups, getGroup, getGroupSubmissions } from '../services/groups.js'; | ||||
| 
 | ||||
| import { GroupDTO } from 'dwengo-1-common/src/interfaces/group'; | ||||
| import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||
| 
 | ||||
| // Typescript is annoywith with parameter forwarding from class.ts
 | ||||
| interface GroupParams { | ||||
|  |  | |||
|  | @ -2,11 +2,11 @@ import { Request, Response } from 'express'; | |||
| import { FALLBACK_LANG } from '../config.js'; | ||||
| import learningObjectService from '../services/learning-objects/learning-object-service.js'; | ||||
| import { envVars, getEnvVar } from '../util/envVars.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import attachmentService from '../services/learning-objects/attachment-service.js'; | ||||
| import { NotFoundError } from '@mikro-orm/core'; | ||||
| import { BadRequestException } from '../exceptions/bad-request-exception.js'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| 
 | ||||
| function getLearningObjectIdentifierFromRequest(req: Request): LearningObjectIdentifier { | ||||
|     if (!req.params.hruid) { | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { Request, Response } from 'express'; | |||
| import { themes } from '../data/themes.js'; | ||||
| import { FALLBACK_LANG } from '../config.js'; | ||||
| import learningPathService from '../services/learning-paths/learning-path-service.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { | ||||
|     PersonalizationTarget, | ||||
|     personalizedForGroup, | ||||
|  |  | |||
|  | @ -2,8 +2,8 @@ import { Request, Response } from 'express'; | |||
| import { createQuestion, deleteQuestion, getAllQuestions, getAnswersByQuestion, getQuestion } from '../services/questions.js'; | ||||
| import { FALLBACK_LANG, FALLBACK_SEQ_NUM } from '../config.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| import { QuestionDTO, QuestionId } from 'dwengo-1-common/src/interfaces/question'; | ||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| function getObjectId(req: Request, res: Response): LearningObjectIdentifier | null { | ||||
|     const { hruid, version } = req.params; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import { | |||
|     getStudentSubmissions, | ||||
| } from '../services/students.js'; | ||||
| 
 | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||
| 
 | ||||
| // TODO: accept arguments (full, ...)
 | ||||
| // TODO: endpoints
 | ||||
|  |  | |||
|  | @ -1,8 +1,7 @@ | |||
| import { Request, Response } from 'express'; | ||||
| import { createSubmission, deleteSubmission, getSubmission } from '../services/submissions.js'; | ||||
| import { Language, languageMap } from '../entities/content/language.js'; | ||||
| 
 | ||||
| import { SubmissionDTO } from 'dwengo-1-common/src/interfaces/submission'; | ||||
| import { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; | ||||
| import { Language, languageMap } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| interface SubmissionParams { | ||||
|     hruid: string; | ||||
|  |  | |||
|  | @ -8,8 +8,7 @@ import { | |||
|     getStudentsByTeacher, | ||||
|     getTeacher, | ||||
| } from '../services/teachers.js'; | ||||
| 
 | ||||
| import { TeacherDTO } from 'dwengo-1-common/src/interfaces/teacher'; | ||||
| import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | ||||
| 
 | ||||
| export async function getAllTeachersHandler(req: Request, res: Response): Promise<void> { | ||||
|     const full = req.query.full === 'true'; | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||
| import { Attachment } from '../../entities/content/attachment.entity.js'; | ||||
| import { Language } from '../../entities/content/language'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier'; | ||||
| 
 | ||||
| export class AttachmentRepository extends DwengoEntityRepository<Attachment> { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| 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'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { Teacher } from '../../entities/users/teacher.entity.js'; | ||||
| 
 | ||||
| export class LearningObjectRepository extends DwengoEntityRepository<LearningObject> { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; | ||||
| import { LearningPath } from '../../entities/content/learning-path.entity.js'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| export class LearningPathRepository extends DwengoEntityRepository<LearningPath> { | ||||
|     public async findByHruidAndLanguage(hruid: string, language: Language): Promise<LearningPath | null> { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| 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'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { AssignmentRepository } from '../../data/assignments/assignment-repository.js'; | ||||
| 
 | ||||
| @Entity({ | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| 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'; | ||||
| import { SubmissionRepository } from '../../data/assignments/submission-repository.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| @Entity({ repository: () => SubmissionRepository }) | ||||
| export class Submission { | ||||
|  |  | |||
|  | @ -1,193 +0,0 @@ | |||
| export enum Language { | ||||
|     Afar = 'aa', | ||||
|     Abkhazian = 'ab', | ||||
|     Afrikaans = 'af', | ||||
|     Akan = 'ak', | ||||
|     Albanian = 'sq', | ||||
|     Amharic = 'am', | ||||
|     Arabic = 'ar', | ||||
|     Aragonese = 'an', | ||||
|     Armenian = 'hy', | ||||
|     Assamese = 'as', | ||||
|     Avaric = 'av', | ||||
|     Avestan = 'ae', | ||||
|     Aymara = 'ay', | ||||
|     Azerbaijani = 'az', | ||||
|     Bashkir = 'ba', | ||||
|     Bambara = 'bm', | ||||
|     Basque = 'eu', | ||||
|     Belarusian = 'be', | ||||
|     Bengali = 'bn', | ||||
|     Bihari = 'bh', | ||||
|     Bislama = 'bi', | ||||
|     Bosnian = 'bs', | ||||
|     Breton = 'br', | ||||
|     Bulgarian = 'bg', | ||||
|     Burmese = 'my', | ||||
|     Catalan = 'ca', | ||||
|     Chamorro = 'ch', | ||||
|     Chechen = 'ce', | ||||
|     Chinese = 'zh', | ||||
|     ChurchSlavic = 'cu', | ||||
|     Chuvash = 'cv', | ||||
|     Cornish = 'kw', | ||||
|     Corsican = 'co', | ||||
|     Cree = 'cr', | ||||
|     Czech = 'cs', | ||||
|     Danish = 'da', | ||||
|     Divehi = 'dv', | ||||
|     Dutch = 'nl', | ||||
|     Dzongkha = 'dz', | ||||
|     English = 'en', | ||||
|     Esperanto = 'eo', | ||||
|     Estonian = 'et', | ||||
|     Ewe = 'ee', | ||||
|     Faroese = 'fo', | ||||
|     Fijian = 'fj', | ||||
|     Finnish = 'fi', | ||||
|     French = 'fr', | ||||
|     Frisian = 'fy', | ||||
|     Fulah = 'ff', | ||||
|     Georgian = 'ka', | ||||
|     German = 'de', | ||||
|     Gaelic = 'gd', | ||||
|     Irish = 'ga', | ||||
|     Galician = 'gl', | ||||
|     Manx = 'gv', | ||||
|     Greek = 'el', | ||||
|     Guarani = 'gn', | ||||
|     Gujarati = 'gu', | ||||
|     Haitian = 'ht', | ||||
|     Hausa = 'ha', | ||||
|     Hebrew = 'he', | ||||
|     Herero = 'hz', | ||||
|     Hindi = 'hi', | ||||
|     HiriMotu = 'ho', | ||||
|     Croatian = 'hr', | ||||
|     Hungarian = 'hu', | ||||
|     Igbo = 'ig', | ||||
|     Icelandic = 'is', | ||||
|     Ido = 'io', | ||||
|     SichuanYi = 'ii', | ||||
|     Inuktitut = 'iu', | ||||
|     Interlingue = 'ie', | ||||
|     Interlingua = 'ia', | ||||
|     Indonesian = 'id', | ||||
|     Inupiaq = 'ik', | ||||
|     Italian = 'it', | ||||
|     Javanese = 'jv', | ||||
|     Japanese = 'ja', | ||||
|     Kalaallisut = 'kl', | ||||
|     Kannada = 'kn', | ||||
|     Kashmiri = 'ks', | ||||
|     Kanuri = 'kr', | ||||
|     Kazakh = 'kk', | ||||
|     Khmer = 'km', | ||||
|     Kikuyu = 'ki', | ||||
|     Kinyarwanda = 'rw', | ||||
|     Kirghiz = 'ky', | ||||
|     Komi = 'kv', | ||||
|     Kongo = 'kg', | ||||
|     Korean = 'ko', | ||||
|     Kuanyama = 'kj', | ||||
|     Kurdish = 'ku', | ||||
|     Lao = 'lo', | ||||
|     Latin = 'la', | ||||
|     Latvian = 'lv', | ||||
|     Limburgan = 'li', | ||||
|     Lingala = 'ln', | ||||
|     Lithuanian = 'lt', | ||||
|     Luxembourgish = 'lb', | ||||
|     LubaKatanga = 'lu', | ||||
|     Ganda = 'lg', | ||||
|     Macedonian = 'mk', | ||||
|     Marshallese = 'mh', | ||||
|     Malayalam = 'ml', | ||||
|     Maori = 'mi', | ||||
|     Marathi = 'mr', | ||||
|     Malay = 'ms', | ||||
|     Malagasy = 'mg', | ||||
|     Maltese = 'mt', | ||||
|     Mongolian = 'mn', | ||||
|     Nauru = 'na', | ||||
|     Navajo = 'nv', | ||||
|     SouthNdebele = 'nr', | ||||
|     NorthNdebele = 'nd', | ||||
|     Ndonga = 'ng', | ||||
|     Nepali = 'ne', | ||||
|     NorwegianNynorsk = 'nn', | ||||
|     NorwegianBokmal = 'nb', | ||||
|     Norwegian = 'no', | ||||
|     Chichewa = 'ny', | ||||
|     Occitan = 'oc', | ||||
|     Ojibwa = 'oj', | ||||
|     Oriya = 'or', | ||||
|     Oromo = 'om', | ||||
|     Ossetian = 'os', | ||||
|     Punjabi = 'pa', | ||||
|     Persian = 'fa', | ||||
|     Pali = 'pi', | ||||
|     Polish = 'pl', | ||||
|     Portuguese = 'pt', | ||||
|     Pashto = 'ps', | ||||
|     Quechua = 'qu', | ||||
|     Romansh = 'rm', | ||||
|     Romanian = 'ro', | ||||
|     Rundi = 'rn', | ||||
|     Russian = 'ru', | ||||
|     Sango = 'sg', | ||||
|     Sanskrit = 'sa', | ||||
|     Sinhala = 'si', | ||||
|     Slovak = 'sk', | ||||
|     Slovenian = 'sl', | ||||
|     NorthernSami = 'se', | ||||
|     Samoan = 'sm', | ||||
|     Shona = 'sn', | ||||
|     Sindhi = 'sd', | ||||
|     Somali = 'so', | ||||
|     Sotho = 'st', | ||||
|     Spanish = 'es', | ||||
|     Sardinian = 'sc', | ||||
|     Serbian = 'sr', | ||||
|     Swati = 'ss', | ||||
|     Sundanese = 'su', | ||||
|     Swahili = 'sw', | ||||
|     Swedish = 'sv', | ||||
|     Tahitian = 'ty', | ||||
|     Tamil = 'ta', | ||||
|     Tatar = 'tt', | ||||
|     Telugu = 'te', | ||||
|     Tajik = 'tg', | ||||
|     Tagalog = 'tl', | ||||
|     Thai = 'th', | ||||
|     Tibetan = 'bo', | ||||
|     Tigrinya = 'ti', | ||||
|     Tonga = 'to', | ||||
|     Tswana = 'tn', | ||||
|     Tsonga = 'ts', | ||||
|     Turkmen = 'tk', | ||||
|     Turkish = 'tr', | ||||
|     Twi = 'tw', | ||||
|     Uighur = 'ug', | ||||
|     Ukrainian = 'uk', | ||||
|     Urdu = 'ur', | ||||
|     Uzbek = 'uz', | ||||
|     Venda = 've', | ||||
|     Vietnamese = 'vi', | ||||
|     Volapuk = 'vo', | ||||
|     Welsh = 'cy', | ||||
|     Walloon = 'wa', | ||||
|     Wolof = 'wo', | ||||
|     Xhosa = 'xh', | ||||
|     Yiddish = 'yi', | ||||
|     Yoruba = 'yo', | ||||
|     Zhuang = 'za', | ||||
|     Zulu = 'zu', | ||||
| } | ||||
| 
 | ||||
| export const languageMap: Record<string, Language> = { | ||||
|     nl: Language.Dutch, | ||||
|     fr: Language.French, | ||||
|     en: Language.English, | ||||
|     de: Language.German, | ||||
| }; | ||||
|  | @ -1,4 +1,4 @@ | |||
| import { Language } from './language.js'; | ||||
| import { Language } from "@dwengo-1/common/util/language"; | ||||
| 
 | ||||
| export class LearningObjectIdentifier { | ||||
|     constructor( | ||||
|  |  | |||
|  | @ -5,8 +5,8 @@ import { DwengoContentType } from '../../services/learning-objects/processing/co | |||
| import { v4 } from 'uuid'; | ||||
| import { LearningObjectRepository } from '../../data/content/learning-object-repository.js'; | ||||
| import { EducationalGoal } from './educational-goal.entity.js'; | ||||
| import { Language } from './language.js'; | ||||
| import { ReturnValue } from './return-value.entity.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| @Entity({ repository: () => LearningObjectRepository }) | ||||
| export class LearningObject { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property, Rel } from '@mikro-orm/core'; | ||||
| import { Language } from './language.js'; | ||||
| import { LearningPath } from './learning-path.entity.js'; | ||||
| import { LearningPathTransition } from './learning-path-transition.entity.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| @Entity() | ||||
| export class LearningPathNode { | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { Entity, Enum, ManyToMany, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Language } from './language.js'; | ||||
| import { Teacher } from '../users/teacher.entity.js'; | ||||
| import { LearningPathRepository } from '../../data/content/learning-path-repository.js'; | ||||
| import { LearningPathNode } from './learning-path-node.entity.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| @Entity({ repository: () => LearningPathRepository }) | ||||
| export class LearningPath { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Language } from '../content/language.js'; | ||||
| import { Student } from '../users/student.entity.js'; | ||||
| import { QuestionRepository } from '../../data/questions/question-repository.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| @Entity({ repository: () => QuestionRepository }) | ||||
| export class Question { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { mapToUserDTO } from './user.js'; | ||||
| import { mapToQuestionDTO, mapToQuestionId } from './question.js'; | ||||
| import { Answer } from '../entities/questions/answer.entity.js'; | ||||
| import { AnswerDTO, AnswerId } from 'dwengo-1-common/src/interfaces/answer'; | ||||
| import { AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer'; | ||||
| 
 | ||||
| /** | ||||
|  * Convert a Question entity to a DTO format. | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| import { languageMap } from '@dwengo-1/common/util/language'; | ||||
| import { FALLBACK_LANG } from '../config.js'; | ||||
| import { Assignment } from '../entities/assignments/assignment.entity.js'; | ||||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| import { languageMap } from '../entities/content/language.js'; | ||||
| import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; | ||||
| import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||
| 
 | ||||
| export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { Collection } from '@mikro-orm/core'; | |||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { Teacher } from '../entities/users/teacher.entity.js'; | ||||
| import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; | ||||
| import { ClassDTO } from '@dwengo-1/common/interfaces/class'; | ||||
| 
 | ||||
| export function mapToClassDTO(cls: Class): ClassDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Group } from '../entities/assignments/group.entity.js'; | ||||
| import { mapToAssignmentDTO } from './assignment.js'; | ||||
| import { mapToStudentDTO } from './student.js'; | ||||
| import { GroupDTO } from 'dwengo-1-common/src/interfaces/group'; | ||||
| import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||
| 
 | ||||
| export function mapToGroupDTO(group: Group): GroupDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { Question } from '../entities/questions/question.entity.js'; | ||||
| import { mapToStudentDTO } from './student.js'; | ||||
| import { QuestionDTO, QuestionId } from 'dwengo-1-common/src/interfaces/question'; | ||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||
| 
 | ||||
| /** | ||||
|  * Convert a Question entity to a DTO format. | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { getStudentRepository } from '../data/repositories.js'; | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||
| 
 | ||||
| export function mapToStudentDTO(student: Student): StudentDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Submission } from '../entities/assignments/submission.entity.js'; | ||||
| import { mapToGroupDTO } from './group.js'; | ||||
| import { mapToStudent, mapToStudentDTO } from './student.js'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from 'dwengo-1-common/src/interfaces/submission'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||
| 
 | ||||
| export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js'; | ||||
| import { mapToClassDTO } from './class.js'; | ||||
| import { mapToUserDTO } from './user.js'; | ||||
| import { TeacherInvitationDTO } from 'dwengo-1-common/src/interfaces/teacher-invitation'; | ||||
| import { TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; | ||||
| 
 | ||||
| export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { Teacher } from '../entities/users/teacher.entity.js'; | ||||
| import { getTeacherRepository } from '../data/repositories.js'; | ||||
| import { TeacherDTO } from 'dwengo-1-common/src/interfaces/teacher'; | ||||
| import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | ||||
| 
 | ||||
| export function mapToTeacherDTO(teacher: Teacher): TeacherDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import { User } from '../entities/users/user.entity.js'; | ||||
| import { UserDTO } from 'dwengo-1-common/src/interfaces/user'; | ||||
| import { UserDTO } from '@dwengo-1/common/interfaces/user'; | ||||
| 
 | ||||
| export function mapToUserDTO(user: User): UserDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { getAssignmentRepository, getClassRepository, getGroupRepository, getSubmissionRepository } from '../data/repositories.js'; | ||||
| import { mapToAssignment, mapToAssignmentDTO, mapToAssignmentDTOId } from '../interfaces/assignment.js'; | ||||
| import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; | ||||
| import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from 'dwengo-1-common/src/interfaces/submission'; | ||||
| import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| export async function getAllAssignments(classid: string, full: boolean): Promise<AssignmentDTO[]> { | ||||
|  |  | |||
|  | @ -3,9 +3,9 @@ import { mapToClassDTO } from '../interfaces/class.js'; | |||
| import { mapToStudentDTO } from '../interfaces/student.js'; | ||||
| import { mapToTeacherInvitationDTO, mapToTeacherInvitationDTOIds } from '../interfaces/teacher-invitation.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; | ||||
| import { TeacherInvitationDTO } from 'dwengo-1-common/src/interfaces/teacher-invitation'; | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| import { ClassDTO } from '@dwengo-1/common/interfaces/class'; | ||||
| import { TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; | ||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||
| 
 | ||||
| const logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,8 +8,8 @@ import { | |||
| import { Group } from '../entities/assignments/group.entity.js'; | ||||
| import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; | ||||
| import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; | ||||
| import { GroupDTO } from 'dwengo-1-common/src/interfaces/group'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from 'dwengo-1-common/src/interfaces/submission'; | ||||
| import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| export async function getGroup(classId: string, assignmentNumber: number, groupNumber: number, full: boolean): Promise<GroupDTO | null> { | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import { | |||
|     LearningObjectMetadata, | ||||
|     LearningObjectNode, | ||||
|     LearningPathResponse, | ||||
| } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| function filterData(data: LearningObjectMetadata, htmlUrl: string): FilteredLearningObject { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { getAttachmentRepository } from '../../data/repositories.js'; | ||||
| import { Attachment } from '../../entities/content/attachment.entity.js'; | ||||
| 
 | ||||
| import { LearningObjectIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| 
 | ||||
| const attachmentService = { | ||||
|     async getAttachment(learningObjectId: LearningObjectIdentifier, attachmentName: string): Promise<Attachment | null> { | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import processingService from './processing/processing-service.js'; | |||
| import { NotFoundError } from '@mikro-orm/core'; | ||||
| import learningObjectService from './learning-object-service.js'; | ||||
| import { getLogger, Logger } from '../../logging/initalize.js'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| 
 | ||||
| const logger: Logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import { | |||
|     LearningObjectNode, | ||||
|     LearningPathIdentifier, | ||||
|     LearningPathResponse, | ||||
| } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| 
 | ||||
| const logger: Logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| 
 | ||||
| export interface LearningObjectProvider { | ||||
|     /** | ||||
|  |  | |||
|  | @ -2,7 +2,11 @@ import dwengoApiLearningObjectProvider from './dwengo-api-learning-object-provid | |||
| import { LearningObjectProvider } from './learning-object-provider.js'; | ||||
| import { envVars, getEnvVar } from '../../util/envVars.js'; | ||||
| import databaseLearningObjectProvider from './database-learning-object-provider.js'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { | ||||
|     FilteredLearningObject, | ||||
|     LearningObjectIdentifier, | ||||
|     LearningPathIdentifier, | ||||
| } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| 
 | ||||
| function getProvider(id: LearningObjectIdentifier): LearningObjectProvider { | ||||
|     if (id.hruid.startsWith(getEnvVar(envVars.UserContentPrefix))) { | ||||
|  |  | |||
|  | @ -8,13 +8,12 @@ import InlineImageProcessor from '../image/inline-image-processor.js'; | |||
| import * as marked from 'marked'; | ||||
| import { getUrlStringForLearningObjectHTML, isValidHttpUrl } from '../../../../util/links.js'; | ||||
| import { ProcessingError } from '../processing-error.js'; | ||||
| import { Language } from '../../../../entities/content/language.js'; | ||||
| 
 | ||||
| import Image = marked.Tokens.Image; | ||||
| import Heading = marked.Tokens.Heading; | ||||
| import Link = marked.Tokens.Link; | ||||
| import RendererObject = marked.RendererObject; | ||||
| import { LearningObjectIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| const prefixes = { | ||||
|     learningObject: '@learning-object', | ||||
|  |  | |||
|  | @ -13,9 +13,9 @@ import GiftProcessor from './gift/gift-processor.js'; | |||
| import { LearningObject } from '../../../entities/content/learning-object.entity.js'; | ||||
| import Processor from './processor.js'; | ||||
| import { DwengoContentType } from './content-type.js'; | ||||
| import { Language } from '../../../entities/content/language.js'; | ||||
| import { replaceAsync } from '../../../util/async.js'; | ||||
| import { LearningObjectIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| const EMBEDDED_LEARNING_OBJECT_PLACEHOLDER = /<learning-object hruid="([^"]+)" language="([^"]+)" version="([^"]+)"\/>/g; | ||||
| const LEARNING_OBJECT_DOES_NOT_EXIST = "<div class='non-existing-learning-object' />"; | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| import { LearningPathProvider } from './learning-path-provider.js'; | ||||
| import { LearningPath as LearningPathEntity } from '../../entities/content/learning-path.entity.js'; | ||||
| import { getLearningPathRepository } from '../../data/repositories.js'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import learningObjectService from '../learning-objects/learning-object-service.js'; | ||||
| import { LearningPathNode } from '../../entities/content/learning-path-node.entity.js'; | ||||
| import { LearningPathTransition } from '../../entities/content/learning-path-transition.entity.js'; | ||||
|  | @ -12,7 +11,8 @@ import { | |||
|     LearningPath, | ||||
|     LearningPathResponse, | ||||
|     Transition, | ||||
| } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| /** | ||||
|  * Fetches the corresponding learning object for each of the nodes and creates a map that maps each node to its | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { fetchWithLogging } from '../../util/api-helper.js'; | |||
| import { DWENGO_API_BASE } from '../../config.js'; | ||||
| import { LearningPathProvider } from './learning-path-provider.js'; | ||||
| import { getLogger, Logger } from '../../logging/initalize.js'; | ||||
| import { LearningPath, LearningPathResponse } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { LearningPath, LearningPathResponse } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| 
 | ||||
| const logger: Logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { Language } from '../../entities/content/language.js'; | ||||
| import { LearningPath, LearningPathResponse } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { PersonalizationTarget } from './learning-path-personalization-util.js'; | ||||
| import { LearningPath, LearningPathResponse } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| /** | ||||
|  * Generic interface for a service which provides access to learning paths from a data source. | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| import dwengoApiLearningPathProvider from './dwengo-api-learning-path-provider.js'; | ||||
| import databaseLearningPathProvider from './database-learning-path-provider.js'; | ||||
| import { envVars, getEnvVar } from '../../util/envVars.js'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import { PersonalizationTarget } from './learning-path-personalization-util.js'; | ||||
| import { LearningPath, LearningPathResponse } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { LearningPath, LearningPathResponse } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| const userContentPrefix = getEnvVar(envVars.UserContentPrefix); | ||||
| const allProviders = [dwengoApiLearningPathProvider, databaseLearningPathProvider]; | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ import { mapToAnswerDTO, mapToAnswerId } from '../interfaces/answer.js'; | |||
| import { QuestionRepository } from '../data/questions/question-repository.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { mapToStudent } from '../interfaces/student.js'; | ||||
| import { QuestionDTO, QuestionId } from 'dwengo-1-common/src/interfaces/question'; | ||||
| import { AnswerDTO, AnswerId } from 'dwengo-1-common/src/interfaces/answer'; | ||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||
| import { AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer'; | ||||
| 
 | ||||
| export async function getAllQuestions(id: LearningObjectIdentifier, full: boolean): Promise<QuestionDTO[] | QuestionId[]> { | ||||
|     const questionRepository: QuestionRepository = getQuestionRepository(); | ||||
|  |  | |||
|  | @ -4,11 +4,11 @@ import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; | |||
| import { mapToStudent, mapToStudentDTO } from '../interfaces/student.js'; | ||||
| import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; | ||||
| import { getAllAssignments } from './assignments.js'; | ||||
| import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment'; | ||||
| import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; | ||||
| import { GroupDTO } from 'dwengo-1-common/src/interfaces/group'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from 'dwengo-1-common/src/interfaces/submission'; | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||
| import { ClassDTO } from '@dwengo-1/common/interfaces/class'; | ||||
| import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { getSubmissionRepository } from '../data/repositories.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { mapToSubmission, mapToSubmissionDTO } from '../interfaces/submission.js'; | ||||
| import { SubmissionDTO } from 'dwengo-1-common/src/interfaces/submission'; | ||||
| import { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| 
 | ||||
| export async function getSubmission( | ||||
|     learningObjectHruid: string, | ||||
|  |  | |||
|  | @ -3,10 +3,10 @@ import { mapToClassDTO } from '../interfaces/class.js'; | |||
| import { getClassStudents } from './classes.js'; | ||||
| import { mapToQuestionDTO, mapToQuestionId } from '../interfaces/question.js'; | ||||
| import { mapToTeacher, mapToTeacherDTO } from '../interfaces/teacher.js'; | ||||
| import { ClassDTO } from 'dwengo-1-common/src/interfaces/class'; | ||||
| import { TeacherDTO } from 'dwengo-1-common/src/interfaces/teacher'; | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| import { QuestionDTO, QuestionId } from 'dwengo-1-common/src/interfaces/question'; | ||||
| import { ClassDTO } from '@dwengo-1/common/interfaces/class'; | ||||
| import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | ||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| 
 | ||||
| export async function getAllTeachers(full: boolean): Promise<TeacherDTO[] | string[]> { | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { LearningObjectIdentifier } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| import { LearningObjectIdentifier } from "@dwengo-1/common/interfaces/learning-content"; | ||||
| 
 | ||||
| export function isValidHttpUrl(url: string): boolean { | ||||
|     try { | ||||
|  |  | |||
		Reference in a new issue