This commit is contained in:
seb
2026-09-29 11:21:57 +02:00
parent 5d2c8fdfed
commit 7bb674d5e7
10 changed files with 123 additions and 7 deletions

View File

@@ -3,7 +3,9 @@ SELECT
id,
name,
token,
pairingpin
pairingpin,
paired_at AS pairedAt,
clientserial AS clientserial
FROM posterminal
WHERE company_id = @companyId
ORDER BY id
@@ -15,20 +17,41 @@ SELECT
company_id AS companyId,
name,
token,
pairingpin
pairingpin,
paired_at AS pairedAt,
clientserial AS clientserial
FROM posterminal
WHERE id = @id
`;
export const FIND_BY_PAIRINGPIN = `
SELECT
id,
company_id AS companyId,
name,
token,
pairingpin,
paired_at AS pairedAt,
clientserial AS clientserial
FROM posterminal
WHERE pairingpin = @pairingpin
`;
export const PAIR = `
UPDATE posterminal
SET token = @token, paired_at = @pairedAt, clientserial = @clientserial, pairingpin = ''
WHERE id = @id
`;
export const CREATE = `
INSERT INTO posterminal (company_id, name, token, pairingpin)
OUTPUT INSERTED.id, INSERTED.name, INSERTED.token, INSERTED.pairingpin
VALUES (@companyId, @name, @token, @pairingpin)
INSERT INTO posterminal (company_id, name, token, pairingpin, paired_at, clientserial)
OUTPUT INSERTED.id, INSERTED.name, INSERTED.token, INSERTED.pairingpin, INSERTED.paired_at AS pairedAt, INSERTED.clientserial AS clientserial
VALUES (@companyId, @name, @token, @pairingpin, @pairedAt, @clientserial)
`;
export const UPDATE = `
UPDATE posterminal
SET name = @name, token = @token, pairingpin = @pairingpin
SET name = @name, token = @token, pairingpin = @pairingpin, paired_at = @pairedAt, clientserial = @clientserial
WHERE id = @id AND company_id = @companyId
`;