Appearance
Temp & promote
Version: 1.6
Date: 2026-11-26
Status: Working baseline
Temp (BF-001)
- Authorize caller
- Validate ext/MIME/size (defaults OPEN)
- Mint
tmp_id+storage_name({uuidv7}.{ext}) - Insert
temp_uploads(+ optionalworkspace_id) - Ghi
{FS_TEMP_ROOT}/{storage_name} - Trả
tmp_idkhiready
TTL: created_at + parse(temp.ttl) — không cột expires_at.
GC temp: E.03.
Promote (BF-002)
- Authorize + load temp; kiểm TTL
- Mint
file_id; giữstorage_name; buildstorage_key - Move bytes temp →
{FS_LOCAL_ROOT}/{storage_key} - Nếu video (DEC-014/015): thử ffmpeg cover theo
video.cover.*(random seek + max attempts); success → ghi cover + setcover_storage_name; fail hết retry → vẫn promote,cover_storage_name= null (Q-BR-057) - Insert
files(storage_tier=local, copyworkspace_id;cover_storage_namenullable) - Đánh dấu temp
status=promoted+promoted_file_id— giữ row (Q-BR-034 CONFIRMED Owner 2026-11-26); không DELETE lúc promote - Response đồng bộ tối thiểu gồm
file_id— không API cover riêng
Không chạy migrate trong request promote. Job local→cloud chỉ chạy sau (async, lifecycle.migrate.schedule) — xem E.03.
OPEN: cùng uploader? (Q-BR-012).
Q-BR-034 CONFIRMED: giữ temp sau promote (promoted + promoted_file_id); GC hết hạn (TTL) sẽ DELETE — xem E.03.