Build user pages

This commit is contained in:
NeilClack
2026-02-25 13:19:26 -06:00
parent 12190d01dc
commit cc51f40591
53 changed files with 5204 additions and 4817 deletions
-15
View File
@@ -1,15 +0,0 @@
import { error } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { prisma } from '$lib/db';
export const GET: RequestHandler = async () => {
const affirmations = await prisma.affirmation.findMany();
if (!affirmations) {
throw error(500, 'unable to fetch affirmations');
}
return new Response(
JSON.stringify({
affirmations
})
);
};
@@ -0,0 +1,30 @@
import { error } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { prisma } from '$lib/db';
export const GET: RequestHandler = async ({ url }) => {
const key = url.searchParams.get('key') ?? '';
const email = url.searchParams.get('email') ?? '';
if (key === '' || email === '') {
const proclamations = await prisma.proclamation.findMany();
if (!proclamations) {
throw error(500, 'unable to fetch proclamations');
}
return new Response(
JSON.stringify({
proclamations
})
);
}
// Check that the key exists
// Check that the email exists
// Check that the email belongs to a user
// Check that the key belongs to the user
// Write a helper function for this
// Return all proclamations attached to the user
return new Response(JSON.stringify({ error: 'not implemented' }), { status: 501 });
};