mirror of https://git.sr.ht/~sircmpwn/man.sr.ht
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package graph
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.sr.ht/~sircmpwn/core-go/auth"
|
|
"git.sr.ht/~sircmpwn/man.sr.ht/api/account"
|
|
"git.sr.ht/~sircmpwn/man.sr.ht/api/graph/api"
|
|
"git.sr.ht/~sircmpwn/man.sr.ht/api/graph/model"
|
|
)
|
|
|
|
// DeleteUser is the resolver for the deleteUser field.
|
|
func (r *mutationResolver) DeleteUser(ctx context.Context) (int, error) {
|
|
user := auth.ForContext(ctx)
|
|
account.Delete(ctx, user.UserID, user.Username)
|
|
return user.UserID, nil
|
|
}
|
|
|
|
// Version is the resolver for the version field.
|
|
func (r *queryResolver) Version(ctx context.Context) (*model.Version, error) {
|
|
return &model.Version{
|
|
Major: 0,
|
|
Minor: 0,
|
|
Patch: 0,
|
|
DeprecationDate: nil,
|
|
}, nil
|
|
}
|
|
|
|
// Mutation returns api.MutationResolver implementation.
|
|
func (r *Resolver) Mutation() api.MutationResolver { return &mutationResolver{r} }
|
|
|
|
// Query returns api.QueryResolver implementation.
|
|
func (r *Resolver) Query() api.QueryResolver { return &queryResolver{r} }
|
|
|
|
type mutationResolver struct{ *Resolver }
|
|
type queryResolver struct{ *Resolver }
|