keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c42ebf85fe2f418dddd681af45dbc55.
2023-07-23 09:16:12 -05:00

35 lines
689 B
JavaScript

export default {
Query: {
sub: async (parent, { name }, { models, me }) => {
if (me && name === 'jobs') {
models.user.update({
where: {
id: me.id
},
data: {
lastCheckedJobs: new Date()
}
}).catch(console.log)
}
return await models.sub.findUnique({
where: {
name
}
})
},
subLatestPost: async (parent, { name }, { models, me }) => {
const latest = await models.item.findFirst({
where: {
subName: name
},
orderBy: {
createdAt: 'desc'
}
})
return latest?.createdAt
}
}
}