from time import time

from fastapi import APIRouter

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

router = APIRouter()


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

    schemes = await mongo.pay_rate_schemes_collection.find(
        {}, {"_id": False}
    ).sort("id", mongo.asc).to_list()

    return response({
        "payrollSchemas": schemes
    }, start_time=start_time)