dcbot/internal/service/group.go
Dawid Wysokiński d94b7bcbed
All checks were successful
continuous-integration/drone/push Build is passing
feat: add a new cmd - group add (#2)
Reviewed-on: #2
2022-10-03 05:19:33 +00:00

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
}