from app.dto import UserDTO
from app.models import User


def users_serialize(users: list) -> list[UserDTO]:
    serialized_users: list = []
    for user in users:
        serialized_users.append({
            "uid": str(user["_id"]),
            "username": user["username"]
        })
    return serialized_users

def user_serialize(user) -> User:
    return User(
        _id=str(user['_id']),
        username=user['username'],
        password=user['password'],
        is_admin=user['is_admin']
    )