Complete API handlers refactoring to eliminate type switching and use repository pattern consistently

This commit is contained in:
2025-10-08 20:36:20 +02:00
parent 01b921bfa3
commit bbf728d110
16 changed files with 268 additions and 2654 deletions

View File

@@ -29,7 +29,7 @@ func NewContentEngine(client db.ContentRepository) *ContentEngine {
idGenerator: NewIDGenerator(),
client: client,
authProvider: authProvider,
injector: NewInjector(client, ""), // siteID will be set per operation
injector: NewInjector(client, "", nil), // siteID will be set per operation
}
}
@@ -42,7 +42,7 @@ func NewContentEngineWithAuth(client db.ContentRepository, authProvider *AuthPro
idGenerator: NewIDGenerator(),
client: client,
authProvider: authProvider,
injector: NewInjectorWithAuth(client, "", authProvider), // siteID will be set per operation
injector: NewInjectorWithAuth(client, "", authProvider, nil), // siteID will be set per operation
}
}
@@ -130,7 +130,7 @@ func (e *ContentEngine) ProcessContent(input ContentInput) (*ContentResult, erro
// 6. Inject editor assets for enhancement mode (development)
if input.Mode == Enhancement {
injector := NewInjectorWithAuth(e.client, input.SiteID, e.authProvider)
injector := NewInjectorWithAuth(e.client, input.SiteID, e.authProvider, nil)
injector.InjectEditorAssets(doc, true, "")
}
@@ -601,7 +601,7 @@ func (e *ContentEngine) reconstructCollectionItems(collectionNode *html.Node, co
if structuralBody != nil {
// Process each .insertr element using Injector pattern (unified approach)
injector := NewInjector(e.client, siteID)
injector := NewInjector(e.client, siteID, nil)
// Walk through structural elements and hydrate with content from content table
e.walkNodes(structuralBody, func(n *html.Node) {