aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql
diff options
context:
space:
mode:
Diffstat (limited to 'api/graphql')
-rw-r--r--api/graphql/graphql_test.go5
-rw-r--r--api/graphql/models/lazy_bug.go6
-rw-r--r--api/graphql/models/lazy_identity.go6
-rw-r--r--api/graphql/resolvers/mutation.go6
-rw-r--r--api/graphql/resolvers/repo.go14
5 files changed, 20 insertions, 17 deletions
diff --git a/api/graphql/graphql_test.go b/api/graphql/graphql_test.go
index 2ddfb314..a8dfad3f 100644
--- a/api/graphql/graphql_test.go
+++ b/api/graphql/graphql_test.go
@@ -19,8 +19,11 @@ func TestQueries(t *testing.T) {
random_bugs.FillRepoWithSeed(repo, 10, 42)
mrc := cache.NewMultiRepoCache()
- _, err := mrc.RegisterDefaultRepository(repo)
+ _, events, err := mrc.RegisterDefaultRepository(repo)
require.NoError(t, err)
+ for event := range events {
+ require.NoError(t, event.Err)
+ }
handler := NewHandler(mrc, nil)
diff --git a/api/graphql/models/lazy_bug.go b/api/graphql/models/lazy_bug.go
index 318fdc99..4b0b598e 100644
--- a/api/graphql/models/lazy_bug.go
+++ b/api/graphql/models/lazy_bug.go
@@ -58,7 +58,7 @@ func (lb *lazyBug) load() error {
return nil
}
- b, err := lb.cache.ResolveBug(lb.excerpt.Id)
+ b, err := lb.cache.Bugs().Resolve(lb.excerpt.Id())
if err != nil {
return err
}
@@ -68,7 +68,7 @@ func (lb *lazyBug) load() error {
}
func (lb *lazyBug) identity(id entity.Id) (IdentityWrapper, error) {
- i, err := lb.cache.ResolveIdentityExcerpt(id)
+ i, err := lb.cache.Identities().ResolveExcerpt(id)
if err != nil {
return nil, err
}
@@ -79,7 +79,7 @@ func (lb *lazyBug) identity(id entity.Id) (IdentityWrapper, error) {
func (lb *lazyBug) IsAuthored() {}
func (lb *lazyBug) Id() entity.Id {
- return lb.excerpt.Id
+ return lb.excerpt.Id()
}
func (lb *lazyBug) LastEdit() time.Time {
diff --git a/api/graphql/models/lazy_identity.go b/api/graphql/models/lazy_identity.go
index 27bc9619..c19d077b 100644
--- a/api/graphql/models/lazy_identity.go
+++ b/api/graphql/models/lazy_identity.go
@@ -48,16 +48,16 @@ func (li *lazyIdentity) load() (*cache.IdentityCache, error) {
return li.id, nil
}
- id, err := li.cache.ResolveIdentity(li.excerpt.Id)
+ id, err := li.cache.Identities().Resolve(li.excerpt.Id())
if err != nil {
- return nil, fmt.Errorf("cache: missing identity %v", li.excerpt.Id)
+ return nil, fmt.Errorf("cache: missing identity %v", li.excerpt.Id())
}
li.id = id
return id, nil
}
func (li *lazyIdentity) Id() entity.Id {
- return li.excerpt.Id
+ return li.excerpt.Id()
}
func (li *lazyIdentity) Name() string {
diff --git a/api/graphql/resolvers/mutation.go b/api/graphql/resolvers/mutation.go
index 3f9f7fe1..32e1fa7c 100644
--- a/api/graphql/resolvers/mutation.go
+++ b/api/graphql/resolvers/mutation.go
@@ -32,7 +32,7 @@ func (r mutationResolver) getBug(repoRef *string, bugPrefix string) (*cache.Repo
return nil, nil, err
}
- b, err := repo.ResolveBugPrefix(bugPrefix)
+ b, err := repo.Bugs().ResolvePrefix(bugPrefix)
if err != nil {
return nil, nil, err
}
@@ -50,7 +50,7 @@ func (r mutationResolver) NewBug(ctx context.Context, input models.NewBugInput)
return nil, err
}
- b, op, err := repo.NewBugRaw(author,
+ b, op, err := repo.Bugs().NewRaw(author,
time.Now().Unix(),
text.CleanupOneLine(input.Title),
text.Cleanup(input.Message),
@@ -181,7 +181,7 @@ func (r mutationResolver) EditComment(ctx context.Context, input models.EditComm
return nil, err
}
- b, target, err := repo.ResolveComment(input.TargetPrefix)
+ b, target, err := repo.Bugs().ResolveComment(input.TargetPrefix)
if err != nil {
return nil, err
}
diff --git a/api/graphql/resolvers/repo.go b/api/graphql/resolvers/repo.go
index 3fcaada1..67b03628 100644
--- a/api/graphql/resolvers/repo.go
+++ b/api/graphql/resolvers/repo.go
@@ -41,7 +41,7 @@ func (repoResolver) AllBugs(_ context.Context, obj *models.Repository, after *st
}
// Simply pass a []string with the ids to the pagination algorithm
- source, err := obj.Repo.QueryBugs(q)
+ source, err := obj.Repo.Bugs().Query(q)
if err != nil {
return nil, err
}
@@ -60,7 +60,7 @@ func (repoResolver) AllBugs(_ context.Context, obj *models.Repository, after *st
nodes := make([]models.BugWrapper, len(lazyBugEdges))
for i, lazyBugEdge := range lazyBugEdges {
- excerpt, err := obj.Repo.ResolveBugExcerpt(lazyBugEdge.Id)
+ excerpt, err := obj.Repo.Bugs().ResolveExcerpt(lazyBugEdge.Id)
if err != nil {
return nil, err
}
@@ -86,7 +86,7 @@ func (repoResolver) AllBugs(_ context.Context, obj *models.Repository, after *st
}
func (repoResolver) Bug(_ context.Context, obj *models.Repository, prefix string) (models.BugWrapper, error) {
- excerpt, err := obj.Repo.ResolveBugExcerptPrefix(prefix)
+ excerpt, err := obj.Repo.Bugs().ResolveExcerptPrefix(prefix)
if err != nil {
return nil, err
}
@@ -103,7 +103,7 @@ func (repoResolver) AllIdentities(_ context.Context, obj *models.Repository, aft
}
// Simply pass a []string with the ids to the pagination algorithm
- source := obj.Repo.AllIdentityIds()
+ source := obj.Repo.Identities().AllIds()
// The edger create a custom edge holding just the id
edger := func(id entity.Id, offset int) connections.Edge {
@@ -119,7 +119,7 @@ func (repoResolver) AllIdentities(_ context.Context, obj *models.Repository, aft
nodes := make([]models.IdentityWrapper, len(lazyIdentityEdges))
for k, lazyIdentityEdge := range lazyIdentityEdges {
- excerpt, err := obj.Repo.ResolveIdentityExcerpt(lazyIdentityEdge.Id)
+ excerpt, err := obj.Repo.Identities().ResolveExcerpt(lazyIdentityEdge.Id)
if err != nil {
return nil, err
}
@@ -145,7 +145,7 @@ func (repoResolver) AllIdentities(_ context.Context, obj *models.Repository, aft
}
func (repoResolver) Identity(_ context.Context, obj *models.Repository, prefix string) (models.IdentityWrapper, error) {
- excerpt, err := obj.Repo.ResolveIdentityExcerptPrefix(prefix)
+ excerpt, err := obj.Repo.Identities().ResolveExcerptPrefix(prefix)
if err != nil {
return nil, err
}
@@ -187,5 +187,5 @@ func (repoResolver) ValidLabels(_ context.Context, obj *models.Repository, after
}, nil
}
- return connections.LabelCon(obj.Repo.ValidLabels(), edger, conMaker, input)
+ return connections.LabelCon(obj.Repo.Bugs().ValidLabels(), edger, conMaker, input)
}