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,
|
getStudentGroups,
|
||||||
getStudentSubmissions,
|
getStudentSubmissions,
|
||||||
} from '../services/students.js';
|
} from '../services/students.js';
|
||||||
import { StudentDTO } from '../interfaces/student.js';
|
|
||||||
|
import { StudentDTO } from 'dwengo-1-common/src/interfaces/student';
|
||||||
|
|
||||||
// TODO: accept arguments (full, ...)
|
// TODO: accept arguments (full, ...)
|
||||||
// TODO: endpoints
|
// TODO: endpoints
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Question } from '../entities/questions/question.entity.js';
|
import { Question } from '../entities/questions/question.entity.js';
|
||||||
import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.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 {
|
export interface QuestionDTO {
|
||||||
learningObjectIdentifier: LearningObjectIdentifier;
|
learningObjectIdentifier: LearningObjectIdentifier;
|
||||||
|
|
|
@ -1,18 +1,6 @@
|
||||||
import { Student } from '../entities/users/student.entity.js';
|
import { Student } from '../entities/users/student.entity.js';
|
||||||
import { getStudentRepository } from '../data/repositories.js';
|
import { getStudentRepository } from '../data/repositories.js';
|
||||||
|
import { StudentDTO } from 'dwengo-1-common/src/interfaces/student';
|
||||||
export interface StudentDTO {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
firstName: string;
|
|
||||||
lastName: string;
|
|
||||||
endpoints?: {
|
|
||||||
classes: string;
|
|
||||||
questions: string;
|
|
||||||
invitations: string;
|
|
||||||
groups: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function mapToStudentDTO(student: Student): StudentDTO {
|
export function mapToStudentDTO(student: Student): StudentDTO {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { getClassRepository, getStudentRepository, getTeacherInvitationRepository, getTeacherRepository } from '../data/repositories.js';
|
import { getClassRepository, getStudentRepository, getTeacherInvitationRepository, getTeacherRepository } from '../data/repositories.js';
|
||||||
import { mapToClassDTO } from '../interfaces/class.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 { mapToTeacherInvitationDTO, mapToTeacherInvitationDTOIds } from '../interfaces/teacher-invitation.js';
|
||||||
import { getLogger } from '../logging/initalize.js';
|
import { getLogger } from '../logging/initalize.js';
|
||||||
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
||||||
import { TeacherInvitationDTO } from 'dwengo-1-common/src/interfaces/teacher-invitation';
|
import { TeacherInvitationDTO } from 'dwengo-1-common/src/interfaces/teacher-invitation';
|
||||||
|
import { StudentDTO } from 'dwengo-1-common/src/interfaces/student';
|
||||||
|
|
||||||
const logger = getLogger();
|
const logger = getLogger();
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js';
|
import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js';
|
||||||
import { mapToClassDTO } from '../interfaces/class.js';
|
import { mapToClassDTO } from '../interfaces/class.js';
|
||||||
import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.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 { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js';
|
||||||
import { getAllAssignments } from './assignments.js';
|
import { getAllAssignments } from './assignments.js';
|
||||||
import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment';
|
import { AssignmentDTO } from 'dwengo-1-common/src/interfaces/assignment';
|
||||||
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
||||||
import { GroupDTO } from 'dwengo-1-common/src/interfaces/group';
|
import { GroupDTO } from 'dwengo-1-common/src/interfaces/group';
|
||||||
import { SubmissionDTO, SubmissionDTOId } from 'dwengo-1-common/src/interfaces/submission';
|
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[]> {
|
export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> {
|
||||||
const studentRepository = getStudentRepository();
|
const studentRepository = getStudentRepository();
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { getClassRepository, getLearningObjectRepository, getQuestionRepository, getTeacherRepository } from '../data/repositories.js';
|
import { getClassRepository, getLearningObjectRepository, getQuestionRepository, getTeacherRepository } from '../data/repositories.js';
|
||||||
import { mapToClassDTO } from '../interfaces/class.js';
|
import { mapToClassDTO } from '../interfaces/class.js';
|
||||||
import { getClassStudents } from './classes.js';
|
import { getClassStudents } from './classes.js';
|
||||||
import { StudentDTO } from '../interfaces/student.js';
|
|
||||||
import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } from '../interfaces/question.js';
|
import { mapToQuestionDTO, mapToQuestionId, QuestionDTO, QuestionId } from '../interfaces/question.js';
|
||||||
import { mapToTeacher, mapToTeacherDTO } from '../interfaces/teacher.js';
|
import { mapToTeacher, mapToTeacherDTO } from '../interfaces/teacher.js';
|
||||||
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
import { ClassDTO } from 'dwengo-1-common/src/interfaces/class';
|
||||||
import { TeacherDTO } from 'dwengo-1-common/src/interfaces/teacher';
|
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[]> {
|
export async function getAllTeachers(full: boolean): Promise<TeacherDTO[] | string[]> {
|
||||||
const teacherRepository = getTeacherRepository();
|
const teacherRepository = getTeacherRepository();
|
||||||
|
|
12
common/src/interfaces/student.d.ts
vendored
Normal file
12
common/src/interfaces/student.d.ts
vendored
Normal 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;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue