feat: add organization context model

Introduce organizations as the top-level workspace model with address and bank-detail fields.

Store the active organization on Better Auth sessions and load organization context for dashboard routes.

Add the migration that creates organizations and backfills existing records to the default organization.
This commit is contained in:
kdaniel2410 committed 2026-06-06 14:14:00 +01:00
1 parent bf5a1ad5b5
commit b5ba84b19f
10 files changed
+1872 -2

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import { redirect } from '@sveltejs/kit';
import { loadOrganizationContext } from '$lib/server/organizations';
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = async ({ locals }) => {
if (!locals.user) {
redirect(303, '/login');
}
return loadOrganizationContext(locals);
};