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:
@@ -1,34 +1,37 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.29.0
|
||||
// sqlc v1.30.0
|
||||
// source: content.sql
|
||||
|
||||
package postgresql
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const createContent = `-- name: CreateContent :one
|
||||
INSERT INTO content (id, site_id, value, type, last_edited_by)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id, site_id, value, type, created_at, updated_at, last_edited_by
|
||||
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
|
||||
`
|
||||
|
||||
type CreateContentParams struct {
|
||||
ID string `json:"id"`
|
||||
SiteID string `json:"site_id"`
|
||||
Value string `json:"value"`
|
||||
Type string `json:"type"`
|
||||
LastEditedBy string `json:"last_edited_by"`
|
||||
ID string `json:"id"`
|
||||
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"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateContent(ctx context.Context, arg CreateContentParams) (Content, error) {
|
||||
row := q.db.QueryRowContext(ctx, createContent,
|
||||
arg.ID,
|
||||
arg.SiteID,
|
||||
arg.Value,
|
||||
arg.HtmlContent,
|
||||
arg.OriginalTemplate,
|
||||
arg.Type,
|
||||
arg.LastEditedBy,
|
||||
)
|
||||
@@ -36,7 +39,8 @@ func (q *Queries) CreateContent(ctx context.Context, arg CreateContentParams) (C
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.SiteID,
|
||||
&i.Value,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
@@ -45,6 +49,16 @@ func (q *Queries) CreateContent(ctx context.Context, arg CreateContentParams) (C
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteAllSiteContent = `-- name: DeleteAllSiteContent :exec
|
||||
DELETE FROM content
|
||||
WHERE site_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteAllSiteContent(ctx context.Context, siteID string) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteAllSiteContent, siteID)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteContent = `-- name: DeleteContent :exec
|
||||
DELETE FROM content
|
||||
WHERE id = $1 AND site_id = $2
|
||||
@@ -61,7 +75,7 @@ func (q *Queries) DeleteContent(ctx context.Context, arg DeleteContentParams) er
|
||||
}
|
||||
|
||||
const getAllContent = `-- name: GetAllContent :many
|
||||
SELECT id, site_id, value, type, created_at, updated_at, last_edited_by
|
||||
SELECT id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
FROM content
|
||||
WHERE site_id = $1
|
||||
ORDER BY updated_at DESC
|
||||
@@ -79,7 +93,8 @@ func (q *Queries) GetAllContent(ctx context.Context, siteID string) ([]Content,
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.SiteID,
|
||||
&i.Value,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
@@ -99,7 +114,7 @@ func (q *Queries) GetAllContent(ctx context.Context, siteID string) ([]Content,
|
||||
}
|
||||
|
||||
const getBulkContent = `-- name: GetBulkContent :many
|
||||
SELECT id, site_id, value, type, created_at, updated_at, last_edited_by
|
||||
SELECT id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
FROM content
|
||||
WHERE site_id = $1 AND id IN ($2)
|
||||
`
|
||||
@@ -132,7 +147,8 @@ func (q *Queries) GetBulkContent(ctx context.Context, arg GetBulkContentParams)
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.SiteID,
|
||||
&i.Value,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
@@ -152,7 +168,7 @@ func (q *Queries) GetBulkContent(ctx context.Context, arg GetBulkContentParams)
|
||||
}
|
||||
|
||||
const getContent = `-- name: GetContent :one
|
||||
SELECT id, site_id, value, type, created_at, updated_at, last_edited_by
|
||||
SELECT id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
FROM content
|
||||
WHERE id = $1 AND site_id = $2
|
||||
`
|
||||
@@ -168,7 +184,8 @@ func (q *Queries) GetContent(ctx context.Context, arg GetContentParams) (Content
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.SiteID,
|
||||
&i.Value,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
@@ -179,13 +196,13 @@ func (q *Queries) GetContent(ctx context.Context, arg GetContentParams) (Content
|
||||
|
||||
const updateContent = `-- name: UpdateContent :one
|
||||
UPDATE content
|
||||
SET value = $1, type = $2, last_edited_by = $3
|
||||
SET html_content = $1, type = $2, last_edited_by = $3
|
||||
WHERE id = $4 AND site_id = $5
|
||||
RETURNING id, site_id, value, type, created_at, updated_at, last_edited_by
|
||||
RETURNING id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
`
|
||||
|
||||
type UpdateContentParams struct {
|
||||
Value string `json:"value"`
|
||||
HtmlContent string `json:"html_content"`
|
||||
Type string `json:"type"`
|
||||
LastEditedBy string `json:"last_edited_by"`
|
||||
ID string `json:"id"`
|
||||
@@ -194,7 +211,7 @@ type UpdateContentParams struct {
|
||||
|
||||
func (q *Queries) UpdateContent(ctx context.Context, arg UpdateContentParams) (Content, error) {
|
||||
row := q.db.QueryRowContext(ctx, updateContent,
|
||||
arg.Value,
|
||||
arg.HtmlContent,
|
||||
arg.Type,
|
||||
arg.LastEditedBy,
|
||||
arg.ID,
|
||||
@@ -204,7 +221,8 @@ func (q *Queries) UpdateContent(ctx context.Context, arg UpdateContentParams) (C
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.SiteID,
|
||||
&i.Value,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
@@ -214,28 +232,30 @@ func (q *Queries) UpdateContent(ctx context.Context, arg UpdateContentParams) (C
|
||||
}
|
||||
|
||||
const upsertContent = `-- name: UpsertContent :one
|
||||
INSERT INTO content (id, site_id, value, type, last_edited_by)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
INSERT INTO content (id, site_id, html_content, original_template, type, last_edited_by)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
ON CONFLICT(id, site_id) DO UPDATE SET
|
||||
value = EXCLUDED.value,
|
||||
html_content = EXCLUDED.html_content,
|
||||
type = EXCLUDED.type,
|
||||
last_edited_by = EXCLUDED.last_edited_by
|
||||
RETURNING id, site_id, value, type, created_at, updated_at, last_edited_by
|
||||
RETURNING id, site_id, html_content, original_template, type, created_at, updated_at, last_edited_by
|
||||
`
|
||||
|
||||
type UpsertContentParams struct {
|
||||
ID string `json:"id"`
|
||||
SiteID string `json:"site_id"`
|
||||
Value string `json:"value"`
|
||||
Type string `json:"type"`
|
||||
LastEditedBy string `json:"last_edited_by"`
|
||||
ID string `json:"id"`
|
||||
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"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpsertContent(ctx context.Context, arg UpsertContentParams) (Content, error) {
|
||||
row := q.db.QueryRowContext(ctx, upsertContent,
|
||||
arg.ID,
|
||||
arg.SiteID,
|
||||
arg.Value,
|
||||
arg.HtmlContent,
|
||||
arg.OriginalTemplate,
|
||||
arg.Type,
|
||||
arg.LastEditedBy,
|
||||
)
|
||||
@@ -243,7 +263,8 @@ func (q *Queries) UpsertContent(ctx context.Context, arg UpsertContentParams) (C
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.SiteID,
|
||||
&i.Value,
|
||||
&i.HtmlContent,
|
||||
&i.OriginalTemplate,
|
||||
&i.Type,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
|
||||
Reference in New Issue
Block a user