diff --git a/source/logic/state_repository.ts b/source/logic/state_repository.ts index ffa6fc3..0fceb43 100644 --- a/source/logic/state_repository.ts +++ b/source/logic/state_repository.ts @@ -109,6 +109,27 @@ namespace _heimdall.state_repository } + /** + */ + export function get_last_notification_timestamp( + database_path : string + check_name : string + ) : Promise<(null | int)> + { + const rows : Array> = await _heimdall.helpers.sqlite.query_get( + database_path, + { + "template": "SELECT MIN(timestamp) FROM results WHERE (check_name = :check_name) AND (notification_sent = TRUE);", + "arguments": { + "check_name": check_name, + "limit": threshold, + }, + } + ); + return rows[0][0]; + } + + /** */ export async function feed(