-
Notifications
You must be signed in to change notification settings - Fork 1
/
serv.go
47 lines (38 loc) · 1.42 KB
/
serv.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package checkservice
import (
"context"
"github.com/ScoreTrak/ScoreTrak/pkg/check"
repo2 "github.com/ScoreTrak/ScoreTrak/pkg/check/checkrepo"
"github.com/gofrs/uuid"
)
type Serv interface {
GetAllByRoundID(ctx context.Context, roundID uint64) ([]*check.Check, error)
GetByRoundServiceID(ctx context.Context, roundID uint64, serviceID uuid.UUID) (*check.Check, error)
GetAllByServiceID(ctx context.Context, serviceID uuid.UUID) ([]*check.Check, error)
}
type checkServ struct {
repo repo2.Repo
}
func NewCheckServ(repo repo2.Repo) Serv {
return &checkServ{
repo: repo,
}
}
func (svc *checkServ) GetAllByRoundID(ctx context.Context, roundID uint64) ([]*check.Check, error) {
return svc.repo.GetAllByRoundID(ctx, roundID)
}
func (svc *checkServ) GetByRoundServiceID(ctx context.Context, roundID uint64, serviceID uuid.UUID) (*check.Check, error) {
return svc.repo.GetByRoundServiceID(ctx, roundID, serviceID)
}
func (svc *checkServ) GetAllByServiceID(ctx context.Context, serviceID uuid.UUID) ([]*check.Check, error) {
return svc.repo.GetAllByServiceID(ctx, serviceID)
}
func (svc *checkServ) Delete(ctx context.Context, roundID uint64, serviceID uuid.UUID) error {
return svc.repo.Delete(ctx, roundID, serviceID)
}
func (svc *checkServ) GetAll(ctx context.Context) ([]*check.Check, error) {
return svc.repo.GetAll(ctx)
}
func (svc *checkServ) Store(ctx context.Context, c []*check.Check) error {
return svc.repo.Store(ctx, c)
}