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
27 lines
500 B
package types
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.aiterp.net/rpdata/api/models/characters"
|
|
|
|
"git.aiterp.net/rpdata/api/models"
|
|
)
|
|
|
|
type commentResolver struct{}
|
|
|
|
func (r *commentResolver) Character(ctx context.Context, obj *models.Comment) (*models.Character, error) {
|
|
if obj.CharacterID == "" {
|
|
return nil, nil
|
|
}
|
|
|
|
character, err := characters.FindID(obj.CharacterID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &character, nil
|
|
}
|
|
|
|
// CommentResolver is a resolver
|
|
var CommentResolver commentResolver
|