diff --git a/backend/src/controllers/assignments.ts b/backend/src/controllers/assignments.ts index feabb1e1..1a79c8b1 100644 --- a/backend/src/controllers/assignments.ts +++ b/backend/src/controllers/assignments.ts @@ -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; diff --git a/backend/src/controllers/classes.ts b/backend/src/controllers/classes.ts index c8095162..65391781 100644 --- a/backend/src/controllers/classes.ts +++ b/backend/src/controllers/classes.ts @@ -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, diff --git a/backend/src/controllers/students.ts b/backend/src/controllers/students.ts index c6973632..64822b4d 100644 --- a/backend/src/controllers/students.ts +++ b/backend/src/controllers/students.ts @@ -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' }); } -} \ No newline at end of file +} diff --git a/backend/src/controllers/teachers.ts b/backend/src/controllers/teachers.ts index 6f363c20..2ef63b65 100644 --- a/backend/src/controllers/teachers.ts +++ b/backend/src/controllers/teachers.ts @@ -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 { try { diff --git a/backend/src/interfaces/assignments.ts b/backend/src/interfaces/assignment.ts similarity index 95% rename from backend/src/interfaces/assignments.ts rename to backend/src/interfaces/assignment.ts index a3c3c4cc..59242920 100644 --- a/backend/src/interfaces/assignments.ts +++ b/backend/src/interfaces/assignment.ts @@ -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), }; -} \ No newline at end of file +} diff --git a/backend/src/interfaces/classes.ts b/backend/src/interfaces/class.ts similarity index 100% rename from backend/src/interfaces/classes.ts rename to backend/src/interfaces/class.ts diff --git a/backend/src/interfaces/groups.ts b/backend/src/interfaces/group.ts similarity index 100% rename from backend/src/interfaces/groups.ts rename to backend/src/interfaces/group.ts diff --git a/backend/src/interfaces/students.ts b/backend/src/interfaces/student.ts similarity index 100% rename from backend/src/interfaces/students.ts rename to backend/src/interfaces/student.ts diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index ab76f6a8..48c6b883 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -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 { const classRepository = getClassRepository(); @@ -8,7 +8,7 @@ export async function getAssignment(classid: string, id: number): Promise { const classRepository = getClassRepository(); diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index a69cab85..5def5119 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -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 { @@ -16,8 +16,8 @@ export async function getStudent(username: string): Promise { const studentRepository = getStudentRepository(); const student = await studentRepository.findByUsername(username); - if (!student) { - return null; + if (!student) { + return null; } return mapToStudentDTO(student); diff --git a/backend/src/services/teachers.ts b/backend/src/services/teachers.ts index 39ee3997..8382e4b3 100644 --- a/backend/src/services/teachers.ts +++ b/backend/src/services/teachers.ts @@ -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 {