feat: complete logins

This commit is contained in:
2025-06-12 15:27:55 +01:00
parent 3bdee89eed
commit 788007c1cc
4 changed files with 24 additions and 3 deletions

22
src/lib/database.d.ts vendored
View File

@@ -140,6 +140,27 @@ export type Database = {
}
Relationships: []
}
users: {
Row: {
created_at: string
id: string
is_admin: boolean
updated_at: string
}
Insert: {
created_at?: string
id: string
is_admin?: boolean
updated_at?: string
}
Update: {
created_at?: string
id?: string
is_admin?: boolean
updated_at?: string
}
Relationships: []
}
}
Views: {
[_ in never]: never
@@ -269,4 +290,3 @@ export const Constants = {
Enums: {},
},
} as const

View File

@@ -23,6 +23,7 @@ export const load: LayoutServerLoad = async ({
}
return {
session,
adminMode,
cookies: cookies.getAll()
};
};

View File

@@ -40,5 +40,5 @@ export const load: LayoutLoad = async ({ data, depends, fetch }) => {
data: { user }
} = await supabase.auth.getUser();
return { session, supabase, user };
return { session, supabase, user, adminMode: data.adminMode };
};

View File

@@ -2,7 +2,7 @@ CREATE TABLE users (
id uuid PRIMARY KEY REFERENCES auth.users ON DELETE CASCADE,
is_admin boolean NOT NULL DEFAULT false,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp with time zone NOT NULL DEFAULT now()
);
CREATE TRIGGER users_handle_updated_at