Skip to content

Commit 765a789

Browse files
committed
review comments
1 parent 29a7ffe commit 765a789

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

internal/api/policy_collection_mapping.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,21 @@ type policyCollectionMappingAPI struct {
5454
// Read returns data for a policy collection mapping.
5555
func (a policyCollectionMappingAPI) Read(ctx context.Context, collectionUUID string, policyUUID string) (*PolicyCollectionMapping, error) {
5656
cursor := ""
57+
var query struct {
58+
PolicyCollection struct {
59+
PolicyMappings struct {
60+
Edges []struct {
61+
Node PolicyCollectionMapping
62+
}
63+
PageInfo struct {
64+
HasNextPage bool
65+
EndCursor string
66+
}
67+
Problems []Problem
68+
} `graphql:"policyMappings(first: 100, after: $cursor)"`
69+
} `graphql:"policyCollection(uuid: $uuid)"`
70+
}
5771
for {
58-
var query struct {
59-
PolicyCollection struct {
60-
PolicyMappings struct {
61-
Edges []struct {
62-
Node PolicyCollectionMapping
63-
}
64-
PageInfo struct {
65-
HasNextPage bool
66-
EndCursor string
67-
}
68-
Problems []Problem
69-
} `graphql:"policyMappings(first: 100, after: $cursor)"`
70-
} `graphql:"policyCollection(uuid: $uuid)"`
71-
}
72-
7372
variables := map[string]any{
7473
"uuid": graphql.String(collectionUUID),
7574
"cursor": graphql.String(cursor),

internal/api/repository.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,22 @@ func (a repositoryAPI) Read(ctx context.Context, uuid string) (*Repository, erro
123123

124124
func (a repositoryAPI) FindByURL(ctx context.Context, url string) (string, error) {
125125
cursor := ""
126-
for {
127-
var q struct {
128-
Conn struct {
129-
Edges []struct {
130-
Node struct {
131-
URL string
132-
UUID string
133-
}
134-
}
135-
PageInfo struct {
136-
HasNextPage bool
137-
EndCursor string
126+
var q struct {
127+
Conn struct {
128+
Edges []struct {
129+
Node struct {
130+
URL string
131+
UUID string
138132
}
139-
Problems []Problem
140-
} `graphql:"repositoryConfigs(first: 100, after: $cursor)"`
141-
}
133+
}
134+
PageInfo struct {
135+
HasNextPage bool
136+
EndCursor string
137+
}
138+
Problems []Problem
139+
} `graphql:"repositoryConfigs(first: 100, after: $cursor)"`
140+
}
141+
for {
142142
variables := map[string]any{"cursor": graphql.String(cursor)}
143143
if err := a.c.Query(ctx, &q, variables); err != nil {
144144
return "", NewAPIError(err)

0 commit comments

Comments
 (0)