[add] state_repository:get_last_notification_timestamp

This commit is contained in:
Christian Fraß 2023-06-23 13:00:39 +02:00
parent 4a1a77ba99
commit 40976759e7

View file

@ -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<Array<any>> = 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( export async function feed(