This commit is contained in:
seb
2026-10-30 16:56:28 +01:00
parent 211acd651d
commit 60cf5873cd
11 changed files with 70 additions and 38 deletions

View File

@@ -10,7 +10,8 @@ export const PRINTERAGENT_COLUMNS = `
clientstate,
agentversion,
lastseen_at AS lastseenAt,
updated_at AS updatedAt
updated_at AS updatedAt,
sort
`;
export const LIST_BY_COMPANY = `
@@ -18,7 +19,7 @@ SELECT
${PRINTERAGENT_COLUMNS}
FROM printeragent
WHERE company_id = @companyId
ORDER BY name, id
ORDER BY sort, id
`;
export const GET_BY_COMPANY_AND_ID = `
@@ -29,7 +30,7 @@ WHERE id = @id AND company_id = @companyId
`;
export const CREATE = `
INSERT INTO printeragent (company_id, name, pairingpin)
INSERT INTO printeragent (company_id, name, pairingpin, sort)
OUTPUT
INSERTED.id,
INSERTED.company_id AS companyId,
@@ -42,13 +43,14 @@ OUTPUT
INSERTED.clientstate,
INSERTED.agentversion,
INSERTED.lastseen_at AS lastseenAt,
INSERTED.updated_at AS updatedAt
VALUES (@companyId, @name, @pairingpin)
INSERTED.updated_at AS updatedAt,
INSERTED.sort
VALUES (@companyId, @name, @pairingpin, @sort)
`;
export const UPDATE_NAME = `
export const UPDATE = `
UPDATE printeragent
SET name = @name, updated_at = SYSUTCDATETIME()
SET name = @name, sort = @sort, updated_at = SYSUTCDATETIME()
WHERE id = @id AND company_id = @companyId
`;