func DeleteQuery(ctx context.Context, db *database.Connection, i DeleteQueryInput) error {
	operation, err := lookupOperation(db, i.OperationSlug)
	if err != nil {
		return backend.WrapError("Unable to delete query", backend.UnauthorizedWriteErr(err))
	}
	if err := policy.Require(middleware.Policy(ctx), policy.CanModifyQueriesOfOperation{OperationID: operation.ID}); err != nil {
		return backend.WrapError("Unwilling to delete query", backend.UnauthorizedWriteErr(err))
	}
	err = db.Delete(sq.Delete("queries").Where(sq.Eq{"id": i.ID, "operation_id": operation.ID}))
	if err != nil {
		return backend.WrapError("Cannot delete query", backend.DatabaseErr(err))
	}
	return nil
}
DeleteQuery removes a saved query for the given operation
package services
import (
	"context"
	"github.com/theparanoids/ashirt-server/backend"
	"github.com/theparanoids/ashirt-server/backend/database"
	"github.com/theparanoids/ashirt-server/backend/policy"
	"github.com/theparanoids/ashirt-server/backend/server/middleware"
	sq "github.com/Masterminds/squirrel"
)
type DeleteQueryInput struct {
	OperationSlug string
	ID            int64
}