This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
calendar-demo/server/src/resolvers/Query.js
Riccardo 2f119e43bd Changes
2021-08-16 11:06:02 +02:00

31 lines
532 B
JavaScript

async function feed(parent, args, 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
};