1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00
wakapi/services/diagnostics.go
Ferdinand Mütsch 4bd58789f4 fix: server error when passing empty heartbeats slice
fix: do not allow to set id for diagnostics inputs
chore: remove authentication for diagnostics endpoint from swagger docs
2022-05-13 16:12:18 +02:00

25 lines
612 B
Go

package services
import (
"github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"github.com/muety/wakapi/repositories"
)
type DiagnosticsService struct {
config *config.Config
repository repositories.IDiagnosticsRepository
}
func NewDiagnosticsService(diagnosticsRepo repositories.IDiagnosticsRepository) *DiagnosticsService {
return &DiagnosticsService{
config: config.Get(),
repository: diagnosticsRepo,
}
}
func (srv *DiagnosticsService) Create(diagnostics *models.Diagnostics) (*models.Diagnostics, error) {
diagnostics.ID = 0
return srv.repository.Insert(diagnostics)
}