feat(themes): add Amber Artisan 2-column bento gourmet dark theme

This commit is contained in:
AyrisAI
2026-08-20 02:56:38 +03:00
parent da3d4d291b
commit 89c2f62995
5 changed files with 173 additions and 63 deletions
+18 -7
View File
@@ -155,20 +155,31 @@ export const restaurantsRoutes: FastifyPluginAsync = async (app) => {
return reply.code(400).send({ message: "themeKey is required" });
}
const { data: themeData } = await supabase
.from("themes")
.select("id")
.eq("key", themeKey)
.maybeSingle();
let themeId = themeData?.id;
if (!themeId) {
const { data: newTheme } = await supabase
.from("themes")
.insert({
key: themeKey,
name: themeKey === "artisan" ? "Amber Artisan" : themeKey,
config: { primaryColor: "#E5A855", background: "#121316", productLayout: "card", categoryLayout: "tabs" },
})
.select("id")
.maybeSingle();
if (!themeData) {
if (newTheme?.id) {
themeId = newTheme.id;
}
}
if (!themeId) {
return reply.code(404).send({ message: "Theme not found" });
}
const { error } = await supabase.from("restaurant_themes").upsert(
{
restaurant_id: id,
theme_id: themeData.id,
theme_id: themeId,
},
{ onConflict: "restaurant_id" },
);