wasp/examples/thoughts/ext/queries.js

16 lines
381 B
JavaScript
Raw Normal View History

export const getThoughts = async (args, context) => {
return context.entities.Thought.findMany({
orderBy: [{ createdAt: 'desc' }],
include: { tags: true },
where: {
tags: { some: { name: args.tagName || undefined } }
}
})
}
export const getTags = async (args, context) => {
return context.entities.Tag.findMany({
orderBy: [{ name: 'asc' }],
})
}