test: fix raw upload assertions

This commit is contained in:
root
2026-10-17 09:57:43 +08:00
parent f24088f359
commit 10fa64b5c8
17 changed files with 150 additions and 56 deletions
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import {
attachmentAdd, attachmentDelete, attachmentList,
attachmentDelete, attachmentList, attachmentUploadRaw,
footprintGet, footprintList, footprintUpsert, listDimensions, listTaxonomy, listTypes
} from '@/lib/api';
import { AttachmentPreview } from '@/components/common/AttachmentPreview';
@@ -157,7 +157,7 @@ export function RecordEditorDialog({ open, onClose, footprintId, onSaved }: {
};
const saved = await footprintUpsert(input);
for (const p of pendingAtts) {
await attachmentAdd({ owner_id: saved.id, file_name: p.file_name, mime: p.mime, size: p.size, data_b64: p.data_b64, thumb_b64: p.thumb_b64 });
await attachmentUploadRaw(saved.id, p.file, p.thumb_b64);
}
return saved.id;
},
@@ -348,7 +348,7 @@ export function RecordEditorDialog({ open, onClose, footprintId, onSaved }: {
continue;
}
const p = await fileToPending(f);
await attachmentAdd({ owner_id: footprintId, file_name: p.file_name, mime: p.mime, size: p.size, data_b64: p.data_b64, thumb_b64: p.thumb_b64 });
await attachmentUploadRaw(footprintId, p.file, p.thumb_b64);
done++;
}
if (done > 0) {