This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package services
|
||||
|
||||
import "git.aiterp.net/rpdata/api/repositories"
|
||||
|
||||
// A Bundle contains all services, like a bean bag in the more caffeinated language family.
|
||||
type Bundle struct {
|
||||
Tags *TagService
|
||||
}
|
||||
|
||||
// NewBundle creates a new bundle.
|
||||
func NewBundle(repos *repositories.Bundle) *Bundle {
|
||||
bundle := &Bundle{}
|
||||
|
||||
bundle.Tags = &TagService{tags: repos.Tags}
|
||||
|
||||
return bundle
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.aiterp.net/rpdata/api/models"
|
||||
"git.aiterp.net/rpdata/api/repositories"
|
||||
)
|
||||
|
||||
// TagService is a service for tag-related functions.
|
||||
type TagService struct {
|
||||
tags repositories.TagRepository
|
||||
}
|
||||
|
||||
// FindTag finds one tag.
|
||||
func (s *TagService) FindTag(ctx context.Context, source, id string) (*models.Tag, error) {
|
||||
return s.tags.Find(ctx, source, id)
|
||||
}
|
||||
|
||||
// ListTags lists tags.
|
||||
func (s *TagService) ListTags(ctx context.Context, filter models.TagFilter) ([]*models.Tag, error) {
|
||||
return s.tags.List(ctx, filter)
|
||||
}
|
||||
Reference in New Issue
Block a user