feat: pull request generation

This commit is contained in:
2025-03-06 22:47:02 +01:00
parent 4d6459fae5
commit 367f9f9e70
28 changed files with 1918 additions and 181 deletions

View File

@ -2,6 +2,7 @@ package setup
import (
"context"
"net/http"
"forge.cadoles.com/wpetit/clearcase/internal/config"
"forge.cadoles.com/wpetit/clearcase/internal/http/handler/webui"
@ -22,13 +23,27 @@ func NewWebUIHandlerFromConfig(ctx context.Context, conf *config.Config) (*webui
opts = append(opts, webui.WithMount("/auth/", authHandler))
// Configure index redirect
opts = append(opts, webui.WithMount("/", authMiddleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/issue", http.StatusTemporaryRedirect)
}))))
// Configure issue handler
issueHandler, err := NewIssueHandlerFromConfig(ctx, conf)
if err != nil {
return nil, errors.Wrap(err, "could not configure issue handler from config")
}
opts = append(opts, webui.WithMount("/", authMiddleware(issueHandler)))
opts = append(opts, webui.WithMount("/issue/", authMiddleware(issueHandler)))
// Configure pull request handler
pullRequestHandler, err := NewPullRequestHandlerFromConfig(ctx, conf)
if err != nil {
return nil, errors.Wrap(err, "could not configure pull request handler from config")
}
opts = append(opts, webui.WithMount("/pullrequest/", authMiddleware(pullRequestHandler)))
// Configure common handler
commonHandler, err := NewCommonHandlerFromConfig(ctx, conf)