feat: Complete HTML-first architecture implementation with API integration

- Replace value field with html_content for direct HTML storage
- Add original_template field for style detection preservation
- Remove all markdown processing from injector (delete markdown.go)
- Fix critical content extraction/injection bugs in engine
- Add missing UpdateContent PUT handler for content persistence
- Fix API client field names and add updateContent() method
- Resolve content type validation (only allow text/link types)
- Add UUID-based ID generation to prevent collisions
- Complete first-pass processing workflow for unprocessed elements
- Verify end-to-end: Enhancement → Database → API → Editor → Persistence

All 37 files updated for HTML-first content management system.
Phase 3a implementation complete and production ready.
This commit is contained in:
2025-09-20 16:42:00 +02:00
parent bb5ea6f873
commit 2177055c76
37 changed files with 1189 additions and 737 deletions

View File

@@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// sqlc v1.30.0
// source: versions.sql
package sqlite
@@ -11,23 +11,25 @@ import (
)
const createContentVersion = `-- name: CreateContentVersion :exec
INSERT INTO content_versions (content_id, site_id, value, type, created_by)
VALUES (?1, ?2, ?3, ?4, ?5)
INSERT INTO content_versions (content_id, site_id, html_content, original_template, type, created_by)
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
`
type CreateContentVersionParams struct {
ContentID string `json:"content_id"`
SiteID string `json:"site_id"`
Value string `json:"value"`
Type string `json:"type"`
CreatedBy string `json:"created_by"`
ContentID string `json:"content_id"`
SiteID string `json:"site_id"`
HtmlContent string `json:"html_content"`
OriginalTemplate sql.NullString `json:"original_template"`
Type string `json:"type"`
CreatedBy string `json:"created_by"`
}
func (q *Queries) CreateContentVersion(ctx context.Context, arg CreateContentVersionParams) error {
_, err := q.db.ExecContext(ctx, createContentVersion,
arg.ContentID,
arg.SiteID,
arg.Value,
arg.HtmlContent,
arg.OriginalTemplate,
arg.Type,
arg.CreatedBy,
)
@@ -51,8 +53,8 @@ func (q *Queries) DeleteOldVersions(ctx context.Context, arg DeleteOldVersionsPa
const getAllVersionsForSite = `-- name: GetAllVersionsForSite :many
SELECT
cv.version_id, cv.content_id, cv.site_id, cv.value, cv.type, cv.created_at, cv.created_by,
c.value as current_value
cv.version_id, cv.content_id, cv.site_id, cv.html_content, cv.original_template, cv.type, cv.created_at, cv.created_by,
c.html_content as current_html_content
FROM content_versions cv
LEFT JOIN content c ON cv.content_id = c.id AND cv.site_id = c.site_id
WHERE cv.site_id = ?1
@@ -66,14 +68,15 @@ type GetAllVersionsForSiteParams struct {
}
type GetAllVersionsForSiteRow struct {
VersionID int64 `json:"version_id"`
ContentID string `json:"content_id"`
SiteID string `json:"site_id"`
Value string `json:"value"`
Type string `json:"type"`
CreatedAt int64 `json:"created_at"`
CreatedBy string `json:"created_by"`
CurrentValue sql.NullString `json:"current_value"`
VersionID int64 `json:"version_id"`
ContentID string `json:"content_id"`
SiteID string `json:"site_id"`
HtmlContent string `json:"html_content"`
OriginalTemplate sql.NullString `json:"original_template"`
Type string `json:"type"`
CreatedAt int64 `json:"created_at"`
CreatedBy string `json:"created_by"`
CurrentHtmlContent sql.NullString `json:"current_html_content"`
}
func (q *Queries) GetAllVersionsForSite(ctx context.Context, arg GetAllVersionsForSiteParams) ([]GetAllVersionsForSiteRow, error) {
@@ -89,11 +92,12 @@ func (q *Queries) GetAllVersionsForSite(ctx context.Context, arg GetAllVersionsF
&i.VersionID,
&i.ContentID,
&i.SiteID,
&i.Value,
&i.HtmlContent,
&i.OriginalTemplate,
&i.Type,
&i.CreatedAt,
&i.CreatedBy,
&i.CurrentValue,
&i.CurrentHtmlContent,
); err != nil {
return nil, err
}
@@ -109,7 +113,7 @@ func (q *Queries) GetAllVersionsForSite(ctx context.Context, arg GetAllVersionsF
}
const getContentVersion = `-- name: GetContentVersion :one
SELECT version_id, content_id, site_id, value, type, created_at, created_by
SELECT version_id, content_id, site_id, html_content, original_template, type, created_at, created_by
FROM content_versions
WHERE version_id = ?1
`
@@ -121,7 +125,8 @@ func (q *Queries) GetContentVersion(ctx context.Context, versionID int64) (Conte
&i.VersionID,
&i.ContentID,
&i.SiteID,
&i.Value,
&i.HtmlContent,
&i.OriginalTemplate,
&i.Type,
&i.CreatedAt,
&i.CreatedBy,
@@ -130,7 +135,7 @@ func (q *Queries) GetContentVersion(ctx context.Context, versionID int64) (Conte
}
const getContentVersionHistory = `-- name: GetContentVersionHistory :many
SELECT version_id, content_id, site_id, value, type, created_at, created_by
SELECT version_id, content_id, site_id, html_content, original_template, type, created_at, created_by
FROM content_versions
WHERE content_id = ?1 AND site_id = ?2
ORDER BY created_at DESC
@@ -156,7 +161,8 @@ func (q *Queries) GetContentVersionHistory(ctx context.Context, arg GetContentVe
&i.VersionID,
&i.ContentID,
&i.SiteID,
&i.Value,
&i.HtmlContent,
&i.OriginalTemplate,
&i.Type,
&i.CreatedAt,
&i.CreatedBy,