From 6cc0bfd1d79074df790272b8091b1f0226d14283 Mon Sep 17 00:00:00 2001 From: zwlucas Date: Fri, 29 May 2026 15:57:37 -0300 Subject: feat: upload project Signed-off-by: zwlucas --- backend/internal/model/types.go | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 backend/internal/model/types.go (limited to 'backend/internal/model/types.go') 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"` +} -- cgit v1.2.3