[preset] GO
This commit is contained in:
parent
9a84abc0ad
commit
3fd0a76975
1 changed files with 2 additions and 4 deletions
|
@ -87,12 +87,10 @@ class Preset(Base, CommonMixin):
|
||||||
limit: int,
|
limit: int,
|
||||||
q: Optional[str] = None,
|
q: Optional[str] = None,
|
||||||
) -> AsyncIterator["Preset"]:
|
) -> AsyncIterator["Preset"]:
|
||||||
query = select(cls)
|
query = select(cls).filter(cls.user_id == user_id)
|
||||||
|
|
||||||
if q:
|
if q:
|
||||||
query = query.filter(cls.user_id == user_id).filter(
|
query = query.filter(cls.name.ilike(f"%{q.lower()}%"))
|
||||||
cls.name.ilike(f"%{q.lower()}%")
|
|
||||||
)
|
|
||||||
|
|
||||||
query = query.offset(offset).limit(limit)
|
query = query.offset(offset).limit(limit)
|
||||||
stream = await session.stream_scalars(query.order_by(cls.id))
|
stream = await session.stream_scalars(query.order_by(cls.id))
|
||||||
|
|
Loading…
Reference in a new issue