Function: getLatestHistoryEntry()
getLatestHistoryEntry(
db
:Database
,monitorId
:string
):undefined
|StatusHistory
Defined in: electron/services/database/utils/historyQuery.ts:141
Internal
Get the most recent history entry for a monitor.
Parameters
db
Database connection instance
monitorId
string
Unique identifier of the monitor
Returns
undefined
| StatusHistory
Most recent StatusHistory object, or undefined if no entries exist
Remarks
Repository Context: Called from HistoryRepository.getLatestEntry() which handles async operations and error recovery via withDatabaseOperation().
Query Behavior: Uses ORDER BY timestamp DESC LIMIT 1 to get the most recent entry. Returns undefined for monitors with no history entries.
Throws
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error When database query fails