diff --git a/apps/web/src/features/settings/account/export.test.ts b/apps/web/src/features/settings/account/export.test.ts index db072c758..66d1cca3c 100644 --- a/apps/web/src/features/settings/account/export.test.ts +++ b/apps/web/src/features/settings/account/export.test.ts @@ -7,11 +7,12 @@ describe("buildAccountZip", () => { const zip = buildAccountZip({ exportedAt: "2026-09-29T00:00:00.000Z", user: { id: "u1", name: "Dana" }, + // UUIDv7 ids created seconds apart share their leading (timestamp) characters. resumes: [ - { id: "resume-aaaaaaaa-1", name: "Product Designer" }, - { id: "resume-bbbbbbbb-2", name: "Product Designer" }, + { id: "01a0ec71-03e8-77b1-a5e4-ce04be126204", name: "Product Designer" }, + { id: "01a0ec71-32c8-728b-b43b-b760a673b825", name: "Product Designer" }, ], - coverLetters: [{ id: "letter-cccccccc", name: "Lumen letter" }], + coverLetters: [{ id: "01a0ec71-a410-71da-9156-b347210cf72b", name: "Product Designer" }], applications: [{ id: "app-1", company: "Lumen", role: "Designer" }], } as never); @@ -19,9 +20,9 @@ describe("buildAccountZip", () => { expect(Object.keys(files).sort()).toEqual([ "account.json", "applications.json", - "letters/lumen-letter-letter-c.json", - "resumes/product-designer-resume-a.json", - "resumes/product-designer-resume-b.json", + "letters/product-designer-01a0ec71-a410-71da-9156-b347210cf72b.json", + "resumes/product-designer-01a0ec71-03e8-77b1-a5e4-ce04be126204.json", + "resumes/product-designer-01a0ec71-32c8-728b-b43b-b760a673b825.json", ]); expect(JSON.parse(strFromU8(files["account.json"] as Uint8Array))).toEqual({ exportedAt: "2026-09-29T00:00:00.000Z", diff --git a/apps/web/src/features/settings/account/export.ts b/apps/web/src/features/settings/account/export.ts index d7ccfb86c..b82ba6226 100644 --- a/apps/web/src/features/settings/account/export.ts +++ b/apps/web/src/features/settings/account/export.ts @@ -6,8 +6,8 @@ type AccountExport = RouterOutput["auth"]["exportData"]; const json = (value: unknown) => strToU8(`${JSON.stringify(value, null, 2)}\n`); -// The id keeps two documents with the same name apart. -const fileName = (name: string, id: string) => `${slugify(name)}-${id.slice(0, 8)}.json`; +// The whole id keeps two documents with the same name apart. Ids are UUIDv7, so a prefix is only a timestamp and repeats. +const fileName = (name: string, id: string) => `${slugify(name)}-${id}.json`; /** * "Export everything": one zip with the account, each resume and letter as its own JSON file, and the applications.