work
Some checks failed
Build and Push Container Image / build-and-push (push) Failing after 3m49s

This commit is contained in:
2026-05-19 12:00:00 +02:00
parent 6bd3b76782
commit 8e02f673ca
33 changed files with 2992 additions and 12 deletions

View File

@@ -0,0 +1,39 @@
import { redirect } from '@sveltejs/kit';
import type { Actions, PageServerLoad } from './$types';
import { db } from '$lib/server/db';
import { project } from '$lib/server/db/schema';
import { desc, eq } from 'drizzle-orm';
import { publish } from '$lib/server/events';
export const load: PageServerLoad = async (event) => {
if (!event.locals.user) throw redirect(302, '/auth/login');
const projects = await db
.select()
.from(project)
.where(eq(project.ownerId, event.locals.user.id))
.orderBy(desc(project.updatedAt));
return { projects };
};
export const actions: Actions = {
create: async (event) => {
if (!event.locals.user) throw redirect(302, '/auth/login');
const formData = await event.request.formData();
const name = formData.get('name')?.toString().trim() ?? '';
const description = formData.get('description')?.toString().trim() ?? '';
if (!name) return { error: 'Project name is required' };
await db.insert(project).values({
ownerId: event.locals.user.id,
name,
description
});
publish('project-created');
throw redirect(303, '/projects');
}
};