summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2025-08-07 02:48:12 -0400
committerRobby Zambito <contact@robbyzambito.me>2025-08-07 20:22:47 -0400
commit7926e31163bf1752d0c876762e11f79a0952180f (patch)
tree21ad5c11ee2c4e25f6c5948874092eea7c8cc258 /internal
parent53a699d2b32a3d7a5268de7ac5b9c6daa0fc3975 (diff)
Stub out status and contact API handlers
Diffstat (limited to 'internal')
-rw-r--r--internal/api/handlers.go81
1 files changed, 81 insertions, 0 deletions
diff --git a/internal/api/handlers.go b/internal/api/handlers.go
index 45354aa..194401d 100644
--- a/internal/api/handlers.go
+++ b/internal/api/handlers.go
@@ -73,6 +73,87 @@ func CreateLoginHandler(logs *[LogLength]string, n *int, logChan chan string) ht
}
}
+func StatusHandler(w http.ResponseWriter, r *http.Request) {
+ type response struct {
+ Status string `json:"status"`
+ Description string `json:"description"`
+ Uptime float64 `json:"uptime"`
+ ResponseTime int `json:"responseTime"`
+ ActiveIncidents int `json:"activeIncidents"`
+ ScheduledMaintenance int `json:"scheduledMaintenance"`
+ }
+}
+
+func StatusServicesHandler(w http.ResponseWriter, r *http.Request) {
+ type service struct {
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Description string `json:"description"`
+ Icon string `json:"icon"`
+ Status string `json:"status"`
+ ResponseTime int `json:"responseTime"`
+ Uptime float64 `json:"uptime"`
+ }
+
+ var response []service
+ _ = response
+}
+
+func StatusMetricsHandler(w http.ResponseWriter, r *http.Request) {
+ type response struct {
+ Uptime float64 `json:"uptime"`
+ ResponseTime int `json:"responseTime"`
+ RequestVolume int `json:"requestVolume"`
+ ErrorRate float64 `json:"errorRate"`
+ }
+}
+
+func StatusIncidentsHandler(w http.ResponseWriter, r *http.Request) {
+ type incident struct {
+ Id string `json:"id"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Status string `json:"status"`
+ Severity string `json:"severity"`
+ StartTime time.Time `json:"startTime"`
+ AffectedServices []string `json:"affectedServices"`
+ }
+ var response []incident
+ _ = response
+}
+
+func StatusMaintenanceHandler(w http.ResponseWriter, r *http.Request) {
+ type event struct {
+ Id string `json:"id"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ StartTime time.Time `json:"startTime"`
+ EndTime time.Time `json:"endTime"`
+ AffectedServices []string `json:"affectedServices"`
+ }
+ var response []event
+ _ = response
+}
+
+func StatusUptimeHandler(w http.ResponseWriter, r *http.Request) {
+ type event struct {
+ Date time.Time `json:"date"`
+ Uptime float64 `json:"uptime"`
+ }
+ var response []event
+ _ = response
+}
+
+// TODO: SUBSCRIBE TO EMAILS
+func StatusSubscribeHandler(w http.ResponseWriter, r *http.Request) {
+
+}
+
+// TODO: CONTACT HANDLER
+func ContactHandler(w http.ResponseWriter, r *http.Request) {
+
+}
+
func redactIP(input string) string {
ipRegex := `\b(?:\d{1,3}\.){3}\d{1,3}\b`
re := regexp.MustCompile(ipRegex)