feat: add thumbnail metadata and download endpoint
- Extend `BoxFile` with thumbnail path/status fields and internal URL - Populate `ThumbnailURL` when a thumbnail path is present during decoration - Add `/box/:id/thumbnails/:file_id` route and handler to serve JPEG thumbnails - Introduce thumbnail status constants to standardize processing state reportingfeat: add thumbnail metadata and download endpoint - Extend `BoxFile` with thumbnail path/status fields and internal URL - Populate `ThumbnailURL` when a thumbnail path is present during decoration - Add `/box/:id/thumbnails/:file_id` route and handler to serve JPEG thumbnails - Introduce thumbnail status constants to standardize processing state reporting
This commit is contained in:
44
lib/boxstore/store_test.go
Normal file
44
lib/boxstore/store_test.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package boxstore
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"warpbox/lib/models"
|
||||
)
|
||||
|
||||
func TestStartRetentionWaitsForEveryFileToFinish(t *testing.T) {
|
||||
manifest := models.BoxManifest{
|
||||
RetentionSecs: 10,
|
||||
Files: []models.BoxFile{
|
||||
{ID: "one", Status: models.FileStatusReady},
|
||||
{ID: "two", Status: models.FileStatusWork},
|
||||
},
|
||||
}
|
||||
|
||||
startRetentionIfTerminalUnlocked(&manifest)
|
||||
|
||||
if !manifest.ExpiresAt.IsZero() {
|
||||
t.Fatalf("expected retention to stay unset while a file is still uploading, got %s", manifest.ExpiresAt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStartRetentionBeginsWhenEveryFileIsTerminal(t *testing.T) {
|
||||
manifest := models.BoxManifest{
|
||||
RetentionSecs: 10,
|
||||
Files: []models.BoxFile{
|
||||
{ID: "one", Status: models.FileStatusReady},
|
||||
{ID: "two", Status: models.FileStatusFailed},
|
||||
},
|
||||
}
|
||||
before := time.Now().UTC()
|
||||
|
||||
startRetentionIfTerminalUnlocked(&manifest)
|
||||
|
||||
if manifest.ExpiresAt.IsZero() {
|
||||
t.Fatal("expected retention to start once every file is complete or failed")
|
||||
}
|
||||
if manifest.ExpiresAt.Before(before.Add(9 * time.Second)) {
|
||||
t.Fatalf("expected retention to start from completion time, got %s", manifest.ExpiresAt)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user