feat(server): persist renderContent texture and cover it in asset lifecycle
Add an optional renderContent field to canvas nodes across the go-zero API type, domain node, SQLC models/queries, PostgreSQL schema, and mappers so a lightweight transparent-WebP display texture persists alongside the original content. Prefer renderContent for project thumbnails and main-canvas previews, and treat both content and renderContent as protected/deletable asset URLs during canvas asset cleanup. Extend round-trip coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,13 +23,14 @@ func TestProjectThumbnailUsesCanvasPreview(t *testing.T) {
|
||||
Status: "success",
|
||||
},
|
||||
{
|
||||
ID: "main",
|
||||
Type: design.NodeTypeImage,
|
||||
Title: "Main",
|
||||
Content: "http://localhost:19000/canvas-assets/main.png",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
Status: "success",
|
||||
ID: "main",
|
||||
Type: design.NodeTypeImage,
|
||||
Title: "Main",
|
||||
Content: "http://localhost:19000/canvas-assets/main.svg",
|
||||
RenderContent: "http://localhost:19000/canvas-assets/main.render.webp",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
Status: "success",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -49,7 +50,7 @@ func TestProjectThumbnailUsesCanvasPreview(t *testing.T) {
|
||||
if len(preview.Nodes) != 2 {
|
||||
t.Fatalf("expected two preview nodes, got %#v", preview.Nodes)
|
||||
}
|
||||
if preview.Nodes[1].Content != "http://localhost:19000/canvas-assets/main.png" {
|
||||
if preview.Nodes[1].Content != "http://localhost:19000/canvas-assets/main.svg" || preview.Nodes[1].RenderContent != "http://localhost:19000/canvas-assets/main.render.webp" {
|
||||
t.Fatalf("expected generated image in canvas preview, got %#v", preview.Nodes[1])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user