u
This commit is contained in:
@@ -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': {
|
||||
|
||||
Reference in New Issue
Block a user