feat: 部署初版测试
This commit is contained in:
30
server/internal/service/custom_strategy_service.go
Normal file
30
server/internal/service/custom_strategy_service.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user