Add searching users

This commit is contained in:
2026-02-06 19:05:01 +03:00
parent db43f092fc
commit cb1bf335a6
7 changed files with 237 additions and 194 deletions
+10 -1
View File
@@ -280,4 +280,13 @@ class UserService:
obj_in={"avatar_url": None}
)
log.info("Avatar successfully deleted", extra={"user_id": user.id})
await session.commit()
await session.commit()
@classmethod
async def search_users(cls, username: str, offset: int = 0, limit: int = 30):
async with async_session_maker() as session:
users = await UserDAO.find_all(session, offset, limit, UserModel.username.ilike(f"%{username}%"))
log.debug("Search users")
return users