Started work on new layered setup, making a huge mess.
the build was successful

This commit is contained in:
2019-06-09 12:37:17 +02:00
parent 6fa9f64f2d
commit cdf4e6f667
33 changed files with 540 additions and 210 deletions
+17
View File
@@ -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
}
+23
View File
@@ -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)
}