Field Resolver Not Excluding Relations #112
-
OS: Mac OS (Catalina) Hi there, I have the following Field Resolver for a relation on an output type: @FieldResolver((_type) => [Position], { nullable: true, description: undefined })
async Positions(@Root() portfolio: PortfolioOutput, @Args() args: PortfolioPositionsArgs, @Ctx() ctx: Context): Promise<Position[] | null> {
return ctx.prisma.portfolio
.findOne({
where: {
id: portfolio.id
}
})
.Positions({
include: {
Transactions: {
where: {
action: "Buy"
}
}
}
});
} When I execute my query I'd have expected to have all Transactions that don't have an action of "Buy" to be removed but that isn't the case (see screenshot). Am I missing something? Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can't filter
You can only filter |
Beta Was this translation helpful? Give feedback.
You can't filter
Position.Transactions
onPortfolio.Positions
level.Position.Transactions
is a separate field resolver that doesn't use the data returned from the other resolver, just thePosition.id
primary key.You can only filter
Position
that doesn't have any or all "Buy" Transactions.