feat(themes): add Amber Artisan 2-column bento gourmet dark theme
This commit is contained in:
@@ -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" },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user