Implementiere umfassendes Logging-System für WOL-Ereignisse
- Neue Log-Tabelle in der Datenbank - Automatisches Logging bei WOL-Button-Klicks - Dedizierte Logs-Seite mit Bootstrap-Design - Tooltips mit letzten 5 WOL-Ereignissen pro PC - API-Endpunkte für Log-Verwaltung - Einheitliches Design zwischen Haupt- und Logs-Seite - Vollständige Dokumentation des Logging-Systems
This commit is contained in:
31
internal/models/log.go
Normal file
31
internal/models/log.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// LogEvent repräsentiert ein Log-Ereignis in der Datenbank
|
||||
type LogEvent struct {
|
||||
ID int `json:"id" db:"id"`
|
||||
Timestamp time.Time `json:"timestamp" db:"timestamp"`
|
||||
PCID int `json:"pc_id" db:"pc_id"`
|
||||
PCName string `json:"pc_name" db:"pc_name"`
|
||||
MAC string `json:"mac" db:"mac"`
|
||||
Trigger string `json:"trigger" db:"trigger"` // "button" oder "cron"
|
||||
}
|
||||
|
||||
// CreateLogRequest repräsentiert die Anfrage zum Erstellen eines neuen Log-Eintrags
|
||||
type CreateLogRequest struct {
|
||||
PCID int `json:"pc_id" binding:"required"`
|
||||
PCName string `json:"pc_name" binding:"required"`
|
||||
MAC string `json:"mac" binding:"required"`
|
||||
Trigger string `json:"trigger" binding:"required"`
|
||||
}
|
||||
|
||||
// LogResponse repräsentiert die Antwort für Log-Operationen
|
||||
type LogResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Log *LogEvent `json:"log,omitempty"`
|
||||
Logs []LogEvent `json:"logs,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user