fix: insert other chart profiles directly (#15)

This commit is contained in:
732642856
2026-07-20 17:45:31 +08:00
committed by GitHub
parent cdfd389662
commit b3bca954da
4 changed files with 17 additions and 12 deletions
+1 -8
View File
@@ -70,16 +70,9 @@ export async function POST(request: Request) {
.single();
({ data, error } = await query);
} else {
const record = {
...(body.id ? { id: body.id } : {}),
user_id: user.id,
role,
profile: body.profile,
updated_at: updatedAt,
};
({ data, error } = await supabase
.from("chart_profiles")
.upsert(record, { onConflict: "id" })
.insert({ user_id: user.id, role, profile: body.profile, updated_at: updatedAt })
.select("id, role, profile, updated_at")
.single());
}