Improve MineGeo exploration and mapping features

This commit is contained in:
2026-10-05 13:41:36 +05:00
parent aec0641f87
commit c5368fa8cc
69 changed files with 3581 additions and 333 deletions

27
lib/profile.ts Normal file
View File

@@ -0,0 +1,27 @@
import "server-only";
import type { User } from "@supabase/supabase-js";
import { admin, required } from "./supabase";
import { displayNameSchema } from "@/shared/account";
export async function accountProfile(account: User) {
const name = displayNameSchema.safeParse(account.user_metadata?.display_name);
required(
await admin()
.from("profiles")
.upsert(
{
id: account.id,
display_name: name.success ? name.data : "Explorer",
},
{ onConflict: "id", ignoreDuplicates: true },
)
.select("id"),
);
return required(
await admin()
.from("profiles")
.select("id,display_name,role")
.eq("id", account.id)
.single(),
);
}