fix performance of sub nested resolvers
This commit is contained in:
parent
7b667821d2
commit
c90eb055c7
@ -382,7 +382,10 @@ export default {
|
|||||||
return await models.user.findUnique({ where: { id: sub.userId } })
|
return await models.user.findUnique({ where: { id: sub.userId } })
|
||||||
},
|
},
|
||||||
meMuteSub: async (sub, args, { models }) => {
|
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 }) => {
|
nposts: async (sub, { when, from, to }, { models }) => {
|
||||||
if (typeof sub.nposts !== 'undefined') {
|
if (typeof sub.nposts !== 'undefined') {
|
||||||
@ -395,7 +398,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
meSubscription: async (sub, args, { me, models }) => {
|
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
|
createdAt: sub => sub.createdAt || sub.created_at
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user