composite & deleted
This commit is contained in:
26
src/queries/deleted-entity-list.js
Normal file
26
src/queries/deleted-entity-list.js
Normal 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),
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user