Consolidate type definitions and fix API contract

- Move all ContentItem, ContentClient, ContentResponse types to engine/types.go as single source of truth
- Remove duplicate type definitions from content/types.go
- Update all imports across codebase to use engine types
- Enhance engine to extract existing data-content-id from HTML markup
- Simplify frontend to always send html_markup, let server handle ID extraction/generation
- Fix contentId reference errors in frontend error handling
- Add getAttribute helper method to engine for ID extraction
- Add GetAllContent method to engine.DatabaseClient
- Update enhancer to use engine.ContentClient interface
- All builds and API endpoints verified working

This resolves the 400 Bad Request errors and creates a unified architecture where the server is the single source of truth for all ID generation and content type management.
This commit is contained in:
2025-09-16 16:45:29 +02:00
parent d0ac3088b4
commit d877366be0
15 changed files with 150 additions and 181 deletions

View File

@@ -7,6 +7,8 @@ import (
"path/filepath"
"sync"
"time"
"github.com/insertr/insertr/internal/engine"
)
// SiteConfig represents configuration for a registered site
@@ -28,7 +30,7 @@ type SiteManager struct {
}
// NewSiteManager creates a new site manager
func NewSiteManager(contentClient ContentClient, backupDir string, devMode bool) *SiteManager {
func NewSiteManager(contentClient engine.ContentClient, backupDir string, devMode bool) *SiteManager {
if backupDir == "" {
backupDir = "./insertr-backups"
}