[web] Fix template path, return team lang in API

This commit is contained in:
orosmatthew 2023-11-15 21:01:47 -05:00
parent 9482a1f46b
commit 63fa791d4a
2 changed files with 6 additions and 4 deletions

View File

@ -63,7 +63,7 @@ export async function createRepos(contestId: number) {
return;
}
const templateDir = join(dirname(fileURLToPath(import.meta.url)), '../../../../templates');
const templateDir = join(dirname(fileURLToPath(import.meta.url)), '../../../templates');
contest.teams.forEach(async (team) => {
fs.mkdirSync(team.id.toString(), { recursive: true });

View File

@ -5,16 +5,18 @@ import { db } from '$lib/server/prisma';
export const GET = (async ({ params }) => {
const session = params.session;
const activeTeam = await db.activeTeam.findUnique({
where: { sessionToken: session }
where: { sessionToken: session },
include: { team: { select: { language: true } } }
});
if (!activeTeam) {
if (activeTeam === null) {
return json({ success: false });
}
return json({
success: true,
data: {
teamId: activeTeam.teamId,
contestId: activeTeam.contestId
contestId: activeTeam.contestId,
language: activeTeam.team.language
}
});
}) satisfies RequestHandler;