aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/resolvers/repo.go
blob: 14019b65f35bec328dba835620f74e97a7d30863 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package resolvers

import (
	"context"
	"github.com/MichaelMure/git-bug/bug"
	"github.com/MichaelMure/git-bug/cache"
)

type repoResolver struct {
	cache cache.Cacher
	repo  cache.RepoCacher
}

func (repoResolver) AllBugs(ctx context.Context, obj *repoResolver, input ConnectionInput) (BugConnection, error) {
	panic("implement me")
}

func (repoResolver) Bug(ctx context.Context, obj *repoResolver, prefix string) (*bug.Snapshot, error) {
	b, err := obj.repo.ResolveBugPrefix(prefix)

	if err != nil {
		return nil, err
	}

	return b.Snapshot(), nil
}