feat: complete HTML-first architecture implementation (Phase 1 & 2)
Major architectural simplification removing content type complexity: Database Schema: - Remove 'type' field from content and content_versions tables - Simplify to pure HTML storage with html_content + original_template - Regenerate all sqlc models for SQLite and PostgreSQL API Simplification: - Remove content type routing and validation - Eliminate type-specific handlers (text/markdown/structured) - Unified HTML-first approach for all content operations - Simplify CreateContent and UpdateContent to HTML-only Backend Enhancements: - Update enhancer to only generate data-content-id (no data-content-type) - Improve container expansion utilities with comprehensive block/inline rules - Add Phase 3 preparation with boundary-respecting traversal logic - Strengthen element classification for viable children detection Documentation: - Update TODO.md to reflect Phase 1-3 completion status - Add WORKING_ON.md documenting the architectural transformation - Mark container expansion and HTML-first architecture as complete This completes the transition to a unified HTML-first content management system with automatic style detection and element-based behavior, eliminating the complex multi-type system in favor of semantic HTML-driven editing.
This commit is contained in:
@@ -12,9 +12,9 @@ import (
|
||||
)
|
||||
|
||||
const createContent = `-- name: CreateContent :one
|
||||
INSERT INTO content (id, site_id, html_content, original_template, type, last_edited_by)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
|
||||
RETURNING id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
INSERT INTO content (id, site_id, html_content, original_template, last_edited_by)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5)
|
||||
RETURNING id, site_id, html_content, original_template, created_at, updated_at, last_edited_by
|
||||
`
|
||||
|
||||
type CreateContentParams struct {
|
||||
@@ -22,7 +22,6 @@ type CreateContentParams struct {
|
||||
SiteID string `json:"site_id"`
|
||||
HtmlContent string `json:"html_content"`
|
||||
OriginalTemplate sql.NullString `json:"original_template"`
|
||||
Type string `json:"type"`
|
||||
LastEditedBy string `json:"last_edited_by"`
|
||||
}
|
||||
|
||||
@@ -32,7 +31,6 @@ func (q *Queries) CreateContent(ctx context.Context, arg CreateContentParams) (C
|
||||
arg.SiteID,
|
||||
arg.HtmlContent,
|
||||
arg.OriginalTemplate,
|
||||
arg.Type,
|
||||
arg.LastEditedBy,
|
||||
)
|
||||
var i Content
|
||||
@@ -41,7 +39,6 @@ func (q *Queries) CreateContent(ctx context.Context, arg CreateContentParams) (C
|
||||
&i.SiteID,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.LastEditedBy,
|
||||
@@ -75,7 +72,7 @@ func (q *Queries) DeleteContent(ctx context.Context, arg DeleteContentParams) er
|
||||
}
|
||||
|
||||
const getAllContent = `-- name: GetAllContent :many
|
||||
SELECT id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
SELECT id, site_id, html_content, original_template, created_at, updated_at, last_edited_by
|
||||
FROM content
|
||||
WHERE site_id = ?1
|
||||
ORDER BY updated_at DESC
|
||||
@@ -95,7 +92,6 @@ func (q *Queries) GetAllContent(ctx context.Context, siteID string) ([]Content,
|
||||
&i.SiteID,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.LastEditedBy,
|
||||
@@ -114,7 +110,7 @@ func (q *Queries) GetAllContent(ctx context.Context, siteID string) ([]Content,
|
||||
}
|
||||
|
||||
const getBulkContent = `-- name: GetBulkContent :many
|
||||
SELECT id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
SELECT id, site_id, html_content, original_template, created_at, updated_at, last_edited_by
|
||||
FROM content
|
||||
WHERE site_id = ?1 AND id IN (/*SLICE:ids*/?)
|
||||
`
|
||||
@@ -149,7 +145,6 @@ func (q *Queries) GetBulkContent(ctx context.Context, arg GetBulkContentParams)
|
||||
&i.SiteID,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.LastEditedBy,
|
||||
@@ -168,7 +163,7 @@ func (q *Queries) GetBulkContent(ctx context.Context, arg GetBulkContentParams)
|
||||
}
|
||||
|
||||
const getContent = `-- name: GetContent :one
|
||||
SELECT id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
SELECT id, site_id, html_content, original_template, created_at, updated_at, last_edited_by
|
||||
FROM content
|
||||
WHERE id = ?1 AND site_id = ?2
|
||||
`
|
||||
@@ -186,7 +181,6 @@ func (q *Queries) GetContent(ctx context.Context, arg GetContentParams) (Content
|
||||
&i.SiteID,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.LastEditedBy,
|
||||
@@ -196,14 +190,13 @@ func (q *Queries) GetContent(ctx context.Context, arg GetContentParams) (Content
|
||||
|
||||
const updateContent = `-- name: UpdateContent :one
|
||||
UPDATE content
|
||||
SET html_content = ?1, type = ?2, last_edited_by = ?3
|
||||
WHERE id = ?4 AND site_id = ?5
|
||||
RETURNING id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
SET html_content = ?1, last_edited_by = ?2
|
||||
WHERE id = ?3 AND site_id = ?4
|
||||
RETURNING id, site_id, html_content, original_template, created_at, updated_at, last_edited_by
|
||||
`
|
||||
|
||||
type UpdateContentParams struct {
|
||||
HtmlContent string `json:"html_content"`
|
||||
Type string `json:"type"`
|
||||
LastEditedBy string `json:"last_edited_by"`
|
||||
ID string `json:"id"`
|
||||
SiteID string `json:"site_id"`
|
||||
@@ -212,7 +205,6 @@ type UpdateContentParams struct {
|
||||
func (q *Queries) UpdateContent(ctx context.Context, arg UpdateContentParams) (Content, error) {
|
||||
row := q.db.QueryRowContext(ctx, updateContent,
|
||||
arg.HtmlContent,
|
||||
arg.Type,
|
||||
arg.LastEditedBy,
|
||||
arg.ID,
|
||||
arg.SiteID,
|
||||
@@ -223,7 +215,6 @@ func (q *Queries) UpdateContent(ctx context.Context, arg UpdateContentParams) (C
|
||||
&i.SiteID,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.LastEditedBy,
|
||||
@@ -232,13 +223,12 @@ func (q *Queries) UpdateContent(ctx context.Context, arg UpdateContentParams) (C
|
||||
}
|
||||
|
||||
const upsertContent = `-- name: UpsertContent :one
|
||||
INSERT INTO content (id, site_id, html_content, original_template, type, last_edited_by)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6)
|
||||
INSERT INTO content (id, site_id, html_content, original_template, last_edited_by)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5)
|
||||
ON CONFLICT(id, site_id) DO UPDATE SET
|
||||
html_content = EXCLUDED.html_content,
|
||||
type = EXCLUDED.type,
|
||||
last_edited_by = EXCLUDED.last_edited_by
|
||||
RETURNING id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
RETURNING id, site_id, html_content, original_template, created_at, updated_at, last_edited_by
|
||||
`
|
||||
|
||||
type UpsertContentParams struct {
|
||||
@@ -246,7 +236,6 @@ type UpsertContentParams struct {
|
||||
SiteID string `json:"site_id"`
|
||||
HtmlContent string `json:"html_content"`
|
||||
OriginalTemplate sql.NullString `json:"original_template"`
|
||||
Type string `json:"type"`
|
||||
LastEditedBy string `json:"last_edited_by"`
|
||||
}
|
||||
|
||||
@@ -256,7 +245,6 @@ func (q *Queries) UpsertContent(ctx context.Context, arg UpsertContentParams) (C
|
||||
arg.SiteID,
|
||||
arg.HtmlContent,
|
||||
arg.OriginalTemplate,
|
||||
arg.Type,
|
||||
arg.LastEditedBy,
|
||||
)
|
||||
var i Content
|
||||
@@ -265,7 +253,6 @@ func (q *Queries) UpsertContent(ctx context.Context, arg UpsertContentParams) (C
|
||||
&i.SiteID,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
&i.LastEditedBy,
|
||||
|
||||
Reference in New Issue
Block a user