Skip to content

Commit

Permalink
include purged entities in the response
Browse files Browse the repository at this point in the history
  • Loading branch information
sadiqkhoja committed Jan 6, 2025
1 parent 797233b commit 88b3042
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/model/query/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,17 @@ const idFilter = (options) => {
const _getAllEntitiesState = (datasetId, options) => sql`
SELECT uuid, "deletedAt" IS NOT NULL as deleted
FROM entities
WHERE "datasetId" = ${datasetId} AND ${idFilter(options)}
-- union with purged
WHERE "datasetId" = ${datasetId}
AND ${idFilter(options)}
UNION
SELECT uuid, deleted FROM (
SELECT jsonb_array_elements_text(details -> 'entityUuids') AS uuid, TRUE as deleted
FROM audits
JOIN datasets ON datasets."acteeId" = audits."acteeId"
WHERE action = 'entities.purge'
AND datasets.id = ${datasetId}
) purged
WHERE ${idFilter(options)}
-- union with not approved
`;

Expand Down

0 comments on commit 88b3042

Please sign in to comment.