Implement atomic collection item creation API with unified content engine approach
Updates collection creation to use database-first atomic operations for reliable collection item management. Replaces manual database calls with unified content engine methods that handle content extraction, storage, and structural template generation consistently. Key changes: - Replace manual database operations in CreateCollectionItem handler with DatabaseClient.CreateCollectionItemAtomic() - Implement unified content engine approach for API-based collection item creation - Add atomic collection item creation methods across all content clients - Enhance reconstruction to use stored structural templates with content ID hydration - Add comprehensive collection management API methods in JavaScript client - Implement collection manager UI with create, delete, and reorder functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,14 @@ type ProcessedElement struct {
|
||||
Classes []string // Element CSS classes
|
||||
}
|
||||
|
||||
// ContentEntry represents a content item to be created for collection templates
|
||||
type ContentEntry struct {
|
||||
ID string
|
||||
SiteID string
|
||||
HTMLContent string
|
||||
Template string
|
||||
}
|
||||
|
||||
// ContentClient interface for accessing content data
|
||||
// This will be implemented by database clients, HTTP clients, and mock clients
|
||||
type ContentClient interface {
|
||||
@@ -56,6 +64,7 @@ type ContentClient interface {
|
||||
GetCollectionTemplates(siteID, collectionID string) ([]CollectionTemplateItem, error)
|
||||
CreateCollectionTemplate(siteID, collectionID, name, htmlTemplate string, isDefault bool) (*CollectionTemplateItem, error)
|
||||
CreateCollectionItem(siteID, collectionID, itemID string, templateID int, htmlContent string, position int, lastEditedBy string) (*CollectionItemWithTemplate, error)
|
||||
CreateCollectionItemAtomic(siteID, collectionID string, templateID int, lastEditedBy string) (*CollectionItemWithTemplate, error)
|
||||
}
|
||||
|
||||
// ContentItem represents a piece of content from the database
|
||||
|
||||
Reference in New Issue
Block a user