composite & deleted

This commit is contained in:
seb
2026-07-12 20:39:01 +02:00
parent 3ca6e894ab
commit ca190b2832
17 changed files with 571 additions and 11 deletions

View File

@@ -0,0 +1,26 @@
import sql from 'mssql';
import { getPool } from '../db.js';
const DELETED_ENTITY_LIST_SQL = `
SELECT TOP (@limit)
vDeletedEntity.kEntityId,
vDeletedEntity.nEntityType,
CONVERT(BIGINT, vDeletedEntity.bLastChanged) AS lastChanged
FROM Pos.vDeletedEntity
WHERE CONVERT(BIGINT, vDeletedEntity.bLastChanged) > @cursor
ORDER BY lastChanged ASC;
`;
export async function getDeletedEntityList({ cursor = 0, limit = 600 } = {}) {
const result = await getPool()
.request()
.input('cursor', sql.BigInt, cursor)
.input('limit', sql.Int, limit)
.query(DELETED_ENTITY_LIST_SQL);
return result.recordset.map((row) => ({
entityId: String(row.kEntityId),
entityType: String(row.nEntityType),
lastChanged: String(row.lastChanged),
}));
}