Add CARD asset-search by Ivanti Host ID for faster lookups

Integrate CARD's new v2 asset-search endpoint that accepts Ivanti Asset ID
integers directly, eliminating the slow suffix-guessing resolution flow.

Changes:
- Add searchByIvantiHostId() helper to cardApi.js
- Add GET /api/card/asset-search/:hostId endpoint
- Update CARD queue confirm/decline/redirect to try host_id fast path first
- Update owner-lookup to accept optional hostId query param for fast resolution
- Pass hostId through CardOwnerTooltip and ReportingPage for tooltip lookups
- Join ivanti_findings in todo queue GET to expose host_id on queue items
- Update CardActionModal to pass host_id for faster owner-lookup
This commit is contained in:
Jordan Ramos
2026-06-09 11:57:13 -06:00
parent 2396a828cc
commit a8d3909798
6 changed files with 188 additions and 22 deletions

View File

@@ -34,6 +34,7 @@ function createIvantiTodoQueueRouter() {
* - vendor {string}
* - workflow_type {string} One of: FP, Archer, CARD, GRANITE, DECOM, Remediate
* - status {string} pending | complete
* - host_id {string|null} From the linked ivanti_findings record
* - remediation_notes_count {number}
* - created_at {string}
* - updated_at {string}
@@ -41,13 +42,15 @@ function createIvantiTodoQueueRouter() {
router.get('/', requireAuth(), async (req, res) => {
try {
const { rows } = await pool.query(
`SELECT q.*, COALESCE(nc.note_count, 0) AS remediation_notes_count
`SELECT q.*, COALESCE(nc.note_count, 0) AS remediation_notes_count,
f.host_id AS host_id
FROM ivanti_todo_queue q
LEFT JOIN (
SELECT queue_item_id, COUNT(*) AS note_count
FROM queue_remediation_notes
GROUP BY queue_item_id
) nc ON nc.queue_item_id = q.id
LEFT JOIN ivanti_findings f ON f.id = q.finding_id
WHERE q.user_id = $1
ORDER BY q.vendor ASC, q.created_at ASC`,
[req.user.id]