This commit is contained in:
seb
2026-10-29 03:17:47 +01:00
parent b0521a4ea6
commit 75a83bdc28
21 changed files with 701 additions and 24 deletions

View File

@@ -10,10 +10,13 @@ SELECT
root_category_id AS rootCategoryId,
sync_root_articles AS syncRootArticles,
lastseen_at AS lastseenAt,
updated_at AS updatedAt
updated_at AS updatedAt,
sort,
enabled,
clientversion
FROM posterminal
WHERE company_id = @companyId
ORDER BY id
ORDER BY sort, id
`;
export const GET_BY_ID = `
@@ -29,7 +32,10 @@ SELECT
root_category_id AS rootCategoryId,
sync_root_articles AS syncRootArticles,
lastseen_at AS lastseenAt,
updated_at AS updatedAt
updated_at AS updatedAt,
sort,
enabled,
clientversion
FROM posterminal
WHERE id = @id
`;
@@ -47,7 +53,10 @@ SELECT
root_category_id AS rootCategoryId,
sync_root_articles AS syncRootArticles,
lastseen_at AS lastseenAt,
updated_at AS updatedAt
updated_at AS updatedAt,
sort,
enabled,
clientversion
FROM posterminal
WHERE pairingpin = @pairingpin
`;
@@ -59,17 +68,23 @@ WHERE id = @id
`;
export const CREATE = `
INSERT INTO posterminal (company_id, name, token, pairingpin, paired_at, clientserial, maxknownobituaryid, root_category_id, sync_root_articles, lastseen_at, updated_at)
OUTPUT INSERTED.id, INSERTED.name, INSERTED.token, INSERTED.pairingpin, INSERTED.paired_at AS pairedAt, INSERTED.clientserial AS clientserial, INSERTED.maxknownobituaryid AS maxknownobituaryid, INSERTED.root_category_id AS rootCategoryId, INSERTED.sync_root_articles AS syncRootArticles, INSERTED.lastseen_at AS lastseenAt, INSERTED.updated_at AS updatedAt
VALUES (@companyId, @name, @token, @pairingpin, @pairedAt, @clientserial, @maxknownobituaryid, @rootCategoryId, @syncRootArticles, @lastseenAt, SYSUTCDATETIME())
INSERT INTO posterminal (company_id, name, token, pairingpin, paired_at, clientserial, maxknownobituaryid, root_category_id, sync_root_articles, lastseen_at, sort, enabled, updated_at)
OUTPUT INSERTED.id, INSERTED.name, INSERTED.token, INSERTED.pairingpin, INSERTED.paired_at AS pairedAt, INSERTED.clientserial AS clientserial, INSERTED.maxknownobituaryid AS maxknownobituaryid, INSERTED.root_category_id AS rootCategoryId, INSERTED.sync_root_articles AS syncRootArticles, INSERTED.lastseen_at AS lastseenAt, INSERTED.updated_at AS updatedAt, INSERTED.sort, INSERTED.enabled, INSERTED.clientversion
VALUES (@companyId, @name, @token, @pairingpin, @pairedAt, @clientserial, @maxknownobituaryid, @rootCategoryId, @syncRootArticles, @lastseenAt, @sort, @enabled, SYSUTCDATETIME())
`;
export const UPDATE = `
UPDATE posterminal
SET name = @name, token = @token, pairingpin = @pairingpin, paired_at = @pairedAt, clientserial = @clientserial, maxknownobituaryid = @maxknownobituaryid, root_category_id = @rootCategoryId, sync_root_articles = @syncRootArticles, lastseen_at = @lastseenAt, updated_at = SYSUTCDATETIME()
SET name = @name, token = @token, pairingpin = @pairingpin, paired_at = @pairedAt, clientserial = @clientserial, maxknownobituaryid = @maxknownobituaryid, root_category_id = @rootCategoryId, sync_root_articles = @syncRootArticles, lastseen_at = @lastseenAt, sort = @sort, enabled = @enabled, updated_at = SYSUTCDATETIME()
WHERE id = @id AND company_id = @companyId
`;
export const SET_CLIENTVERSION = `
UPDATE posterminal
SET clientversion = @clientversion, updated_at = SYSUTCDATETIME()
WHERE id = @id
`;
export const TOUCH_LASTSEEN = `
UPDATE posterminal
SET lastseen_at = SYSUTCDATETIME()
@@ -166,7 +181,10 @@ SELECT
root_category_id AS rootCategoryId,
sync_root_articles AS syncRootArticles,
lastseen_at AS lastseenAt,
updated_at AS updatedAt
updated_at AS updatedAt,
sort,
enabled,
clientversion
FROM posterminal
WHERE token = @token
`;