Started with Mongo

This commit is contained in:
Riccardo
2021-01-02 13:11:59 +01:00
parent 5294122f61
commit 30407cac0a
41 changed files with 33775 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
async function feed(parent, args, context, info) {
console.log(context);
const where = args.filter
? {
OR: [
{ title: { contains: args.filter } },
{ description: { contains: args.filter } }
]
}
: {};
const appointments = await context.mongo.appointment.findMany({
where,
skip: args.skip,
take: args.take,
orderBy: args.orderBy
});
const count = await context.mongo.appointment.count({ where });
return {
id: 'main-feed',
appointments,
count
};
}
module.exports = {
feed
};