40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package qualityowner
|
|
|
|
import "context"
|
|
|
|
type Service struct {
|
|
repo *Repository
|
|
}
|
|
|
|
func NewService(repo *Repository) *Service {
|
|
return &Service{repo: repo}
|
|
}
|
|
|
|
func (s *Service) Status(ctx context.Context, userID uint64) (*StatusDTO, error) {
|
|
if s == nil || s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.Status(ctx, userID)
|
|
}
|
|
|
|
func (s *Service) Activate(ctx context.Context, userID uint64) (*StatusDTO, error) {
|
|
if s == nil || s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.Activate(ctx, userID)
|
|
}
|
|
|
|
func (s *Service) Cancel(ctx context.Context, userID uint64, meta AuditMeta) (*StatusDTO, error) {
|
|
if s == nil || s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.Cancel(ctx, userID, meta)
|
|
}
|
|
|
|
func (s *Service) AdminSet(ctx context.Context, adminID uint64, userID uint64, req AdminSetRequest, meta AuditMeta) (*StatusDTO, error) {
|
|
if s == nil || s.repo == nil {
|
|
return nil, ErrDependencyUnavailable
|
|
}
|
|
return s.repo.AdminSet(ctx, adminID, userID, req, meta)
|
|
}
|