from app.aws_services import AWSService
from models.user_model import get_all_users, update_user_face_id

def index_all_users():
    aws_service = AWSService()
    users = get_all_users()

    for user in users:
        if user.get("face_id"):
            continue

        face_id = aws_service.index_user_face(
            user["s3_image_key"],
            str(user["id"]),
        )

        if face_id:
            update_user_face_id(user["id"], face_id)
            print(f"Indexed: {user['email']}")

if __name__ == "__main__":
    index_all_users()
