feat: logins and toggleable admin mode #45
22
src/lib/database.d.ts
vendored
22
src/lib/database.d.ts
vendored
@@ -140,6 +140,27 @@ export type Database = {
|
|||||||
}
|
}
|
||||||
Relationships: []
|
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: {
|
Views: {
|
||||||
[_ in never]: never
|
[_ in never]: never
|
||||||
@@ -269,4 +290,3 @@ export const Constants = {
|
|||||||
Enums: {},
|
Enums: {},
|
||||||
},
|
},
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export const load: LayoutServerLoad = async ({
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
session,
|
session,
|
||||||
|
adminMode,
|
||||||
cookies: cookies.getAll()
|
cookies: cookies.getAll()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,5 +40,5 @@ export const load: LayoutLoad = async ({ data, depends, fetch }) => {
|
|||||||
data: { user }
|
data: { user }
|
||||||
} = await supabase.auth.getUser();
|
} = await supabase.auth.getUser();
|
||||||
|
|
||||||
return { session, supabase, user };
|
return { session, supabase, user, adminMode: data.adminMode };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ CREATE TABLE users (
|
|||||||
id uuid PRIMARY KEY REFERENCES auth.users ON DELETE CASCADE,
|
id uuid PRIMARY KEY REFERENCES auth.users ON DELETE CASCADE,
|
||||||
is_admin boolean NOT NULL DEFAULT false,
|
is_admin boolean NOT NULL DEFAULT false,
|
||||||
created_at timestamp with time zone NOT NULL DEFAULT now(),
|
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
|
CREATE TRIGGER users_handle_updated_at
|
||||||
|
|||||||
Reference in New Issue
Block a user