- 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
32 lines
1019 B
Go
32 lines
1019 B
Go
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"`
|
|
}
|