feat: model update
This commit is contained in:
		@@ -21,7 +21,14 @@ async def get_all_users_login_and_id(connection: AsyncConnection, page, limit) -
 | 
			
		||||
    first_user = page*limit-(limit)
 | 
			
		||||
 | 
			
		||||
    query = (
 | 
			
		||||
        select(account_table.c.id, account_table.c.login)
 | 
			
		||||
        select(account_table.c.id,
 | 
			
		||||
               account_table.c.name,
 | 
			
		||||
               account_table.c.login,
 | 
			
		||||
               account_table.c.email,
 | 
			
		||||
               account_table.c.bind_tenant_id,
 | 
			
		||||
               account_table.c.role,
 | 
			
		||||
               account_table.c.created_at,
 | 
			
		||||
               account_table.c.status)
 | 
			
		||||
        .order_by(account_table.c.id)
 | 
			
		||||
        .offset(first_user)
 | 
			
		||||
        .limit(limit)
 | 
			
		||||
@@ -36,8 +43,17 @@ async def get_all_users_login_and_id(connection: AsyncConnection, page, limit) -
 | 
			
		||||
    total_count = count_result.scalar()
 | 
			
		||||
    total_pages = math.ceil(total_count / limit)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    print(users_data)
 | 
			
		||||
    validated_users = all_user_adapter.validate_python(
 | 
			
		||||
        [{"id": u.id, "login": u.login} for u in users_data]
 | 
			
		||||
        [{"id": u.id,
 | 
			
		||||
          "name": u.name,
 | 
			
		||||
          "login": u.login,
 | 
			
		||||
          "email": u.email,
 | 
			
		||||
          "bind_tenant_id": u.bind_tenant_id,
 | 
			
		||||
          "role": u.role.name,
 | 
			
		||||
          "created_at": u.created_at,
 | 
			
		||||
          "status": u.status.name} for u in users_data]
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    return AllUserResponse(
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,14 @@ class UserUpdate(BaseModel):
 | 
			
		||||
 | 
			
		||||
class AllUser(BaseModel):
 | 
			
		||||
    id: int
 | 
			
		||||
    name: str
 | 
			
		||||
    login: str
 | 
			
		||||
    email: EmailStr
 | 
			
		||||
    bind_tenant_id: str
 | 
			
		||||
    role: Role
 | 
			
		||||
    created_at: datetime
 | 
			
		||||
    status: Status
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AllUserResponse(BaseModel):
 | 
			
		||||
    users: List[AllUser]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user