Prettier format pending files
This commit is contained in:
parent
cf3f00fb62
commit
49cfc10890
1 changed files with 13 additions and 7 deletions
|
|
@ -856,10 +856,13 @@ export const aethexRoleService = {
|
||||||
// Ensure roles exist and fetch their ids
|
// Ensure roles exist and fetch their ids
|
||||||
const wanted = Array.from(new Set(roles.map((r) => r.toLowerCase())));
|
const wanted = Array.from(new Set(roles.map((r) => r.toLowerCase())));
|
||||||
// Insert missing roles
|
// Insert missing roles
|
||||||
await supabase.from("roles").upsert(
|
await supabase
|
||||||
wanted.map((name) => ({ name } as any)) as any,
|
.from("roles")
|
||||||
{ onConflict: "name" } as any,
|
.upsert(
|
||||||
).catch(() => undefined);
|
wanted.map((name) => ({ name }) as any) as any,
|
||||||
|
{ onConflict: "name" } as any,
|
||||||
|
)
|
||||||
|
.catch(() => undefined);
|
||||||
// Fetch role ids
|
// Fetch role ids
|
||||||
const { data: roleRows } = await supabase
|
const { data: roleRows } = await supabase
|
||||||
.from("roles")
|
.from("roles")
|
||||||
|
|
@ -870,9 +873,12 @@ export const aethexRoleService = {
|
||||||
role_id: r.id,
|
role_id: r.id,
|
||||||
}));
|
}));
|
||||||
if (idRows.length) {
|
if (idRows.length) {
|
||||||
await supabase.from("user_roles").upsert(idRows as any, {
|
await supabase.from("user_roles").upsert(
|
||||||
onConflict: "user_id,role_id" as any,
|
idRows as any,
|
||||||
} as any);
|
{
|
||||||
|
onConflict: "user_id,role_id" as any,
|
||||||
|
} as any,
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue