Complete files UI rewiring to the deployed api surface; expose mimeClass
page.tsx now calls the real backend: GET /files with groupId/name/mimeClass/ cursor/limit (origin filter dropped — the api has no origin param), shares tracked as ShareCreated (revoke by id), retention mapped to the orthogonal legalHold model, downloads by item.name, samples reshaped to the wire contract. GroupFile gains mimeClass (the indexed coarse class the row icon and the filter depend on): core contract, service row mapper, parseGroupFile guard, test fixture, UI types — one vocabulary end to end. parseGroupFile's roomId becomes null-tolerant to match direct-upload rows (mapping input stays strict). Verified: core build clean, api typecheck 0 errors + group-files 22/22, web typecheck 0 errors.
This commit is contained in:
parent
e7e703c105
commit
4bf90ffe25
6 changed files with 53 additions and 49 deletions
|
|
@ -160,6 +160,7 @@ function rowToGroupFile(row: ArchiveRow, libraryUrl: (resourceId: string) => str
|
|||
origin,
|
||||
name: row.original_name,
|
||||
mimeType: row.mime,
|
||||
mimeClass: row.mime_class as MimeClass,
|
||||
sizeBytes: safeNumber(row.byte_size),
|
||||
checksum: { algorithm: "sha256", value: row.sha256 },
|
||||
createdAt: iso(row.created_at),
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ describe("group-files runtime validation (shared contracts)", () => {
|
|||
origin: { kind: "matrix", mxcUri: "mxc://example.org/x" },
|
||||
name: "clip.mp4",
|
||||
mimeType: "video/mp4",
|
||||
mimeClass: "video",
|
||||
sizeBytes: 12,
|
||||
checksum: { algorithm: "sha256", value: hex64("z") },
|
||||
createdAt: "2026-01-02T03:04:05Z",
|
||||
|
|
|
|||
|
|
@ -216,12 +216,13 @@ export function parseGroupFile(value: unknown, field = "item"): GroupFile {
|
|||
id: stringField(value, "id", `${field}.id`),
|
||||
workspaceId: stringField(value, "workspaceId", `${field}.workspaceId`),
|
||||
groupId: stringField(value, "groupId", `${field}.groupId`),
|
||||
roomId: requireRoomId(value.roomId, `${field}.roomId`),
|
||||
roomId: value.roomId === undefined || value.roomId === null ? null : requireRoomId(value.roomId, `${field}.roomId`),
|
||||
senderId: requireMxid(value.senderId, `${field}.senderId`),
|
||||
eventId: eventId === undefined || eventId === null ? null : eventId,
|
||||
origin,
|
||||
name: stringField(value, "name", `${field}.name`),
|
||||
mimeType: stringField(value, "mimeType", `${field}.mimeType`),
|
||||
mimeClass: enumField(value, "mimeClass", MIME_CLASSES, `${field}.mimeClass`),
|
||||
sizeBytes: integerField(value, "sizeBytes", `${field}.sizeBytes`),
|
||||
checksum: { algorithm: "sha256", value: requireSha256(checksum.value, `${field}.checksum.value`) },
|
||||
createdAt: isoField(value, "createdAt", `${field}.createdAt`),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue