Пример #1
0
    async def read_user(cls, user_id: int):

        _, instance = await ResourceOp(User, user_id).instance(is_delete=False)

        user = User.to_dict(instance)
        user['is_admin_user'] = await instance.is_admin_user
        return user
Пример #2
0
    async def response_users(cls, users):
        """merge response users"""

        _users = list()
        for user in users:
            _user = User.to_dict(user,
                                 selects=('id', 'cellphone', 'name',
                                          'is_delete'))
            _user['is_admin_user'] = await user.is_admin_user
            _users.append(_user)
        return _users