aboutsummaryrefslogtreecommitdiff
path: root/backend/internal/model
diff options
context:
space:
mode:
Diffstat (limited to 'backend/internal/model')
-rw-r--r--backend/internal/model/types.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/backend/internal/model/types.go b/backend/internal/model/types.go
new file mode 100644
index 0000000..4e439b8
--- /dev/null
+++ b/backend/internal/model/types.go
@@ -0,0 +1,52 @@
+package model
+
+import "time"
+
+type Service struct {
+ ID int `json:"id"`
+ Name string `json:"name"`
+ URL string `json:"url"`
+ GroupName string `json:"group_name"`
+ IntervalSeconds int `json:"interval_seconds"`
+ IsActive bool `json:"is_active"`
+ DiscordWebhookURL string `json:"discord_webhook_url,omitempty"`
+ AlertEmail string `json:"alert_email,omitempty"`
+ KeywordToFind string `json:"keyword_to_find,omitempty"`
+ CreatedAt time.Time `json:"created_at"`
+}
+
+type Heartbeat struct {
+ ID int `json:"id"`
+ ServiceID int `json:"service_id"`
+ StatusCode int `json:"status_code"`
+ ResponseTimeMs int64 `json:"response_time_ms"`
+ IsUp bool `json:"is_up"`
+ ErrorMessage string `json:"error_message,omitempty"`
+ TestedAt time.Time `json:"tested_at"`
+}
+
+type Maintenance struct {
+ ID int `json:"id"`
+ Title string `json:"title"`
+ StartTime time.Time `json:"start_time"`
+ EndTime time.Time `json:"end_time"`
+ IsActive bool `json:"is_active"`
+}
+
+type ServiceStats struct {
+ ServiceID int `json:"service_id"`
+ Uptime24h float64 `json:"uptime_24h"`
+ Uptime7d float64 `json:"uptime_7d"`
+ Uptime30d float64 `json:"uptime_30d"`
+ AvgResponseMs24h float64 `json:"avg_response_ms_24h"`
+ AvgResponseMs7d float64 `json:"avg_response_ms_7d"`
+ AvgResponseMs30d float64 `json:"avg_response_ms_30d"`
+ TotalChecks24h int `json:"total_checks_24h"`
+ TotalChecks7d int `json:"total_checks_7d"`
+ TotalChecks30d int `json:"total_checks_30d"`
+}
+
+type ServiceWithHeartbeat struct {
+ Service
+ LastHeartbeat *Heartbeat `json:"last_heartbeat,omitempty"`
+}