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.
23 lines
588 B
23 lines
588 B
package queries
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"git.aiterp.net/rpdata/api/models"
|
|
"git.aiterp.net/rpdata/api/models/characters"
|
|
)
|
|
|
|
func (r *resolver) Character(ctx context.Context, id *string, nick *string) (models.Character, error) {
|
|
if id != nil {
|
|
return characters.FindID(*id)
|
|
} else if nick != nil {
|
|
return characters.FindNick(*nick)
|
|
} else {
|
|
return models.Character{}, errors.New("You must specify either an ID or a nick")
|
|
}
|
|
}
|
|
|
|
func (r *resolver) Characters(ctx context.Context, filter *characters.Filter) ([]models.Character, error) {
|
|
return characters.List(filter)
|
|
}
|