From c7db2262b0a119220f408b130887d8033e823446 Mon Sep 17 00:00:00 2001 From: seb Date: Thu, 29 Oct 2026 03:29:07 +0100 Subject: [PATCH] u --- src/store/posterminal/upsert.js | 2 +- test/migration.test.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/store/posterminal/upsert.js b/src/store/posterminal/upsert.js index 4247ce3..b7fd202 100644 --- a/src/store/posterminal/upsert.js +++ b/src/store/posterminal/upsert.js @@ -76,7 +76,7 @@ export default function upsert(provider) { const sort = input.sort !== undefined ? input.sort : existing.rows[0].sort; const enabled = input.enabled !== undefined ? (input.enabled ? 1 : 0) : (existing.rows[0].enabled ? 1 : 0); - const clientversion = input.clientversion !== undefined ? (input.clientversion ? String(input.clientversion).trim() : null) : (existing.rows[0].clientversion ?? null); + const clientversion = existing.rows[0].clientversion ?? null; const pairingpin = input.pairingpin !== undefined diff --git a/test/migration.test.js b/test/migration.test.js index 80b72ca..06f3aa1 100644 --- a/test/migration.test.js +++ b/test/migration.test.js @@ -62,16 +62,15 @@ test('schema migrations & posterminal version 2', async (t) => { assert.equal(list[0].enabled, 1); assert.equal(list[0].clientversion, '2.1.0'); - // patch update + // patch update (clientversion is not updated via upsert; existing value is preserved) const updated = await store.posterminal.upsert(tenant.googleAuthId, { id: terminalId, sort: 10, enabled: false, - clientversion: '2.2.0', }); assert.equal(updated.sort, 10); assert.equal(updated.enabled, 0); - assert.equal(updated.clientversion, '2.2.0'); + assert.equal(updated.clientversion, '2.1.0'); // pair with clientversion const paired = await store.posterminal.pair(terminalId, {