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.
21 lines
439 B
21 lines
439 B
package types
|
|
|
|
import (
|
|
"context"
|
|
"git.aiterp.net/rpdata/api/services"
|
|
|
|
"git.aiterp.net/rpdata/api/models"
|
|
)
|
|
|
|
type tokenResolver struct {
|
|
auth *services.AuthService
|
|
}
|
|
|
|
func (r *tokenResolver) User(ctx context.Context, token *models.Token) (*models.User, error) {
|
|
return r.auth.FindUser(ctx, token.UserID)
|
|
}
|
|
|
|
// TokenResolver is a resolver
|
|
func TokenResolver(s *services.Bundle) *tokenResolver {
|
|
return &tokenResolver{auth: s.Auth}
|
|
}
|