Check for private fields visibility properly in tournament public API

This commit is contained in:
Kalle
2026-09-08 22:09:44 +03:00
parent aeb96018d7
commit 1787b7b8eb
8 changed files with 208 additions and 57 deletions

View File

@@ -52,13 +52,10 @@ export const apiAuthMiddleware: MiddlewareFn = async ({ request }, next) => {
return Response.json({ error: "Write token required" }, { status: 403 });
}
if (request.method === "POST") {
const user = await UserRepository.findLeanById(tokenInfo.userId);
if (!user) {
return Response.json({ error: "User not found" }, { status: 401 });
}
return userAsyncLocalStorage.run({ user }, () => next());
const user = await UserRepository.findLeanById(tokenInfo.userId);
if (!user) {
return Response.json({ error: "User not found" }, { status: 401 });
}
return next();
return userAsyncLocalStorage.run({ user }, () => next());
};