feat(navigation): add prominent validation quickstart action
This commit is contained in:
parent
0bbcaba211
commit
9c6b184e39
28614 changed files with 4356173 additions and 23 deletions
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy import or_, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models.customer import Customer
|
||||
|
|
@ -23,7 +23,22 @@ class UserRepository(Repository[User]):
|
|||
|
||||
class CustomerRepository(Repository[Customer]):
|
||||
model = Customer
|
||||
search_columns = ("name", "city", "email", "phone")
|
||||
|
||||
def _search_statement(self, search: str | None = None):
|
||||
statement = select(Customer)
|
||||
if search:
|
||||
term = f"%{search.strip()}%"
|
||||
statement = statement.where(
|
||||
or_(
|
||||
Customer.name.ilike(term),
|
||||
Customer.city.ilike(term),
|
||||
Customer.postal_code.ilike(term),
|
||||
Customer.email.ilike(term),
|
||||
Customer.phone.ilike(term),
|
||||
Customer.contacts.any(Contact.full_name.ilike(term)),
|
||||
)
|
||||
)
|
||||
return statement
|
||||
|
||||
|
||||
class LocationRepository(Repository[Location]):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue