Browse Source

graph2: Changed Comment character resolver to use loader.

module-madness-pointers
Gisle Aune 6 years ago
parent
commit
f9b6af58c9
  1. 11
      graph2/types/comment.go

11
graph2/types/comment.go

@ -2,9 +2,9 @@ package types
import (
"context"
"errors"
"git.aiterp.net/rpdata/api/models/characters"
"git.aiterp.net/rpdata/api/internal/loader"
"git.aiterp.net/rpdata/api/models"
)
@ -15,7 +15,12 @@ func (r *commentResolver) Character(ctx context.Context, obj *models.Comment) (*
return nil, nil
}
character, err := characters.FindID(obj.CharacterID)
loader := loader.FromContext(ctx)
if loader == nil {
return nil, errors.New("no loader")
}
character, err := loader.Character("id", obj.CharacterID)
if err != nil {
return nil, err
}

Loading…
Cancel
Save