SCRAPE-8: Implement markStaleUnits() #13

Merged
stephen merged 1 commits from scraper/mark-stale into dev 2026-02-05 23:48:57 -07:00

1 Commits

Author SHA1 Message Date
6eaf79f662 SCRAPE-8: Implement markStaleUnits() to flag unavailable units
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (pull_request) Successful in 13s
CI/CD Pipeline - Apartment API / Run Linting (pull_request) Successful in 9m37s
CI/CD Pipeline - Apartment API / Run Tests (pull_request) Successful in 9m47s
CI/CD Pipeline - Apartment API / Send Webhook Notification (pull_request) Successful in 2s
CI/CD Pipeline - Apartment API / Build & Push Image (pull_request) Has been skipped
CI/CD Pipeline - Apartment API / Deploy to Production (pull_request) Has been skipped
Add markStaleUnits() that marks units as unavailable when they are not
present in the current scrape results. Uses MongoDB updateMany with a
$nin filter on unit_code to efficiently update only units that were
previously available but no longer appear in the scraped data. Sets
available to false and records marked_stale_date.

Includes 18 tests covering filter criteria, $set fields, already
unavailable units, empty currentUnitCodes, error handling, logging,
and return value verification.
2026-02-05 23:37:41 -07:00