This commit is contained in:
seb
2026-07-31 09:09:34 +02:00
parent 84a7c6f7ef
commit 818d799f63
6 changed files with 21 additions and 38 deletions

View File

@@ -96,8 +96,7 @@ const MENU = {
label: 'category',
items: [
{ value: 'category.createUnderParent', label: 'createUnderParent', hint: 'googleAuthId, parentId, name → row' },
{ value: 'category.updateParentId', label: 'updateParentId', hint: 'id, parentId' },
{ value: 'category.delete', label: 'delete', hint: 'id' },
{ value: 'category.delete', label: 'delete', hint: 'googleAuthId, id' },
{ value: 'category.getTreeForCompany', label: 'getTreeForCompany', hint: 'googleAuthId, companyId → rows' },
],
},
@@ -320,23 +319,15 @@ async function runMethod(client, action) {
}),
];
}
case 'category.updateParentId': {
const id = await askInt('Category id');
if (id == null) return;
const parentRaw = await askText('parentId (null as empty)', {
placeholder: '',
validate: (v) =>
v?.trim() && !/^\d+$/.test(v.trim()) ? 'Integer or empty' : undefined,
});
if (parentRaw == null) return;
const parentId = parentRaw === '' ? null : Number(parentRaw);
await client.category.updateParentId(Number(id), parentId);
return ['ok', true];
}
case 'category.delete': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const id = await askInt('Category id');
if (id == null) return;
await client.category.delete(Number(id));
await client.category.delete({
googleAuthId: Number(googleAuthId),
id: Number(id),
});
return ['ok', true];
}
case 'category.getTreeForCompany': {