-
Notifications
You must be signed in to change notification settings - Fork 3
/
repository.go
32 lines (25 loc) · 1.04 KB
/
repository.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
package repository
import (
"context"
"errors"
"github.com/kleister/kleister-api/pkg/model"
)
var (
// ErrTeamNotFound defines the error if a team could not be found.
ErrTeamNotFound = errors.New("user not found")
// ErrTeamOrUserNotFound defines the error if a team or user could not be found.
ErrTeamOrUserNotFound = errors.New("team or user not found")
// ErrUserNotAssigned defines the error if a team is not assigned to a user.
ErrUserNotAssigned = errors.New("team is not assigned")
// ErrUserAlreadyAssigned defines the error if a team is already assigned to a user.
ErrUserAlreadyAssigned = errors.New("team is already assigned")
)
// TeamsRepository defines the required functions for the repository.
type TeamsRepository interface {
List(context.Context) ([]*model.Team, error)
Create(context.Context, *model.Team) (*model.Team, error)
Update(context.Context, *model.Team) (*model.Team, error)
Show(context.Context, string) (*model.Team, error)
Delete(context.Context, string) error
Exists(context.Context, string) (bool, error)
}