All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2
29 lines
596 B
Go
29 lines
596 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"gitea.dwysokinski.me/twhelp/dcbot/internal/domain"
|
|
)
|
|
|
|
type GroupRepository interface {
|
|
Create(ctx context.Context, params domain.CreateGroupParams) (domain.Group, error)
|
|
}
|
|
|
|
type Group struct {
|
|
repo GroupRepository
|
|
}
|
|
|
|
func NewGroup(repo GroupRepository) *Group {
|
|
return &Group{repo: repo}
|
|
}
|
|
|
|
func (g *Group) Create(ctx context.Context, params domain.CreateGroupParams) (domain.Group, error) {
|
|
group, err := g.repo.Create(ctx, params)
|
|
if err != nil {
|
|
return domain.Group{}, fmt.Errorf("GroupRepository.Create: %w", err)
|
|
}
|
|
return group, nil
|
|
}
|