refactor(common): Student
This commit is contained in:
		
							parent
							
								
									bc8e888373
								
							
						
					
					
						commit
						d6b79dcced
					
				
					 7 changed files with 22 additions and 18 deletions
				
			
		|  | @ -9,7 +9,8 @@ import { | |||
|     getStudentGroups, | ||||
|     getStudentSubmissions, | ||||
| } from '../services/students.js'; | ||||
| import { StudentDTO } from '../interfaces/student.js'; | ||||
| 
 | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| 
 | ||||
| // TODO: accept arguments (full, ...)
 | ||||
| // TODO: endpoints
 | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| import { Question } from '../entities/questions/question.entity.js'; | ||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||
| import { mapToStudentDTO, StudentDTO } from './student.js'; | ||||
| import { mapToStudentDTO } from './student.js'; | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| 
 | ||||
| export interface QuestionDTO { | ||||
|     learningObjectIdentifier: LearningObjectIdentifier; | ||||
|  |  | |||
|  | @ -1,18 +1,6 @@ | |||
| import { Student } from '../entities/users/student.entity.js'; | ||||
| import { getStudentRepository } from '../data/repositories.js'; | ||||
| 
 | ||||
| export interface StudentDTO { | ||||
|     id: string; | ||||
|     username: string; | ||||
|     firstName: string; | ||||
|     lastName: string; | ||||
|     endpoints?: { | ||||
|         classes: string; | ||||
|         questions: string; | ||||
|         invitations: string; | ||||
|         groups: string; | ||||
|     }; | ||||
| } | ||||
| import { StudentDTO } from 'dwengo-1-common/src/interfaces/student'; | ||||
| 
 | ||||
| export function mapToStudentDTO(student: Student): StudentDTO { | ||||
|     return { | ||||
|  |  | |||
|  | @ -1,10 +1,11 @@ | |||
| import { getClassRepository, getStudentRepository, getTeacherInvitationRepository, getTeacherRepository } from '../data/repositories.js'; | ||||
| import { mapToClassDTO } from '../interfaces/class.js'; | ||||
| import { mapToStudentDTO, StudentDTO } from '../interfaces/student.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'; | ||||
| 
 | ||||
| const logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,13 +1,14 @@ | |||
| import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js'; | ||||
| import { mapToClassDTO } from '../interfaces/class.js'; | ||||
| import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; | ||||
| import { mapToStudent, mapToStudentDTO, StudentDTO } from '../interfaces/student.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'; | ||||
| 
 | ||||
| export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | ||||
|     const studentRepository = getStudentRepository(); | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| import { getClassRepository, getLearningObjectRepository, getQuestionRepository, getTeacherRepository } from '../data/repositories.js'; | ||||
| import { mapToClassDTO } from '../interfaces/class.js'; | ||||
| import { getClassStudents } from './classes.js'; | ||||
| import { StudentDTO } from '../interfaces/student.js'; | ||||
| import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } 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'; | ||||
| 
 | ||||
| export async function getAllTeachers(full: boolean): Promise<TeacherDTO[] | string[]> { | ||||
|     const teacherRepository = getTeacherRepository(); | ||||
|  |  | |||
		Reference in a new issue