Complete API handlers refactoring to eliminate type switching and use repository pattern consistently

This commit is contained in:
2025-10-08 20:36:20 +02:00
parent 01b921bfa3
commit bbf728d110
16 changed files with 268 additions and 2654 deletions

View File

@@ -3,6 +3,7 @@ package api
import (
"log"
"net/http"
"slices"
"strings"
"time"
)
@@ -92,13 +93,7 @@ func CORSPreflightHandler(w http.ResponseWriter, r *http.Request) {
}
// Check if origin is allowed
originAllowed := false
for _, allowed := range allowedOrigins {
if origin == allowed {
originAllowed = true
break
}
}
originAllowed := slices.Contains(allowedOrigins, origin)
if originAllowed {
w.Header().Set("Access-Control-Allow-Origin", origin)