chore(repo): reinitialize repository
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user