GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
500 B

  1. package types
  2. import (
  3. "context"
  4. "git.aiterp.net/rpdata/api/models/characters"
  5. "git.aiterp.net/rpdata/api/models"
  6. )
  7. type commentResolver struct{}
  8. func (r *commentResolver) Character(ctx context.Context, obj *models.Comment) (*models.Character, error) {
  9. if obj.CharacterID == "" {
  10. return nil, nil
  11. }
  12. character, err := characters.FindID(obj.CharacterID)
  13. if err != nil {
  14. return nil, err
  15. }
  16. return &character, nil
  17. }
  18. // CommentResolver is a resolver
  19. var CommentResolver commentResolver