Files
apartment-dashboard-api/services
Stephen Minakian 406672c16b
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (pull_request) Successful in 13s
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 / Run Linting (pull_request) Successful in 9m37s
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
Implement insertPrices() bulk operation for daily price records
Add insertPrices() to scraperService that performs bulk upsert of
daily unit price records to the prices collection. Key behaviors:

- Uses bulkWrite with updateOne/upsert ops for atomic batch writes
- Compound key (unit_code + date_checked) ensures idempotent re-runs
- Filters out units with null prices before writing
- Stores price, last_updated, and data_source fields per record
- Uses ordered:false for parallel write performance
- Logs warnings for empty/all-null input without hitting the database
- Propagates bulkWrite errors with detailed logging

Includes 30 tests covering filtering, upsert behavior, composite key
logic, field validation, idempotency, error handling, and logging.
2026-02-05 22:20:33 -07:00
..