fix performance of sub nested resolvers

This commit is contained in:
keyan 2024-06-03 16:50:38 -05:00
parent 7b667821d2
commit c90eb055c7
1 changed files with 9 additions and 2 deletions

View File

@ -382,7 +382,10 @@ export default {
return await models.user.findUnique({ where: { id: sub.userId } })
},
meMuteSub: async (sub, args, { models }) => {
return sub.meMuteSub || sub.MuteSub?.length > 0
if (sub.meMuteSub !== undefined) {
return sub.meMuteSub
}
return sub.MuteSub?.length > 0
},
nposts: async (sub, { when, from, to }, { models }) => {
if (typeof sub.nposts !== 'undefined') {
@ -395,7 +398,11 @@ export default {
}
},
meSubscription: async (sub, args, { me, models }) => {
return sub.meSubscription || sub.SubSubscription?.length > 0
if (sub.meSubscription !== undefined) {
return sub.meSubscription
}
return sub.SubSubscription?.length > 0
},
createdAt: sub => sub.createdAt || sub.created_at
}