Add supplier CRUD on entity with Lieferanten group and entityhistory

This commit is contained in:
seb
2026-08-06 03:56:32 +02:00
parent 561ba5bb99
commit 4f46967f28
17 changed files with 1853 additions and 1338 deletions

View File

@@ -158,6 +158,31 @@ const MENU = {
},
],
},
supplier: {
label: 'supplier',
items: [
{
value: 'supplier.list',
label: 'list',
hint: 'googleAuthId, companyId → rows',
},
{
value: 'supplier.create',
label: 'create',
hint: 'googleAuthId, companyId, name → row',
},
{
value: 'supplier.update',
label: 'update',
hint: 'googleAuthId, companyId, id, name → row',
},
{
value: 'supplier.delete',
label: 'delete',
hint: 'googleAuthId, companyId, id',
},
],
},
category: {
label: 'category',
items: [
@@ -626,6 +651,67 @@ async function runMethod(client, action) {
await client.brand.delete(Number(googleAuthId), Number(companyId), id);
return ['ok', true];
}
case 'supplier.list': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const companyId = await askInt('company id');
if (companyId == null) return;
return [
'result[]',
await client.supplier.list(Number(googleAuthId), Number(companyId)),
];
}
case 'supplier.create': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const companyId = await askInt('company id');
if (companyId == null) return;
const name = await askText('name', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (name == null) return;
return [
'result',
await client.supplier.create(Number(googleAuthId), Number(companyId), {
name,
}),
];
}
case 'supplier.update': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const companyId = await askInt('company id');
if (companyId == null) return;
const id = await askInt('supplier id');
if (id == null) return;
const name = await askText('name', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (name == null) return;
return [
'result',
await client.supplier.update(
Number(googleAuthId),
Number(companyId),
Number(id),
{ name },
),
];
}
case 'supplier.delete': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const companyId = await askInt('company id');
if (companyId == null) return;
const id = await askInt('supplier id');
if (id == null) return;
await client.supplier.delete(
Number(googleAuthId),
Number(companyId),
Number(id),
);
return ['ok', true];
}
case 'lang.create': {
const iso639 = await askText('ISO 639', {
placeholder: 'de',