13 lines
374 B
TypeScript
13 lines
374 B
TypeScript
import { ObjectId } from "mongodb";
|
|
import { Sectors } from "./mongodb";
|
|
import DBSector from "../../types/db/DBSector";
|
|
|
|
export const getAllSectors = async () => {
|
|
return await (await Sectors()).find({}).toArray() as DBSector[];
|
|
}
|
|
|
|
export const getSectorById = async (id: ObjectId) => {
|
|
return await (await Sectors()).findOne({
|
|
_id: id
|
|
}) as DBSector;
|
|
} |