Backend: Customers, Auth (JWT), Agent-Kundenzuordnung, CORS

This commit is contained in:
cynfo3000
2026-02-28 15:28:02 +01:00
parent 5daf81b9de
commit c6c8257cf0
15 changed files with 717 additions and 17 deletions
+1
View File
@@ -11,6 +11,7 @@ type Agent struct {
OPNsenseVersion string `json:"opnsense_version"`
RegisteredAt time.Time `json:"registered_at"`
LastHeartbeat *time.Time `json:"last_heartbeat,omitempty"`
CustomerID *int `json:"customer_id,omitempty"`
}
// AgentResponse erweitert Agent um den berechneten Status
+10
View File
@@ -0,0 +1,10 @@
package models
import "time"
type Customer struct {
ID int `json:"id"`
Number string `json:"number"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
}
+24
View File
@@ -0,0 +1,24 @@
package models
import "time"
type User struct {
ID int `json:"id"`
Username string `json:"username"`
PasswordHash string `json:"-"`
DisplayName string `json:"display_name"`
Role string `json:"role"`
CreatedAt time.Time `json:"created_at"`
LastLogin *time.Time `json:"last_login,omitempty"`
}
type LoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
type LoginResponse struct {
Token string `json:"token"`
ExpiresAt string `json:"expires_at"`
User User `json:"user"`
}