feat: image gallery (#2)
/ publish (push) Successful in 4m4s

Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
2026-06-01 14:07:50 +02:00
parent ee3eba3cd9
commit 763163c24e
30 changed files with 513 additions and 44 deletions
+40
View File
@@ -0,0 +1,40 @@
package restgallery
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/components/gallery"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/config"
"github.com/a-h/templ"
)
type Handler struct {
http.Handler
srv galleryService
r renderer
cfg *config.Gallery
}
func New(renderer renderer, srv galleryService, cfg *config.Gallery) *Handler {
mux := http.NewServeMux()
h := &Handler{
Handler: mux,
srv: srv,
r: renderer,
cfg: cfg,
}
mux.HandleFunc(fmt.Sprintf("GET /%s", url.PathEscape(cfg.Path)), h.gallery)
return h
}
type galleryService interface {
GetGallerySet(ctx context.Context) (gallerySet gallery.Set, err error)
}
type renderer interface {
Render(ctx context.Context, w io.Writer, r *http.Request, component templ.Component)
}