package queries

import (
	"context"

	"git.aiterp.net/rpdata/api/graphql/resolver/types"
	"git.aiterp.net/rpdata/api/model/log"
)

// LogArgs is args for log query
type LogArgs struct {
	ID string
}

// Log resolves the log query
func (r *QueryResolver) Log(ctx context.Context, args *LogArgs) (*types.LogResolver, error) {
	log, err := log.FindID(args.ID)
	if err != nil {
		return nil, err
	}

	return &types.LogResolver{L: log}, nil
}