from sqlalchemy import select
from app.models.customer import Customer
def list_customers(db,business_id,query=None):
    stmt=select(Customer).where(Customer.business_id==business_id)
    if query: stmt=stmt.where(Customer.name.ilike(f"%{query}%"))
    return list(db.scalars(stmt.order_by(Customer.name)))
