Skip to content

Commit

Permalink
use selected fields from context for ToOneDeferreds
Browse files Browse the repository at this point in the history
  • Loading branch information
do4gr committed Feb 2, 2019
1 parent 831ff02 commit 0d56602
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ object DeferredTypes {

case class ToOneDeferred(
model: Model,
where: NodeSelector
where: NodeSelector,
selectedFields: SelectedFields
) extends Deferred[OneDeferredResultType]

case class CountManyModelDeferred(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ class ToOneDeferredResolver(resolver: DataResolver) {
def resolve(
deferred: OrderedDeferred[ToOneDeferred]
)(implicit ec: ExecutionContext): OrderedDeferredFutureResult[OneDeferredResultType] = {
val model = deferred.deferred.model
val where = deferred.deferred.where
val futureResolverResults = resolver.getNodeByWhere(where, SelectedFields.all(model))
val futureResolverResults = resolver.getNodeByWhere(where, deferred.deferred.selectedFields)

OrderedDeferredFutureResult(futureResolverResults, deferred.order)

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class ObjectTypeBuilder(
f.relationIsInlinedInParent match {
case true =>
item.data.map.get(f.name) match {
case Some(id: IdGCValue) => ToOneDeferred(f.relatedModel_!, NodeSelector.forId(f.relatedModel_!, id))
case Some(id: IdGCValue) => ToOneDeferred(f.relatedModel_!, NodeSelector.forId(f.relatedModel_!, id), ctx.getSelectedFields(f.relatedModel_!))
case _ => None
}

Expand Down

0 comments on commit 0d56602

Please sign in to comment.