This commit is contained in:
2026-03-01 22:52:08 +07:00
commit 1244f3e2d5
63 changed files with 6075 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package handlers
import (
"net/http"
"github.com/go-chi/chi"
)
// HandleWebhook handles incoming webhook requests
func (h *Handlers) HandleWebhook() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// Get webhook UUID from URL
webhookUUID := chi.URLParam(r, "uuid")
if webhookUUID == "" {
http.NotFound(w, r)
return
}
// Log the incoming webhook request
h.log.Info("webhook request received",
"uuid", webhookUUID,
"method", r.Method,
"remote_addr", r.RemoteAddr,
"user_agent", r.UserAgent(),
)
// Only POST methods are allowed for webhooks
if r.Method != http.MethodPost {
w.Header().Set("Allow", "POST")
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
// TODO: Implement webhook handling logic
// For now, return "unimplemented" for all webhook POST requests
w.WriteHeader(http.StatusNotFound)
_, err := w.Write([]byte("unimplemented"))
if err != nil {
h.log.Error("failed to write response", "error", err)
}
}
}