Add My Bar, Bartender, Recommend features + drink images

- Drink Images: upload/display photos of bottles/cans on drink cards and detail pages
- My Bar: inventory tracker for spirits, liqueurs, mixers, bitters, garnishes, tools
- Bartender: AI-powered cocktail recipe generation, "what can I make" suggestions,
  saved recipes. Cross-references bar inventory for ingredient availability.
- Recommend: AI flavor profile analysis, personalized drink recommendations,
  "find similar" drinks based on highly-rated favorites
- Navigation: desktop sidebar with all 8 routes, mobile bottom nav with
  4 primary items + "More" popup menu
- New Prisma models: BarItem, Recipe, FlavorProfile
- Backup/restore updated to include bar items

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
JP Scott
2026-03-01 18:28:02 -07:00
parent d8f069cce4
commit 2ac2c4b2d4
40 changed files with 3709 additions and 11 deletions

View File

@@ -0,0 +1,72 @@
import { NextResponse } from "next/server"
import { auth } from "@/lib/auth"
import { prisma } from "@/lib/prisma"
import { recipeCreateSchema } from "@/lib/validators"
import type { Prisma } from "@prisma/client"
export async function GET() {
try {
const session = await auth()
if (!session?.user?.id) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
const recipes = await prisma.recipe.findMany({
where: { userId: session.user.id },
orderBy: { createdAt: "desc" },
include: {
sourceDrink: {
select: { name: true, type: true },
},
},
})
return NextResponse.json({ recipes })
} catch (error) {
console.error("GET /api/recipes error:", error)
return NextResponse.json(
{ error: "Internal server error" },
{ status: 500 }
)
}
}
export async function POST(request: Request) {
try {
const session = await auth()
if (!session?.user?.id) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
const body = await request.json()
const parsed = recipeCreateSchema.safeParse(body)
if (!parsed.success) {
return NextResponse.json(
{ error: "Validation failed", issues: parsed.error.issues },
{ status: 400 }
)
}
const recipe = await prisma.recipe.create({
data: {
userId: session.user.id,
title: parsed.data.title,
ingredients: parsed.data.ingredients as unknown as Prisma.InputJsonValue,
steps: parsed.data.steps as unknown as Prisma.InputJsonValue,
garnish: parsed.data.garnish || null,
glassware: parsed.data.glassware || null,
sourceDrinkId: parsed.data.sourceDrinkId || null,
notes: parsed.data.notes || null,
},
})
return NextResponse.json(recipe, { status: 201 })
} catch (error) {
console.error("POST /api/recipes error:", error)
return NextResponse.json(
{ error: "Internal server error" },
{ status: 500 }
)
}
}