fix: interface bestanden enkelvoud
This commit is contained in:
parent
9c9e7c4870
commit
4968d7cb07
12 changed files with 20 additions and 20 deletions
|
@ -1,7 +1,7 @@
|
|||
import { Request, Response } from 'express'
|
||||
import { getAssignment } from '../services/assignments';
|
||||
|
||||
// typescript is annoywith with parameter forwarding from classes.ts
|
||||
// typescript is annoywith with parameter forwarding from class.ts
|
||||
interface AssignmentParams {
|
||||
classid: string;
|
||||
id: string;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Request, Response } from 'express';
|
||||
import {getAllClasses, getClass, getClassStudents, getClassStudentsIds} from '../services/class';
|
||||
import { ClassDTO } from '../interfaces/classes';
|
||||
import { ClassDTO } from '../interfaces/class';
|
||||
|
||||
export async function getAllClassesHandler(
|
||||
req: Request,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Request, Response } from 'express';
|
||||
import { getAllStudents, getStudent, getStudentClasses, getStudentClassIds } from '../services/students';
|
||||
import { ClassDTO } from '../interfaces/classes';
|
||||
import { ClassDTO } from '../interfaces/class';
|
||||
|
||||
// TODO: accept arguments (full, ...)
|
||||
// TODO: endpoints
|
||||
|
@ -27,7 +27,7 @@ export async function getStudentHandler(
|
|||
try {
|
||||
const username = req.params.id;
|
||||
const student = await getStudent(username);
|
||||
|
||||
|
||||
if (!student) {
|
||||
res.status(404).json({ error: "Student not found" });
|
||||
return;
|
||||
|
@ -72,4 +72,4 @@ export async function getStudentClassesHandler (
|
|||
console.error('Error fetching learning objects:', error);
|
||||
res.status(500).json({ error: 'Internal server error' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import {
|
|||
getAllTeachersIds, getStudentsByTeacher, getStudentIdsByTeacher
|
||||
} from '../services/teachers.js';
|
||||
import {TeacherDTO} from "../interfaces/teacher";
|
||||
import {ClassDTO} from "../interfaces/classes";
|
||||
import {StudentDTO} from "../interfaces/students";
|
||||
import {ClassDTO} from "../interfaces/class";
|
||||
import {StudentDTO} from "../interfaces/student";
|
||||
|
||||
export async function getTeacherHandler(req: Request, res: Response): Promise<void> {
|
||||
try {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Assignment } from "../entities/assignments/assignment.entity";
|
||||
import { Class } from "../entities/classes/class.entity";
|
||||
import { GroupDTO } from "./groups";
|
||||
import { GroupDTO } from "./group";
|
||||
|
||||
export interface AssignmentDTO {
|
||||
id: number,
|
||||
|
@ -22,4 +22,4 @@ export function mapToAssignmentDTO(assignment: Assignment, cls: Class): Assignme
|
|||
language: assignment.learningPathLanguage,
|
||||
//groups: assignment.groups.map(mapToGroupDTO),
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import { getAssignmentRepository, getClassRepository } from "../data/repositories";
|
||||
import { AssignmentDTO, mapToAssignmentDTO } from "../interfaces/assignments";
|
||||
import { AssignmentDTO, mapToAssignmentDTO } from "../interfaces/assignment";
|
||||
|
||||
export async function getAssignment(classid: string, id: number): Promise<AssignmentDTO | null> {
|
||||
const classRepository = getClassRepository();
|
||||
|
@ -8,7 +8,7 @@ export async function getAssignment(classid: string, id: number): Promise<Assign
|
|||
if (!cls) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
const assignmentRepository = getAssignmentRepository();
|
||||
const assignment = await assignmentRepository.findByClassAndId(cls, id);
|
||||
|
||||
|
@ -17,4 +17,4 @@ export async function getAssignment(classid: string, id: number): Promise<Assign
|
|||
}
|
||||
|
||||
return mapToAssignmentDTO(assignment, cls);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { getClassRepository } from "../data/repositories";
|
||||
import { Class } from "../entities/classes/class.entity";
|
||||
import { ClassDTO, mapToClassDTO } from "../interfaces/classes";
|
||||
import { mapToStudentDTO, StudentDTO } from "../interfaces/students";
|
||||
import { ClassDTO, mapToClassDTO } from "../interfaces/class";
|
||||
import { mapToStudentDTO, StudentDTO } from "../interfaces/student";
|
||||
|
||||
export async function getAllClasses(full: boolean): Promise<ClassDTO[] | string[]> {
|
||||
const classRepository = getClassRepository();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { getClassRepository, getStudentRepository } from "../data/repositories";
|
||||
import { Class } from "../entities/classes/class.entity";
|
||||
import { Student } from "../entities/users/student.entity";
|
||||
import { ClassDTO, mapToClassDTO } from "../interfaces/classes";
|
||||
import { StudentDTO, mapToStudentDTO } from "../interfaces/students";
|
||||
import { ClassDTO, mapToClassDTO } from "../interfaces/class";
|
||||
import { StudentDTO, mapToStudentDTO } from "../interfaces/student";
|
||||
|
||||
|
||||
export async function getAllStudents(): Promise<StudentDTO[]> {
|
||||
|
@ -16,8 +16,8 @@ export async function getStudent(username: string): Promise<StudentDTO | null> {
|
|||
const studentRepository = getStudentRepository();
|
||||
const student = await studentRepository.findByUsername(username);
|
||||
|
||||
if (!student) {
|
||||
return null;
|
||||
if (!student) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return mapToStudentDTO(student);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {getClassRepository, getTeacherRepository} from "../data/repositories.js";
|
||||
import {mapToTeacher, mapToTeacherDTO, TeacherDTO} from "../interfaces/teacher.js";
|
||||
import { Teacher } from "../entities/users/teacher.entity";
|
||||
import {ClassDTO, mapToClassDTO} from "../interfaces/classes";
|
||||
import {ClassDTO, mapToClassDTO} from "../interfaces/class";
|
||||
import {getClassStudents, getClassStudentsIds} from "./class";
|
||||
import {StudentDTO} from "../interfaces/students";
|
||||
import {StudentDTO} from "../interfaces/student";
|
||||
|
||||
|
||||
async function fetchAllTeachers(): Promise<TeacherDTO[]> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue