moved templates package into ui dir
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user