This commit is contained in:
seb
2026-10-31 20:28:39 +01:00
parent c7d1b1a5d2
commit f612c87b6e
25 changed files with 757 additions and 40 deletions

View File

@@ -36,7 +36,7 @@ export default function update(provider) {
if (!Number.isInteger(id) || id <= 0) {
throw new Error('Printeragent not found');
}
if (input.name === undefined && input.sort === undefined) {
if (input.name === undefined && input.sort === undefined && input.enabled === undefined) {
throw new Error('Invalid printeragent');
}
if (input.name !== undefined && (typeof input.name !== 'string' || !input.name.trim())) {
@@ -45,6 +45,9 @@ export default function update(provider) {
if (input.sort !== undefined && !Number.isInteger(input.sort)) {
throw new Error('Invalid printeragent');
}
if (input.enabled !== undefined && typeof input.enabled !== 'boolean') {
throw new Error('Invalid printeragent');
}
const runner = makeRunner(provider, tx);
const { companyId } = await access(googleAuthId, runner);
@@ -59,6 +62,7 @@ export default function update(provider) {
companyId,
name: input.name !== undefined ? input.name.trim() : existing.rows[0].name,
sort: input.sort !== undefined ? input.sort : existing.rows[0].sort,
enabled: input.enabled !== undefined ? (input.enabled ? 1 : 0) : existing.rows[0].enabled,
});
const row = await runner.query(getSql, { id, companyId });