from time import time

from fastapi import APIRouter

from app import mongo
from app.utils.response_util import response

router = APIRouter()


@router.get("/get-all", tags=[""])
async def get_all():
    start_time = time()

    roles = await mongo.roles_collection.find({}, {
        "_id": False
    }).sort("id", mongo.desc).to_list()

    return response({
        "roles": roles
    }, start_time=start_time)
