33 lines
662 B
Go
Raw Normal View History

2025-02-21 18:42:56 +01:00
package issue
import (
"net/http"
2025-02-22 09:42:15 +01:00
"forge.cadoles.com/wpetit/clearcase/internal/core/service"
2025-02-21 18:42:56 +01:00
)
type Handler struct {
2025-02-22 09:42:15 +01:00
mux *http.ServeMux
issueManager *service.IssueManager
2025-02-21 18:42:56 +01:00
}
// ServeHTTP implements http.Handler.
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.mux.ServeHTTP(w, r)
}
2025-02-22 09:42:15 +01:00
func NewHandler(issueManager *service.IssueManager) *Handler {
2025-02-21 18:42:56 +01:00
h := &Handler{
2025-02-22 09:42:15 +01:00
mux: http.NewServeMux(),
issueManager: issueManager,
2025-02-21 18:42:56 +01:00
}
h.mux.HandleFunc("GET /", h.getIssuePage)
2025-02-22 18:01:45 +01:00
h.mux.HandleFunc("PUT /", h.handleIssueSummaryForm)
h.mux.HandleFunc("POST /", h.handleIssueForm)
2025-02-21 18:42:56 +01:00
return h
}
var _ http.Handler = &Handler{}