refactor(media): use asset-centric storage key layout

This commit is contained in:
2026-02-12 18:41:01 +01:00
parent 86a8af25d8
commit 3e4f0b6c75
12 changed files with 218 additions and 27 deletions

View File

@@ -0,0 +1,19 @@
import { describe, expect, it } from "vitest"
import { buildMediaStorageKey } from "@/lib/media/storage-key"
describe("buildMediaStorageKey", () => {
it("builds asset-centric key with fileRole and variant", () => {
const key = buildMediaStorageKey({
tenantId: "default",
assetId: "550e8400-e29b-41d4-a716-446655440000",
fileRole: "original",
variant: "thumb",
fileName: "My File.PNG",
})
expect(key).toBe(
"tenant/default/asset/550e8400-e29b-41d4-a716-446655440000/original/550e8400-e29b-41d4-a716-446655440000__thumb.png",
)
})
})