~emersion/hut-dev

Thorben Günther: 1
 export/todo: Fix query

 3 files changed, 23 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/hut-dev/patches/43612/mbox | git am -3
Learn more about email & git

[PATCH] export/todo: Fix query Export this patch

The "export" field was missing.
---
 export/todo.go                   |  2 +-
 srht/todosrht/gql.go             | 10 ++++++++++
 srht/todosrht/operations.graphql | 12 ++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/export/todo.go b/export/todo.go
index 285dc2e..65aa232 100644
--- a/export/todo.go
+++ b/export/todo.go
@@ -36,7 +36,7 @@ func (ex *TodoExporter) Export(ctx context.Context, dir string) error {
	var ret error

	for {
		trackers, err := todosrht.Trackers(ex.client, ctx, cursor)
		trackers, err := todosrht.ExportTrackers(ex.client, ctx, cursor)
		if err != nil {
			return err
		}
diff --git a/srht/todosrht/gql.go b/srht/todosrht/gql.go
index fb77e7f..ac6b2aa 100644
--- a/srht/todosrht/gql.go
+++ b/srht/todosrht/gql.go
@@ -937,6 +937,16 @@ func TrackersByUser(client *gqlclient.Client, ctx context.Context, username stri
	return respData.User, err
}

func ExportTrackers(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (trackers *TrackerCursor, err error) {
	op := gqlclient.NewOperation("query exportTrackers ($cursor: Cursor) {\n\ttrackers(cursor: $cursor) {\n\t\tresults {\n\t\t\tname\n\t\t\tdescription\n\t\t\tvisibility\n\t\t\texport\n\t\t}\n\t\tcursor\n\t}\n}\n")
	op.Var("cursor", cursor)
	var respData struct {
		Trackers *TrackerCursor
	}
	err = client.Execute(ctx, op, &respData)
	return respData.Trackers, err
}

func TrackerIDByName(client *gqlclient.Client, ctx context.Context, name string) (me *User, err error) {
	op := gqlclient.NewOperation("query trackerIDByName ($name: String!) {\n\tme {\n\t\ttracker(name: $name) {\n\t\t\tid\n\t\t}\n\t}\n}\n")
	op.Var("name", name)
diff --git a/srht/todosrht/operations.graphql b/srht/todosrht/operations.graphql
index 949c941..a9d0c2f 100644
--- a/srht/todosrht/operations.graphql
+++ b/srht/todosrht/operations.graphql
@@ -21,6 +21,18 @@ fragment trackers on TrackerCursor {
    cursor
}

query exportTrackers($cursor: Cursor) {
    trackers(cursor: $cursor) {
        results {
            name
            description
            visibility
            export
        }
        cursor
    }
}

query trackerIDByName($name: String!) {
    me {
        tracker(name: $name) {

base-commit: 2f032058a31bd2d519f32a461b5422d6ae759803
--
2.41.0
Pushed, thanks for the fix!