mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: implement diagnostics endpoint (resolve #225)
This commit is contained in:
18
repositories/diagnostics.go
Normal file
18
repositories/diagnostics.go
Normal file
@ -0,0 +1,18 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"github.com/muety/wakapi/models"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type DiagnosticsRepository struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewDiagnosticsRepository(db *gorm.DB) *DiagnosticsRepository {
|
||||
return &DiagnosticsRepository{db: db}
|
||||
}
|
||||
|
||||
func (r *DiagnosticsRepository) Insert(diagnostics *models.Diagnostics) (*models.Diagnostics, error) {
|
||||
return diagnostics, r.db.Create(diagnostics).Error
|
||||
}
|
@ -31,6 +31,10 @@ type IHeartbeatRepository interface {
|
||||
DeleteBefore(time.Time) error
|
||||
}
|
||||
|
||||
type IDiagnosticsRepository interface {
|
||||
Insert(diagnostics *models.Diagnostics) (*models.Diagnostics, error)
|
||||
}
|
||||
|
||||
type IKeyValueRepository interface {
|
||||
GetAll() ([]*models.KeyStringValue, error)
|
||||
GetString(string) (*models.KeyStringValue, error)
|
||||
|
Reference in New Issue
Block a user