fix: merge errors
This commit is contained in:
parent
066f9e64c6
commit
66a65c1e67
7 changed files with 97 additions and 15 deletions
|
@ -3,9 +3,22 @@ import { ClassDTO, mapToClassDTO } from '../interfaces/class.js';
|
|||
import { mapToStudentDTO, StudentDTO } from '../interfaces/student.js';
|
||||
import { mapToTeacherInvitationDTO, mapToTeacherInvitationDTOIds, TeacherInvitationDTO } from '../interfaces/teacher-invitation.js';
|
||||
import { getLogger } from '../logging/initalize.js';
|
||||
import {NotFoundException} from "../exceptions/not-found-exception";
|
||||
import {Class} from "../entities/classes/class.entity";
|
||||
|
||||
const logger = getLogger();
|
||||
|
||||
export async function fetchClass(classId: string): Promise<Class> {
|
||||
const classRepository = getClassRepository();
|
||||
const cls = await classRepository.findById(classId);
|
||||
|
||||
if (!cls) {
|
||||
throw new NotFoundException("Class with id not found");
|
||||
}
|
||||
|
||||
return cls;
|
||||
}
|
||||
|
||||
export async function getAllClasses(full: boolean): Promise<ClassDTO[] | string[]> {
|
||||
const classRepository = getClassRepository();
|
||||
const classes = await classRepository.find({}, { populate: ['students', 'teachers'] });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue