[web] Upgrade major deps (Sveltekit 2)
This commit is contained in:
parent
48f97a8ffb
commit
a19950a094
626
web/package-lock.json
generated
626
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,8 @@
|
|||||||
"format": "prettier --plugin prettier-plugin-svelte --write ."
|
"format": "prettier --plugin prettier-plugin-svelte --write ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/kit": "^1.27.6",
|
"@sveltejs/kit": "^2.0.4",
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
"@types/bootstrap": "^5.2.10",
|
"@types/bootstrap": "^5.2.10",
|
||||||
"@types/diff": "^5.0.9",
|
"@types/diff": "^5.0.9",
|
||||||
@ -30,12 +31,12 @@
|
|||||||
"svelte-check": "^3.6.2",
|
"svelte-check": "^3.6.2",
|
||||||
"tslib": "^2.6.2",
|
"tslib": "^2.6.2",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"vite": "^4.5.1"
|
"vite": "^5.0.10"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^5.7.1",
|
"@prisma/client": "^5.7.1",
|
||||||
"@sveltejs/adapter-node": "^1.3.1",
|
"@sveltejs/adapter-node": "^2.0.1",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"bootstrap": "^5.3.2",
|
"bootstrap": "^5.3.2",
|
||||||
|
@ -38,13 +38,13 @@ export const handle = (async ({ event, resolve }) => {
|
|||||||
|
|
||||||
if (event.url.pathname.startsWith('/login')) {
|
if (event.url.pathname.startsWith('/login')) {
|
||||||
if ((await isSessionValid(event.cookies)) === true) {
|
if ((await isSessionValid(event.cookies)) === true) {
|
||||||
throw redirect(302, '/admin');
|
redirect(302, '/admin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.url.pathname.startsWith('/admin')) {
|
if (event.url.pathname.startsWith('/admin')) {
|
||||||
if ((await isSessionValid(event.cookies)) !== true) {
|
if ((await isSessionValid(event.cookies)) !== true) {
|
||||||
logout(event.cookies);
|
logout(event.cookies);
|
||||||
throw redirect(302, '/login');
|
redirect(302, '/login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const res = await resolve(event, {
|
const res = await resolve(event, {
|
||||||
|
@ -30,7 +30,7 @@ export async function logout(cookies: Cookies): Promise<boolean> {
|
|||||||
if (sessionCookie === undefined) {
|
if (sessionCookie === undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cookies.delete('session');
|
cookies.delete('session', { path: '/' });
|
||||||
try {
|
try {
|
||||||
await db.session.delete({ where: { token: sessionCookie } });
|
await db.session.delete({ where: { token: sessionCookie } });
|
||||||
} catch {
|
} catch {
|
||||||
@ -57,6 +57,7 @@ export async function attemptLogin(
|
|||||||
const session = await db.session.create({ data: { userId: user.id } });
|
const session = await db.session.create({ data: { userId: user.id } });
|
||||||
cookies.set('session', session.token, {
|
cookies.set('session', session.token, {
|
||||||
// secure: process.env.NODE_ENV === 'development' ? false : true,
|
// secure: process.env.NODE_ENV === 'development' ? false : true,
|
||||||
|
path: '/',
|
||||||
secure: false,
|
secure: false,
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'strict',
|
sameSite: 'strict',
|
||||||
@ -85,6 +86,6 @@ export async function isSessionValid(cookies: Cookies): Promise<boolean> {
|
|||||||
|
|
||||||
export async function redirectIfSessionInvalid(url: string, cookies: Cookies): Promise<void> {
|
export async function redirectIfSessionInvalid(url: string, cookies: Cookies): Promise<void> {
|
||||||
if (!(await isSessionValid(cookies))) {
|
if (!(await isSessionValid(cookies))) {
|
||||||
throw redirect(302, url);
|
redirect(302, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,14 @@ import { createRepos } from '$lib/server/repos';
|
|||||||
export const load = (async ({ params }) => {
|
export const load = (async ({ params }) => {
|
||||||
const contestId = parseInt(params.contestId);
|
const contestId = parseInt(params.contestId);
|
||||||
if (isNaN(contestId)) {
|
if (isNaN(contestId)) {
|
||||||
throw error(400, 'Invalid request');
|
error(400, 'Invalid request');
|
||||||
}
|
}
|
||||||
const contest = await db.contest.findUnique({
|
const contest = await db.contest.findUnique({
|
||||||
where: { id: contestId },
|
where: { id: contestId },
|
||||||
include: { problems: true, teams: true, activeTeams: true }
|
include: { problems: true, teams: true, activeTeams: true }
|
||||||
});
|
});
|
||||||
if (!contest) {
|
if (!contest) {
|
||||||
throw redirect(302, '/admin/contests');
|
redirect(302, '/admin/contests');
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
name: contest.name,
|
name: contest.name,
|
||||||
@ -39,7 +39,7 @@ export const actions = {
|
|||||||
} catch {
|
} catch {
|
||||||
return { success: false };
|
return { success: false };
|
||||||
}
|
}
|
||||||
throw redirect(302, '/admin/contests');
|
redirect(302, '/admin/contests');
|
||||||
},
|
},
|
||||||
start: async ({ params }) => {
|
start: async ({ params }) => {
|
||||||
if (!params.contestId) {
|
if (!params.contestId) {
|
||||||
|
@ -4,11 +4,11 @@ import { db } from '$lib/server/prisma';
|
|||||||
|
|
||||||
export const load = (async ({ params }) => {
|
export const load = (async ({ params }) => {
|
||||||
if (!params.contestId) {
|
if (!params.contestId) {
|
||||||
throw redirect(302, '/admin/contests');
|
redirect(302, '/admin/contests');
|
||||||
}
|
}
|
||||||
const contestId = parseInt(params.contestId);
|
const contestId = parseInt(params.contestId);
|
||||||
if (isNaN(contestId)) {
|
if (isNaN(contestId)) {
|
||||||
throw redirect(302, '/admin/contests');
|
redirect(302, '/admin/contests');
|
||||||
}
|
}
|
||||||
|
|
||||||
const contest = await db.contest.findUnique({
|
const contest = await db.contest.findUnique({
|
||||||
@ -16,7 +16,7 @@ export const load = (async ({ params }) => {
|
|||||||
include: { teams: true }
|
include: { teams: true }
|
||||||
});
|
});
|
||||||
if (!contest) {
|
if (!contest) {
|
||||||
throw redirect(302, '/admin/contests');
|
redirect(302, '/admin/contests');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -6,15 +6,15 @@ import { SubmissionState, SubmissionStateReason } from '@prisma/client';
|
|||||||
export const load = (async ({ params }) => {
|
export const load = (async ({ params }) => {
|
||||||
const submissionId = parseInt(params.submissionId);
|
const submissionId = parseInt(params.submissionId);
|
||||||
if (isNaN(submissionId)) {
|
if (isNaN(submissionId)) {
|
||||||
throw error(400, 'Invalid request');
|
error(400, 'Invalid request');
|
||||||
}
|
}
|
||||||
const submission = await db.submission.findUnique({ where: { id: submissionId } });
|
const submission = await db.submission.findUnique({ where: { id: submissionId } });
|
||||||
if (!submission) {
|
if (!submission) {
|
||||||
throw redirect(302, '/admin/reviews');
|
redirect(302, '/admin/reviews');
|
||||||
}
|
}
|
||||||
const problem = await db.problem.findUnique({ where: { id: submission.problemId } });
|
const problem = await db.problem.findUnique({ where: { id: submission.problemId } });
|
||||||
if (!problem) {
|
if (!problem) {
|
||||||
throw error(500, 'Invalid problem');
|
error(500, 'Invalid problem');
|
||||||
}
|
}
|
||||||
|
|
||||||
return { diff: submission.diff, submissionId: submission.id, output: submission.actualOutput };
|
return { diff: submission.diff, submissionId: submission.id, output: submission.actualOutput };
|
||||||
@ -38,7 +38,7 @@ export const actions = {
|
|||||||
where: { id: submissionId },
|
where: { id: submissionId },
|
||||||
data: {
|
data: {
|
||||||
state: correctBool ? SubmissionState.Correct : SubmissionState.Incorrect,
|
state: correctBool ? SubmissionState.Correct : SubmissionState.Incorrect,
|
||||||
stateReason : correctBool ? SubmissionStateReason.IncorrectOverriddenAsCorrect : null,
|
stateReason: correctBool ? SubmissionStateReason.IncorrectOverriddenAsCorrect : null,
|
||||||
message: message ? message.toString() : '',
|
message: message ? message.toString() : '',
|
||||||
gradedAt: gradedTime
|
gradedAt: gradedTime
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import type { Actions, PageServerLoad } from './$types';
|
|||||||
export const load = (async ({ params }) => {
|
export const load = (async ({ params }) => {
|
||||||
const problemId = parseInt(params.problemId);
|
const problemId = parseInt(params.problemId);
|
||||||
if (isNaN(problemId)) {
|
if (isNaN(problemId)) {
|
||||||
throw error(400, 'Invalid request');
|
error(400, 'Invalid request');
|
||||||
}
|
}
|
||||||
const query = await db.problem.findUnique({ where: { id: problemId } });
|
const query = await db.problem.findUnique({ where: { id: problemId } });
|
||||||
if (!query) {
|
if (!query) {
|
||||||
throw redirect(302, '/admin/problems');
|
redirect(302, '/admin/problems');
|
||||||
}
|
}
|
||||||
return { problemData: query };
|
return { problemData: query };
|
||||||
}) satisfies PageServerLoad;
|
}) satisfies PageServerLoad;
|
||||||
@ -18,7 +18,7 @@ export const actions = {
|
|||||||
edit: async ({ params, request }) => {
|
edit: async ({ params, request }) => {
|
||||||
const problemId = parseInt(params.problemId);
|
const problemId = parseInt(params.problemId);
|
||||||
if (isNaN(problemId)) {
|
if (isNaN(problemId)) {
|
||||||
throw error(400, 'Invalid problem');
|
error(400, 'Invalid problem');
|
||||||
}
|
}
|
||||||
const data = await request.formData();
|
const data = await request.formData();
|
||||||
const name = data.get('name');
|
const name = data.get('name');
|
||||||
|
@ -5,7 +5,7 @@ import { db } from '$lib/server/prisma';
|
|||||||
export const DELETE = (async ({ params }) => {
|
export const DELETE = (async ({ params }) => {
|
||||||
const problemId = parseInt(params.problemId);
|
const problemId = parseInt(params.problemId);
|
||||||
if (isNaN(problemId)) {
|
if (isNaN(problemId)) {
|
||||||
throw error(400, 'Invalid problem');
|
error(400, 'Invalid problem');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await db.problem.delete({ where: { id: problemId } });
|
await db.problem.delete({ where: { id: problemId } });
|
||||||
|
@ -5,19 +5,19 @@ import { db } from '$lib/server/prisma';
|
|||||||
export const load = (async ({ params }) => {
|
export const load = (async ({ params }) => {
|
||||||
const submissionId = parseInt(params.submissionId);
|
const submissionId = parseInt(params.submissionId);
|
||||||
if (isNaN(submissionId)) {
|
if (isNaN(submissionId)) {
|
||||||
throw error(400, 'Invalid submission');
|
error(400, 'Invalid submission');
|
||||||
}
|
}
|
||||||
const submission = await db.submission.findUnique({ where: { id: submissionId } });
|
const submission = await db.submission.findUnique({ where: { id: submissionId } });
|
||||||
if (!submission) {
|
if (!submission) {
|
||||||
throw redirect(302, '/admin/submissions');
|
redirect(302, '/admin/submissions');
|
||||||
}
|
}
|
||||||
const team = await db.team.findUnique({ where: { id: submission.teamId } });
|
const team = await db.team.findUnique({ where: { id: submission.teamId } });
|
||||||
if (!team) {
|
if (!team) {
|
||||||
throw error(500, 'Invalid team');
|
error(500, 'Invalid team');
|
||||||
}
|
}
|
||||||
const problem = await db.problem.findUnique({ where: { id: submission.problemId } });
|
const problem = await db.problem.findUnique({ where: { id: submission.problemId } });
|
||||||
if (!problem) {
|
if (!problem) {
|
||||||
throw error(500, 'Invalid problem');
|
error(500, 'Invalid problem');
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
id: submission.id,
|
id: submission.id,
|
||||||
@ -42,6 +42,6 @@ export const actions = {
|
|||||||
} catch {
|
} catch {
|
||||||
return { success: false };
|
return { success: false };
|
||||||
}
|
}
|
||||||
throw redirect(302, '/admin/submissions');
|
redirect(302, '/admin/submissions');
|
||||||
}
|
}
|
||||||
} satisfies Actions;
|
} satisfies Actions;
|
||||||
|
@ -129,10 +129,14 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else if data.state == 'Incorrect' && data.stateReason == 'BuildError'}
|
{:else if data.state == 'Incorrect' && data.stateReason == 'BuildError'}
|
||||||
<h3 style="text-align:center">Build Output</h3>
|
<h3 style="text-align:center">Build Output</h3>
|
||||||
<textarea use:stretchTextarea class="code mb-3 form-control" disabled>{data.stateReasonDetails}</textarea>
|
<textarea use:stretchTextarea class="code mb-3 form-control" disabled
|
||||||
|
>{data.stateReasonDetails}</textarea
|
||||||
|
>
|
||||||
{:else if data.state == 'Incorrect' && data.stateReason == 'TimeLimitExceeded'}
|
{:else if data.state == 'Incorrect' && data.stateReason == 'TimeLimitExceeded'}
|
||||||
<h3 style="text-align:center">Details</h3>
|
<h3 style="text-align:center">Details</h3>
|
||||||
<textarea use:stretchTextarea class="code mb-3 form-control" disabled>{data.stateReasonDetails}</textarea>
|
<textarea use:stretchTextarea class="code mb-3 form-control" disabled
|
||||||
|
>{data.stateReasonDetails}</textarea
|
||||||
|
>
|
||||||
{:else}
|
{:else}
|
||||||
<h3 style="text-align:center">Output</h3>
|
<h3 style="text-align:center">Output</h3>
|
||||||
<textarea use:stretchTextarea class="code mb-3 form-control" disabled>{data.output}</textarea>
|
<textarea use:stretchTextarea class="code mb-3 form-control" disabled>{data.output}</textarea>
|
||||||
|
@ -34,7 +34,7 @@ export const GET = (async () => {
|
|||||||
}
|
}
|
||||||
}) satisfies RequestHandler;
|
}) satisfies RequestHandler;
|
||||||
|
|
||||||
const RunResultKind = z.enum(["CompileFailed", "TimeLimitExceeded", "Completed", "SandboxError"]);
|
const RunResultKind = z.enum(['CompileFailed', 'TimeLimitExceeded', 'Completed', 'SandboxError']);
|
||||||
export type RunResultKind = z.infer<typeof RunResultKind>;
|
export type RunResultKind = z.infer<typeof RunResultKind>;
|
||||||
|
|
||||||
const RunResult = z
|
const RunResult = z
|
||||||
@ -58,8 +58,10 @@ export const POST = (async ({ request }) => {
|
|||||||
const requestJson = await request.json();
|
const requestJson = await request.json();
|
||||||
const data = submissionPostData.safeParse(requestJson);
|
const data = submissionPostData.safeParse(requestJson);
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
console.log("Error: POST to Submission API failed to parse given object: " + JSON.stringify(requestJson));
|
console.log(
|
||||||
throw error(400);
|
'Error: POST to Submission API failed to parse given object: ' + JSON.stringify(requestJson)
|
||||||
|
);
|
||||||
|
error(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
const submission = await db.submission.findUnique({
|
const submission = await db.submission.findUnique({
|
||||||
@ -68,12 +70,16 @@ export const POST = (async ({ request }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!submission) {
|
if (!submission) {
|
||||||
console.log("Error: POST to Submission API for unknown submissionId: " + data.data.submissionId);
|
console.log(
|
||||||
|
'Error: POST to Submission API for unknown submissionId: ' + data.data.submissionId
|
||||||
|
);
|
||||||
return json({ success: false });
|
return json({ success: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (submission.state !== SubmissionState.Queued) {
|
if (submission.state !== SubmissionState.Queued) {
|
||||||
console.log("Error: POST to Submission API for already judged submissionId: " + data.data.submissionId);
|
console.log(
|
||||||
|
'Error: POST to Submission API for already judged submissionId: ' + data.data.submissionId
|
||||||
|
);
|
||||||
return json({ success: false });
|
return json({ success: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +88,13 @@ export const POST = (async ({ request }) => {
|
|||||||
if (data.data.result.output!.trimEnd() === submission.problem.realOutput.trimEnd()) {
|
if (data.data.result.output!.trimEnd() === submission.problem.realOutput.trimEnd()) {
|
||||||
await db.submission.update({
|
await db.submission.update({
|
||||||
where: { id: data.data.submissionId },
|
where: { id: data.data.submissionId },
|
||||||
data: { state: SubmissionState.Correct, gradedAt: new Date(), actualOutput: data.data.result.output,
|
data: {
|
||||||
stateReason: null, stateReasonDetails: null }
|
state: SubmissionState.Correct,
|
||||||
|
gradedAt: new Date(),
|
||||||
|
actualOutput: data.data.result.output,
|
||||||
|
stateReason: null,
|
||||||
|
stateReasonDetails: null
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return json({ success: true });
|
return json({ success: true });
|
||||||
} else {
|
} else {
|
||||||
@ -95,8 +106,13 @@ export const POST = (async ({ request }) => {
|
|||||||
);
|
);
|
||||||
await db.submission.update({
|
await db.submission.update({
|
||||||
where: { id: data.data.submissionId },
|
where: { id: data.data.submissionId },
|
||||||
data: { state: SubmissionState.InReview, diff: diff, actualOutput: data.data.result.output,
|
data: {
|
||||||
stateReason: null, stateReasonDetails: null }
|
state: SubmissionState.InReview,
|
||||||
|
diff: diff,
|
||||||
|
actualOutput: data.data.result.output,
|
||||||
|
stateReason: null,
|
||||||
|
stateReasonDetails: null
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return json({ success: true });
|
return json({ success: true });
|
||||||
}
|
}
|
||||||
@ -105,16 +121,25 @@ export const POST = (async ({ request }) => {
|
|||||||
console.log('compile failed...');
|
console.log('compile failed...');
|
||||||
await db.submission.update({
|
await db.submission.update({
|
||||||
where: { id: data.data.submissionId },
|
where: { id: data.data.submissionId },
|
||||||
data: { state: SubmissionState.Incorrect, gradedAt: new Date(),
|
data: {
|
||||||
stateReason: SubmissionStateReason.BuildError, stateReasonDetails: data.data.result.resultKindReason }
|
state: SubmissionState.Incorrect,
|
||||||
|
gradedAt: new Date(),
|
||||||
|
stateReason: SubmissionStateReason.BuildError,
|
||||||
|
stateReasonDetails: data.data.result.resultKindReason
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return json({ success: true });
|
return json({ success: true });
|
||||||
|
|
||||||
case 'TimeLimitExceeded':
|
case 'TimeLimitExceeded':
|
||||||
await db.submission.update({
|
await db.submission.update({
|
||||||
where: { id: data.data.submissionId },
|
where: { id: data.data.submissionId },
|
||||||
data: { state: SubmissionState.Incorrect, gradedAt: new Date(), actualOutput: data.data.result.output,
|
data: {
|
||||||
stateReason: SubmissionStateReason.TimeLimitExceeded, stateReasonDetails: data.data.result.resultKindReason }
|
state: SubmissionState.Incorrect,
|
||||||
|
gradedAt: new Date(),
|
||||||
|
actualOutput: data.data.result.output,
|
||||||
|
stateReason: SubmissionStateReason.TimeLimitExceeded,
|
||||||
|
stateReasonDetails: data.data.result.resultKindReason
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return json({ success: true });
|
return json({ success: true });
|
||||||
|
|
||||||
@ -122,7 +147,10 @@ export const POST = (async ({ request }) => {
|
|||||||
// TODO: Raise to admins somehow. For now, just mark stateReason so it *could* be observed
|
// TODO: Raise to admins somehow. For now, just mark stateReason so it *could* be observed
|
||||||
await db.submission.update({
|
await db.submission.update({
|
||||||
where: { id: data.data.submissionId },
|
where: { id: data.data.submissionId },
|
||||||
data: { stateReason: SubmissionStateReason.SandboxError, stateReasonDetails: data.data.result.resultKindReason }
|
data: {
|
||||||
|
stateReason: SubmissionStateReason.SandboxError,
|
||||||
|
stateReasonDetails: data.data.result.resultKindReason
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return json({ success: true });
|
return json({ success: true });
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,11 @@ export const POST = (async ({ params, request }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!activeTeam) {
|
if (!activeTeam) {
|
||||||
throw error(400);
|
error(400);
|
||||||
}
|
}
|
||||||
const data = submitPostData.safeParse(await request.json());
|
const data = submitPostData.safeParse(await request.json());
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
throw error(400);
|
error(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -31,7 +31,7 @@ export const POST = (async ({ params, request }) => {
|
|||||||
return problem.id == data.data.problemId;
|
return problem.id == data.data.problemId;
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
throw error(400);
|
error(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure no submission is currently marked correct
|
// Make sure no submission is currently marked correct
|
||||||
|
@ -14,7 +14,7 @@ const loginPostData = z
|
|||||||
export const POST = (async ({ request }) => {
|
export const POST = (async ({ request }) => {
|
||||||
const data = loginPostData.safeParse(await request.json());
|
const data = loginPostData.safeParse(await request.json());
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
throw error(400);
|
error(400);
|
||||||
}
|
}
|
||||||
const team = await db.team.findUnique({
|
const team = await db.team.findUnique({
|
||||||
where: { name: data.data.teamname },
|
where: { name: data.data.teamname },
|
||||||
|
@ -12,7 +12,7 @@ const logoutPostData = z
|
|||||||
export const POST = (async ({ request }) => {
|
export const POST = (async ({ request }) => {
|
||||||
const data = logoutPostData.safeParse(await request.json());
|
const data = logoutPostData.safeParse(await request.json());
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
throw error(400);
|
error(400);
|
||||||
}
|
}
|
||||||
await db.activeTeam.update({
|
await db.activeTeam.update({
|
||||||
where: { sessionToken: data.data.token },
|
where: { sessionToken: data.data.token },
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import adapter from '@sveltejs/adapter-node';
|
import adapter from '@sveltejs/adapter-node';
|
||||||
import { vitePreprocess } from '@sveltejs/kit/vite';
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
|
Loading…
Reference in New Issue
Block a user