Skip to main content

Function: findHistoryByMonitorId()

findHistoryByMonitorId(db: Database, monitorId: string): StatusHistory[]

Defined in: electron/services/database/utils/historyQuery.ts:64

Internal

Find all history entries for a specific monitor.

Parameters

db

Database

Database connection instance

monitorId

string

Unique identifier of the monitor

Returns

StatusHistory[]

Array of StatusHistory objects ordered by timestamp (newest first)

Remarks

Repository Context: Designed to be called from HistoryRepository.findByMonitorId() which handles async operations and error recovery via withDatabaseOperation().

Query Performance: Uses indexed monitor_id field with timestamp ordering for efficiency. Results are ordered by timestamp DESC to show most recent entries first.

Throws

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error When database query fails