moved templates package into ui dir

This commit is contained in:
2026-01-24 13:37:11 -07:00
parent d8c7427eb2
commit 720c3fb4e0
2 changed files with 13 additions and 19 deletions
+3 -4
View File
@@ -14,10 +14,10 @@ import (
"ruben/inventory2/internal/domains/raw_events"
"ruben/inventory2/internal/logging"
"ruben/inventory2/internal/server/api"
templates_api "ruben/inventory2/internal/server/api/templates"
"ruben/inventory2/internal/server/middleware"
"ruben/inventory2/internal/server/response"
"ruben/inventory2/internal/server/sse"
"ruben/inventory2/internal/server/ui"
)
type Router struct {
@@ -53,11 +53,10 @@ func NewRouter(
c.Redirect(http.StatusMovedPermanently, "/ui")
})
templates_api.SetupRoutes(
logger.WithGroup("templates"),
ui.Routes(
logger.WithGroup("ui"),
r.Group("/ui"),
"/ui",
contentDir,
rawEvents,
accts,
etsy,
@@ -1,4 +1,4 @@
package templates
package ui
import (
"encoding/json"
@@ -25,7 +25,6 @@ type (
webpageRouter struct {
log *logging.Logger
uiPath string
contentDir string
templater *templater.Templater
rawEvents *raw_events.Store
accts *accounts.Store
@@ -39,11 +38,10 @@ type (
}
)
func SetupRoutes(
func Routes(
logger *logging.Logger,
r gin.IRoutes,
uiPath string,
contentDir string,
rawEvents *raw_events.Store,
accts *accounts.Store,
etsy *etsy_platform.Platform,
@@ -53,8 +51,6 @@ func SetupRoutes(
s := &webpageRouter{
log: logger,
uiPath: uiPath,
contentDir: contentDir,
// TODO: clean up the references to the templates dir throughout as well (should only be referred to in the 'main' package
templater: new(templater.Templater).With(templater.Config{
Funcs: func(name string, props map[string]any) template.FuncMap {
return template.FuncMap{
@@ -231,7 +227,6 @@ func authorizeByMatchingAccountID(r *http.Request, acctIDPathPosition int) error
return nil
}
// TODO: is this error type even needed anymore?
func (e ErrTemplateNotFound) Error() string {
if e.err != nil {
return fmt.Sprintf("template not found: %v", e.err)