feat: allow testing on creating new session

This commit is contained in:
wancat committed 2024-07-28 15:14:45 +08:00
1 parent 6400aa4a56
commit d577656eb1
1 file changed
+4 -1
@@ -43,7 +43,10 @@ export const createSession = asyncHandler(
async (req: Request, res: Response) => {
const { questId } = matchedData(req)
const user = await User.findById((req.user as Express.ExistingUser).id)
if (user && (await isQuestUnlocked(user, questId))) {
if (
user &&
((await isQuestUnlocked(user, questId)) || config.testing.enabled)
) {
const session = await createNewSession(user, questId)
res.status(201).json(sessionDetail(session))
} else {