You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
500 B

package tag
import (
"context"
"git.aiterp.net/rpdata2-take2/rpdata2"
"git.aiterp.net/rpdata2-take2/rpdata2/auth"
)
type Service struct {
Repository Repository
Auth auth.Service
}
func (s *Service) Find(ctx context.Context, id string) (*Node, error) {
tags, err := s.Repository.FindRecursive(ctx, id)
if err != nil {
return nil, err
}
root := BuildForest(tags)[0].WithoutSecret(s.Auth.GetUser(ctx))
if root == nil {
return nil, rpdata2.NotFound("Tag")
}
return root, nil
}