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