import DBBuilding from '../../types/db/DBBuilding';
import { Buildings } from '../db/mongodb';

export const getAllBuildings = async () => {
    return (await Buildings()).find({}).toArray() as unknown as Array<DBBuilding>;   
}

export const getBuildingById = async (id: string) => {
    return (await Buildings()).findOne({
        id
    }) as unknown as DBBuilding;
}

export const getBuildingsByCategory = async (category: string) => {
    return (await Buildings()).find({
        category
    }).toArray() as unknown as Array<DBBuilding>;
}