add strike system (#18)
All checks were successful
delpoy / build-and-deploy (push) Successful in 1m25s

This commit is contained in:
2023-12-10 19:18:33 +01:00
parent 7599f233a8
commit 58bc475aec
6 changed files with 143 additions and 13 deletions

View File

@ -1,5 +1,5 @@
import type { RequestHandler } from '@sveltejs/kit';
import { User } from '$lib/server/database';
import { Strike, User } from '$lib/server/database';
import { env } from '$env/dynamic/private';
export const GET = (async ({ url }) => {
@ -12,12 +12,15 @@ export const GET = (async ({ url }) => {
const user = await User.findOne({ where: { uuid: uuid } });
if (user == null) return new Response(null, { status: 400 });
const strike = await Strike.findOne({ where: { user_id: user.id } });
return new Response(
JSON.stringify({
uuid: user.uuid,
username: user.username,
firstname: user.firstname,
lastname: user.lastname
lastname: user.lastname,
ban_until: strike ? strike.ban_until.getTime() / 1000 : null
}),
{ status: 200 }
);