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:
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user