refactor(common): Student

This commit is contained in:
Tibo De Peuter 2025-03-31 21:48:13 +02:00
parent bc8e888373
commit d6b79dcced
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
7 changed files with 22 additions and 18 deletions

View file

@ -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

View file

@ -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;

View file

@ -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 {

View file

@ -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();

View file

@ -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();

View file

@ -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();

12
common/src/interfaces/student.d.ts vendored Normal file
View file

@ -0,0 +1,12 @@
export interface StudentDTO {
id: string;
username: string;
firstName: string;
lastName: string;
endpoints?: {
classes: string;
questions: string;
invitations: string;
groups: string;
};
}