Created a system to go directly to an assignment from a URL
This commit is contained in:
@@ -8,6 +8,7 @@ import {getUserCorporate} from "./groups.be";
|
||||
import {Db, ObjectId} from "mongodb";
|
||||
import client from "@/lib/mongodb";
|
||||
import {MODULE_ARRAY} from "./moduleUtils";
|
||||
import { mapBy } from ".";
|
||||
|
||||
const db = client.db(process.env.MONGODB_DB);
|
||||
|
||||
@@ -37,7 +38,7 @@ export const getExamsByIds = async (ids: {module: Module; id: string}[]) => {
|
||||
async (m) =>
|
||||
await db
|
||||
.collection(m)
|
||||
.find<Exam>({id: {$in: groupedByModule[m]}})
|
||||
.find<Exam>({id: {$in: mapBy(groupedByModule[m], 'id')}})
|
||||
.toArray(),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user