- Added the ability for a student/developer to choose a gender for a speaking instructor;

- Made it so, if chosen, the user will only get speaking exams with their chosen gender;
- Added the ability for speaking exams to select a gender when generating;
This commit is contained in:
Tiago Ribeiro
2024-02-09 12:14:47 +00:00
parent ce7032c8a7
commit 872cc62fe4
11 changed files with 337 additions and 238 deletions

View File

@@ -4,7 +4,7 @@ import {app} from "@/firebase";
import {getFirestore, setDoc, doc} from "firebase/firestore";
import {withIronSessionApiRoute} from "iron-session/next";
import {sessionOptions} from "@/lib/session";
import {Exam, Variant} from "@/interfaces/exam";
import {Exam, InstructorGender, Variant} from "@/interfaces/exam";
import {getExams} from "@/utils/exams.be";
const db = getFirestore(app);
@@ -23,9 +23,14 @@ async function GET(req: NextApiRequest, res: NextApiResponse) {
return;
}
const {module, avoidRepeated, variant} = req.query as {module: string; avoidRepeated: string; variant?: Variant};
const {module, avoidRepeated, variant, instructorGender} = req.query as {
module: string;
avoidRepeated: string;
variant?: Variant;
instructorGender?: InstructorGender;
};
const exams: Exam[] = await getExams(db, module, avoidRepeated, req.session.user.id, variant);
const exams: Exam[] = await getExams(db, module, avoidRepeated, req.session.user.id, variant, instructorGender);
res.status(200).json(exams);
}