31 lines
858 B
Go
31 lines
858 B
Go
package service
|
|
|
|
import (
|
|
"github.com/zs/InsightReply/internal/model"
|
|
"github.com/zs/InsightReply/internal/repository"
|
|
)
|
|
|
|
type CustomStrategyService struct {
|
|
repo *repository.CustomStrategyRepository
|
|
}
|
|
|
|
func NewCustomStrategyService(repo *repository.CustomStrategyRepository) *CustomStrategyService {
|
|
return &CustomStrategyService{repo: repo}
|
|
}
|
|
|
|
func (s *CustomStrategyService) ListStrategies(userID string) ([]model.UserCustomStrategy, error) {
|
|
return s.repo.ListByUserID(userID)
|
|
}
|
|
|
|
func (s *CustomStrategyService) CreateStrategy(strategy *model.UserCustomStrategy) error {
|
|
return s.repo.Create(strategy)
|
|
}
|
|
|
|
func (s *CustomStrategyService) UpdateStrategy(strategy *model.UserCustomStrategy) error {
|
|
return s.repo.Update(strategy)
|
|
}
|
|
|
|
func (s *CustomStrategyService) DeleteStrategy(id string, userID string) error {
|
|
return s.repo.Delete(id, userID)
|
|
}
|