SHA256
31 lines
711 B
Go
31 lines
711 B
Go
package service
|
|
|
|
import (
|
|
"ashareview-server/model"
|
|
"ashareview-server/repository"
|
|
)
|
|
|
|
type DashboardService struct {
|
|
repo *repository.StockRepo
|
|
}
|
|
|
|
func NewDashboardService(repo *repository.StockRepo) *DashboardService {
|
|
return &DashboardService{repo: repo}
|
|
}
|
|
|
|
func (s *DashboardService) GetSummary() (*model.DashboardSummary, error) {
|
|
date, err := s.repo.GetLatestTradeDate()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return s.repo.GetSummaryByDate(date)
|
|
}
|
|
|
|
func (s *DashboardService) GetDailySummary(days int) ([]model.DailySummary, error) {
|
|
return s.repo.GetDailySummary(days)
|
|
}
|
|
|
|
func (s *DashboardService) GetConsecutiveLimits() ([]model.ConsecutiveLimit, error) {
|
|
return s.repo.GetConsecutiveLimits()
|
|
}
|