|
|
@ -1,26 +0,0 @@ |
|
|
|
package mutations |
|
|
|
|
|
|
|
import ( |
|
|
|
"context" |
|
|
|
|
|
|
|
"git.aiterp.net/rpdata/api/graphql/resolver/types" |
|
|
|
"git.aiterp.net/rpdata/api/internal/session" |
|
|
|
) |
|
|
|
|
|
|
|
// LoginArgs is args for the login mutation
|
|
|
|
type LoginArgs struct { |
|
|
|
Username string |
|
|
|
Password string |
|
|
|
} |
|
|
|
|
|
|
|
// Login resolves the login mutation
|
|
|
|
func (r *MutationResolver) Login(ctx context.Context, args *LoginArgs) (*types.SessionResolver, error) { |
|
|
|
session := session.FromContext(ctx) |
|
|
|
|
|
|
|
err := session.Login(args.Username, args.Password) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
return &types.SessionResolver{S: session}, nil |
|
|
|
} |