feat: complete inventory image and sales workflows
Quality / test (push) Canceled after 0s

Commit the working vertical slices for inventory image processing and the Sale workflow, including Sale history, audited voiding, multi-item persistence, admin UI, migrations, documentation, and tests.
This commit is contained in:
2026-09-09 00:35:57 -04:00
parent ea145191df
commit 8e5ce80196
32 changed files with 1092 additions and 226 deletions
@@ -7,6 +7,7 @@ import {
retryImageProcessing,
setPrimaryImage,
updateImageAltText,
uploadAdminImage,
} from '@/services/admin-image-service.js';
function csrfToken() {
@@ -35,12 +36,30 @@ export function useAdminImages(inventoryItemId) {
finally { isSaving.value = false; }
}
async function upload(file) {
const objectUrl = URL.createObjectURL(file);
const image = new Image();
image.src = objectUrl;
try {
await image.decode();
await apply((token) => uploadAdminImage(inventoryItemId, file, {
width: image.naturalWidth,
height: image.naturalHeight,
altText: file.name,
isPrimary: images.value.length === 0,
}, token));
} finally {
URL.revokeObjectURL(objectUrl);
}
}
return {
images,
isLoading,
isSaving,
error,
load,
upload,
reorder: (imageId, sortOrder) => apply((token) => reorderImage(imageId, sortOrder, token)),
setPrimary: (imageId) => apply((token) => setPrimaryImage(imageId, token)),
updateAltText: (imageId, altText) => apply((token) => updateImageAltText(imageId, altText, token)),