12 lines
368 B
TypeScript
12 lines
368 B
TypeScript
import DBResource from '../../types/DBResource';
|
|
import { Resources } from '../db/mongodb';
|
|
|
|
export const getAllResources = async () => {
|
|
return (await Resources()).find({}).toArray() as unknown as Array<DBResource>;
|
|
}
|
|
|
|
export const getResourceById = async (id: string) => {
|
|
return (await Resources()).findOne({
|
|
id
|
|
}) as unknown as DBResource;
|
|
} |