This commit is contained in:
seb
2026-08-01 02:15:21 +02:00
parent 59c874144b
commit 69a24192d3
8 changed files with 206 additions and 0 deletions

View File

@@ -125,6 +125,16 @@ const MENU = {
label: 'addImage',
hint: 'googleAuthId, sku, avif file path → sizes',
},
{
value: 'article.deleteImage',
label: 'deleteImage',
hint: 'googleAuthId, sku, fullHash',
},
{
value: 'article.orderImages',
label: 'orderImages',
hint: 'googleAuthId, sku, comma fullHashes',
},
],
},
pic: {
@@ -458,6 +468,46 @@ async function runMethod(client, action) {
await client.article.addImage(Number(googleAuthId), sku, image),
];
}
case 'article.deleteImage': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const sku = await askText('sku', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (sku == null) return;
const fullHash = await askText('fullHash', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (fullHash == null) return;
await client.article.deleteImage(
Number(googleAuthId),
sku,
fullHash.trim(),
);
return ['ok', true];
}
case 'article.orderImages': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const sku = await askText('sku', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (sku == null) return;
const hashes = await askText('fullHashes (comma-separated)', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (hashes == null) return;
const fullHashes = hashes
.split(',')
.map((h) => h.trim())
.filter(Boolean);
return [
'result',
await client.article.orderImages(Number(googleAuthId), sku, {
fullHashes,
}),
];
}
case 'pic.getImageByHash': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;