add load and save to sats service

This commit is contained in:
Robin Olsen
2026-02-02 11:43:45 +01:00
parent f463ea973f
commit dbc11a60a5

View File

@@ -1,9 +1,11 @@
package service
import (
"context"
"errors"
"github.com/LazyBachelor/LazyPM/internal/models"
"github.com/LazyBachelor/LazyPM/internal/storage"
"errors"
)
type StatisticsService struct {
@@ -19,6 +21,14 @@ func NewStatisticsService(storage *storage.Storage[models.Statistics]) (*Statist
}, nil
}
func (s *StatisticsService) Load(ctx context.Context) error {
return s.storage.Load()
}
func (s *StatisticsService) Save(ctx context.Context) error {
return s.storage.Save()
}
func (s *StatisticsService) GetStatistics() (models.Statistics, error) {
if s.storage.Data == nil {
return models.Statistics{}, errors.New("statistics data not initialized")