add strike system (#18)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				delpoy / build-and-deploy (push) Successful in 1m25s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	delpoy / build-and-deploy (push) Successful in 1m25s
				
			This commit is contained in:
		| @@ -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 } | ||||
| 	); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user