Merge remote-tracking branch 'origin/feat/user-routes' into feat/user-routes
# Conflicts: # backend/src/interfaces/answer.ts # backend/src/services/questions.ts # frontend/src/controllers/students.ts # frontend/src/controllers/teachers.ts # frontend/src/queries/students.ts # frontend/src/queries/teachers.ts
This commit is contained in:
commit
87366b2821
7 changed files with 23 additions and 41 deletions
|
@ -4,7 +4,8 @@ import {
|
|||
createStudent,
|
||||
deleteClassJoinRequest,
|
||||
deleteStudent,
|
||||
getAllStudents, getJoinRequestByStudentClass,
|
||||
getAllStudents,
|
||||
getJoinRequestByStudentClass,
|
||||
getJoinRequestsByStudent,
|
||||
getStudent,
|
||||
getStudentAssignments,
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
createStudentRequestHandler,
|
||||
deleteClassJoinRequestHandler,
|
||||
getStudentRequestHandler,
|
||||
getStudentRequestsHandler
|
||||
getStudentRequestsHandler,
|
||||
} from '../controllers/students.js';
|
||||
|
||||
const router = express.Router({ mergeParams: true });
|
||||
|
|
|
@ -12,13 +12,8 @@ import { GroupDTO, mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js
|
|||
import { mapToStudent, mapToStudentDTO, StudentDTO } from '../interfaces/student.js';
|
||||
import { mapToSubmissionDTO, mapToSubmissionDTOId, SubmissionDTO, SubmissionDTOId } from '../interfaces/submission.js';
|
||||
import { getAllAssignments } from './assignments.js';
|
||||
import {
|
||||
mapToQuestionDTO,
|
||||
mapToQuestionDTOId,
|
||||
QuestionDTO,
|
||||
QuestionId
|
||||
} from '../interfaces/question.js';
|
||||
import {mapToStudentRequest, mapToStudentRequestDTO, StudentRequestDTO} from '../interfaces/student-request.js';
|
||||
import { mapToQuestionDTO, mapToQuestionDTOId, QuestionDTO, QuestionId } from '../interfaces/question.js';
|
||||
import { mapToStudentRequest, mapToStudentRequestDTO, StudentRequestDTO } from '../interfaces/student-request.js';
|
||||
import { Student } from '../entities/users/student.entity.js';
|
||||
import { NotFoundException } from '../exceptions/not-found-exception.js';
|
||||
import { fetchClass } from './classes.js';
|
||||
|
@ -148,14 +143,14 @@ export async function getJoinRequestsByStudent(username: string): Promise<Studen
|
|||
return requests.map(mapToStudentRequestDTO);
|
||||
}
|
||||
|
||||
export async function getJoinRequestByStudentClass(username: string, classId: string): Promise<StudentRequestDTO>{
|
||||
export async function getJoinRequestByStudentClass(username: string, classId: string): Promise<StudentRequestDTO> {
|
||||
const requestRepo = getClassJoinRequestRepository();
|
||||
|
||||
const student = await fetchStudent(username);
|
||||
const cls = await fetchClass(classId);
|
||||
|
||||
const request = await requestRepo.findByStudentAndClass(student, cls);
|
||||
if (!request){
|
||||
if (!request) {
|
||||
throw new NotFoundException('Join request not found');
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,7 @@ import {
|
|||
getTeacherRepository,
|
||||
} from '../data/repositories.js';
|
||||
import { ClassDTO, mapToClassDTO } from '../interfaces/class.js';
|
||||
import {
|
||||
mapToQuestionDTO,
|
||||
mapToQuestionDTOId,
|
||||
QuestionDTO,
|
||||
QuestionId
|
||||
} from '../interfaces/question.js';
|
||||
import { mapToQuestionDTO, mapToQuestionDTOId, QuestionDTO, QuestionId } from '../interfaces/question.js';
|
||||
import { mapToTeacher, mapToTeacherDTO, TeacherDTO } from '../interfaces/teacher.js';
|
||||
import { Teacher } from '../entities/users/teacher.entity.js';
|
||||
import { fetchStudent } from './students.js';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue