Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
6297c81d22
commit
94a71b580c
@@ -66,6 +66,7 @@ interface UserRow {
|
||||
email: string;
|
||||
full_name: string;
|
||||
created_at: string;
|
||||
hourly_rate: number | null;
|
||||
role: AppRole | null;
|
||||
}
|
||||
|
||||
@@ -84,16 +85,17 @@ function UsersPage() {
|
||||
const load = async () => {
|
||||
setLoading(true);
|
||||
const [{ data: profiles }, { data: rolesData }] = await Promise.all([
|
||||
supabase.from("profiles").select("id, email, full_name, created_at"),
|
||||
supabase.from("profiles").select("id, email, full_name, created_at, hourly_rate"),
|
||||
supabase.from("user_roles").select("user_id, role"),
|
||||
]);
|
||||
const roleMap = new Map<string, AppRole>();
|
||||
(rolesData ?? []).forEach((r) => roleMap.set(r.user_id, r.role as AppRole));
|
||||
const rows: UserRow[] = (profiles ?? []).map((p) => ({
|
||||
const rows: UserRow[] = (profiles ?? []).map((p: any) => ({
|
||||
id: p.id,
|
||||
email: p.email,
|
||||
full_name: p.full_name,
|
||||
created_at: p.created_at,
|
||||
hourly_rate: p.hourly_rate,
|
||||
role: roleMap.get(p.id) ?? null,
|
||||
}));
|
||||
rows.sort((a, b) => a.email.localeCompare(b.email));
|
||||
|
||||
Reference in New Issue
Block a user