- Implemented an image attachment to the Writing exercise;

- Made it so the exams are now sorted when going through the history;
- Corrected some little mistakes;
This commit is contained in:
Tiago Ribeiro
2023-05-28 10:00:06 +01:00
parent 7f72349f76
commit 79a532b5ff
8 changed files with 31 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type {NextApiRequest, NextApiResponse} from "next";
import {app} from "@/firebase";
import {getFirestore, collection, getDocs} from "firebase/firestore";
import {getFirestore, collection, getDocs, query, where} from "firebase/firestore";
import {withIronSessionApiRoute} from "iron-session/next";
import {sessionOptions} from "@/lib/session";
@@ -16,8 +16,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
}
const {module} = req.query as {module: string};
const moduleRef = collection(db, module);
const q = query(moduleRef, where("isDiagnostic", "==", false));
const snapshot = await getDocs(collection(db, module));
const snapshot = await getDocs(q);
res.status(200).json(
snapshot.docs.map((doc) => ({