Files
ai-workflow/inbox/internal/app/skills/service.go
T

39 lines
1.0 KiB
Go

package skills
import (
"context"
"inbox/internal/domain/skill"
)
type Repository interface {
GetSkillByKey(ctx context.Context, skillKey string) (skill.Definition, error)
ListSkills(ctx context.Context) ([]skill.Definition, error)
UpsertSkill(ctx context.Context, value skill.Definition, changedBy string) (skill.Definition, error)
DeleteSkillByKey(ctx context.Context, skillKey string) error
}
type Service struct {
repo Repository
}
func NewService(repo Repository) *Service {
return &Service{repo: repo}
}
func (s *Service) List(ctx context.Context) ([]skill.Definition, error) {
return s.repo.ListSkills(ctx)
}
func (s *Service) GetByKey(ctx context.Context, skillKey string) (skill.Definition, error) {
return s.repo.GetSkillByKey(ctx, skillKey)
}
func (s *Service) Upsert(ctx context.Context, value skill.Definition, changedBy string) (skill.Definition, error) {
return s.repo.UpsertSkill(ctx, value, changedBy)
}
func (s *Service) Delete(ctx context.Context, skillKey string) error {
return s.repo.DeleteSkillByKey(ctx, skillKey)
}