feat: Add Findagram and FindADispo consumer frontends
- Add findagram.co React frontend with product search, brands, categories - Add findadispo.com React frontend with dispensary locator - Wire findagram to backend /api/az/* endpoints - Update category/brand links to route to /products with filters - Add k8s manifests for both frontends - Add multi-domain user support migrations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
32
findagram/backend/app/routes/brands.py
Normal file
32
findagram/backend/app/routes/brands.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy import select
|
||||
from typing import List
|
||||
|
||||
from app.database import get_db
|
||||
from app.models.product import Brand
|
||||
from app.schemas.product import BrandResponse
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("", response_model=List[BrandResponse])
|
||||
async def get_brands(db: AsyncSession = Depends(get_db)):
|
||||
result = await db.execute(
|
||||
select(Brand).order_by(Brand.name.asc())
|
||||
)
|
||||
brands = result.scalars().all()
|
||||
return [BrandResponse.model_validate(b) for b in brands]
|
||||
|
||||
|
||||
@router.get("/{slug}", response_model=BrandResponse)
|
||||
async def get_brand(slug: str, db: AsyncSession = Depends(get_db)):
|
||||
result = await db.execute(
|
||||
select(Brand).where(Brand.slug == slug)
|
||||
)
|
||||
brand = result.scalar_one_or_none()
|
||||
|
||||
if not brand:
|
||||
raise HTTPException(status_code=404, detail="Brand not found")
|
||||
|
||||
return BrandResponse.model_validate(brand)
|
||||
Reference in New Issue
Block a user