add feedback endpoint (#28) and some other stuff
All checks were successful
delpoy / build-and-deploy (push) Successful in 1m11s

This commit is contained in:
2024-11-29 01:52:19 +01:00
parent dc86dceb2f
commit dc3a404a5b
30 changed files with 599 additions and 104 deletions

View File

@ -0,0 +1,18 @@
import type { PageServerLoad } from './$types';
import { Feedback } from '$lib/server/database';
import { redirect } from '@sveltejs/kit';
import { env } from '$env/dynamic/public';
export const load: PageServerLoad = async ({ params }) => {
const feedback = await Feedback.findOne({
where: { url_hash: params.url_hash }
});
if (!feedback) throw redirect(302, `${env.PUBLIC_BASE_PATH}/`);
return {
draft: feedback.content === null,
event: feedback.event,
anonymous: feedback.user_id === null
};
};