merge: fixed merge conflicts with dev
This commit is contained in:
		
						commit
						faa2f58145
					
				
					 165 changed files with 3948 additions and 3282 deletions
				
			
		|  | @ -1,18 +1,14 @@ | |||
| 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 { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||
| import { AssignmentDTO, AssignmentDTOId } from '@dwengo-1/common/interfaces/assignment'; | ||||
| import { mapToGroupDTO } from './group.js'; | ||||
| import { getAssignmentRepository } from '../data/repositories.js'; | ||||
| 
 | ||||
| export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTO { | ||||
| export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTOId { | ||||
|     return { | ||||
|         id: assignment.id!, | ||||
|         within: assignment.within.classId!, | ||||
|         title: assignment.title, | ||||
|         description: assignment.description, | ||||
|         learningPath: assignment.learningPathHruid, | ||||
|         language: assignment.learningPathLanguage, | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  | @ -24,19 +20,17 @@ export function mapToAssignmentDTO(assignment: Assignment): AssignmentDTO { | |||
|         description: assignment.description, | ||||
|         learningPath: assignment.learningPathHruid, | ||||
|         language: assignment.learningPathLanguage, | ||||
|         // Groups: assignment.groups.map(mapToGroupDTO),
 | ||||
|         groups: assignment.groups.map((group) => mapToGroupDTO(group, assignment.within)), | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| export function mapToAssignment(assignmentData: AssignmentDTO, cls: Class): Assignment { | ||||
|     const assignment = new Assignment(); | ||||
|     assignment.title = assignmentData.title; | ||||
|     assignment.description = assignmentData.description; | ||||
|     assignment.learningPathHruid = assignmentData.learningPath; | ||||
|     assignment.learningPathLanguage = languageMap[assignmentData.language] || FALLBACK_LANG; | ||||
|     assignment.within = cls; | ||||
| 
 | ||||
|     getLogger().debug(assignment); | ||||
| 
 | ||||
|     return assignment; | ||||
|     return getAssignmentRepository().create({ | ||||
|         within: cls, | ||||
|         title: assignmentData.title, | ||||
|         description: assignmentData.description, | ||||
|         learningPathHruid: assignmentData.learningPath, | ||||
|         learningPathLanguage: languageMap[assignmentData.language], | ||||
|         groups: [], | ||||
|     }); | ||||
| } | ||||
|  |  | |||
|  | @ -1,14 +1,12 @@ | |||
| import { Group } from '../entities/assignments/group.entity.js'; | ||||
| import { mapToAssignment } from './assignment.js'; | ||||
| import { mapToStudent } from './student.js'; | ||||
| import { mapToAssignmentDTO } from './assignment.js'; | ||||
| import { mapToStudentDTO } from './student.js'; | ||||
| import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||
| import { GroupDTO, GroupDTOId } from '@dwengo-1/common/interfaces/group'; | ||||
| import { getGroupRepository } from '../data/repositories.js'; | ||||
| import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||
| import { mapToClassDTO } from './class'; | ||||
| 
 | ||||
| export function mapToGroup(groupDto: GroupDTO, clazz: Class): Group { | ||||
|     const assignmentDto = groupDto.assignment as AssignmentDTO; | ||||
|  | @ -20,18 +18,18 @@ export function mapToGroup(groupDto: GroupDTO, clazz: Class): Group { | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function mapToGroupDTO(group: Group): GroupDTO { | ||||
| export function mapToGroupDTO(group: Group, cls: Class): GroupDTO { | ||||
|     return { | ||||
|         class: mapToClassDTO(group.assignment.within), | ||||
|         assignment: mapToAssignmentDTO(group.assignment), | ||||
|         class: cls.classId!, | ||||
|         assignment: group.assignment.id!, | ||||
|         groupNumber: group.groupNumber!, | ||||
|         members: group.members.map(mapToStudentDTO), | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| export function mapToGroupDTOId(group: Group): GroupDTO { | ||||
| export function mapToGroupDTOId(group: Group, cls: Class): GroupDTOId { | ||||
|     return { | ||||
|         class: group.assignment.within.classId!, | ||||
|         class: cls.classId!, | ||||
|         assignment: group.assignment.id!, | ||||
|         groupNumber: group.groupNumber!, | ||||
|     }; | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ export function mapToQuestionDTO(question: Question): QuestionDTO { | |||
|         learningObjectIdentifier, | ||||
|         sequenceNumber: question.sequenceNumber!, | ||||
|         author: mapToStudentDTO(question.author), | ||||
|         inGroup: mapToGroupDTOId(question.inGroup), | ||||
|         inGroup: mapToGroupDTOId(question.inGroup, question.inGroup.assignment?.within), | ||||
|         timestamp: question.timestamp.toISOString(), | ||||
|         content: question.content, | ||||
|     }; | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| import { Submission } from '../entities/assignments/submission.entity.js'; | ||||
| import { mapToGroupDTO } from './group.js'; | ||||
| import { mapToGroupDTOId } from './group.js'; | ||||
| import { mapToStudentDTO } from './student.js'; | ||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||
| import { getSubmissionRepository } from '../data/repositories'; | ||||
| import { Student } from '../entities/users/student.entity'; | ||||
| import { Group } from '../entities/assignments/group.entity'; | ||||
| import { getSubmissionRepository } from '../data/repositories.js'; | ||||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { Group } from '../entities/assignments/group.entity.js'; | ||||
| 
 | ||||
| export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { | ||||
|     return { | ||||
|  | @ -13,11 +13,10 @@ export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { | |||
|             language: submission.learningObjectLanguage, | ||||
|             version: submission.learningObjectVersion, | ||||
|         }, | ||||
| 
 | ||||
|         submissionNumber: submission.submissionNumber, | ||||
|         submitter: mapToStudentDTO(submission.submitter), | ||||
|         time: submission.submissionTime, | ||||
|         group: mapToGroupDTO(submission.onBehalfOf), | ||||
|         group: submission.onBehalfOf ? mapToGroupDTOId(submission.onBehalfOf, submission.onBehalfOf.assignment.within) : undefined, | ||||
|         content: submission.content, | ||||
|     }; | ||||
| } | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js'; | ||||
| import { mapToUserDTO } from './user.js'; | ||||
| import { TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; | ||||
| import { getTeacherInvitationRepository } from '../data/repositories'; | ||||
| import { Teacher } from '../entities/users/teacher.entity'; | ||||
| import { Class } from '../entities/classes/class.entity'; | ||||
| import { getTeacherInvitationRepository } from '../data/repositories.js'; | ||||
| import { Teacher } from '../entities/users/teacher.entity.js'; | ||||
| import { Class } from '../entities/classes/class.entity.js'; | ||||
| import { ClassStatus } from '@dwengo-1/common/util/class-join-request'; | ||||
| 
 | ||||
| export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO { | ||||
|  |  | |||
		Reference in a new issue
	
	 Adriaan Jacquet
						Adriaan Jacquet