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:
2026-07-16 20:45:56 +08:00
parent e7a0cc0b86
commit ee2c52bbc6
17 changed files with 75 additions and 46 deletions
@@ -63,7 +63,7 @@ func TestDeleteProjectEnqueuesAssetCleanupJobWhenJobQueueIsConfigured(t *testing
Status: design.StatusReady,
UpdatedAt: time.Now(),
Nodes: []design.Node{
{ID: "image-1", Type: design.NodeTypeImage, Content: "http://localhost:19000/canvas-assets/a.png", Status: "success"},
{ID: "image-1", Type: design.NodeTypeImage, Content: "http://localhost:19000/canvas-assets/a.svg", RenderContent: "http://localhost:19000/canvas-assets/a.render.webp", Status: "success"},
},
}
if err := repo.Save(ctx, project); err != nil {
@@ -78,7 +78,7 @@ func TestDeleteProjectEnqueuesAssetCleanupJobWhenJobQueueIsConfigured(t *testing
t.Fatalf("expected one cleanup job, got %#v", queue.jobs)
}
job := queue.jobs[0]
if job.Kind != design.JobAssetCleanup || len(job.PublicURLs) != 1 || job.PublicURLs[0] != "http://localhost:19000/canvas-assets/a.png" {
if job.Kind != design.JobAssetCleanup || len(job.PublicURLs) != 2 || job.PublicURLs[0] != "http://localhost:19000/canvas-assets/a.svg" || job.PublicURLs[1] != "http://localhost:19000/canvas-assets/a.render.webp" {
t.Fatalf("unexpected cleanup job: %#v", job)
}
select {