Изменил выдачу юзеров
This commit is contained in:
parent
18594ef347
commit
77d1fd9668
1 changed files with 9 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
from sqlalchemy import update, select, insert, and_, func, text
|
||||
|
||||
from app.dao.base import BaseDAO
|
||||
from app.database import async_session_maker, engine
|
||||
from app.database import async_session_maker, engine # noqa
|
||||
from app.users.chat.models import UsersXChats, Chats
|
||||
from app.users.models import Users, UsersVerificationCodes
|
||||
|
||||
|
@ -9,6 +9,14 @@ from app.users.models import Users, UsersVerificationCodes
|
|||
class UserDAO(BaseDAO):
|
||||
model = Users
|
||||
|
||||
@staticmethod
|
||||
async def find_all(**filter_by):
|
||||
async with async_session_maker() as session:
|
||||
query = select(Users.__table__.columns).filter_by(**filter_by).where(Users.role != 100)
|
||||
result = await session.execute(query)
|
||||
return result.mappings().all()
|
||||
|
||||
|
||||
@staticmethod
|
||||
async def change_data(user_id: int, **data_to_change):
|
||||
query = update(Users).where(Users.id == user_id).values(**data_to_change)
|
||||
|
|
Loading…
Add table
Reference in a new issue