Fix IP reporting and update the row
Some checks failed
Build IP lists / Build scanners list (binaryedge) (push) Failing after -2m8s
Build IP lists / Build scanners list (stretchoid) (push) Failing after -2m10s
Build IP lists / build-aws-cloudfront (push) Failing after -2m10s

This commit is contained in:
2024-09-23 00:06:03 +02:00
parent d6757902f6
commit e48493cf6a
2 changed files with 93 additions and 36 deletions

View File

@ -22,6 +22,22 @@ pub struct Scanner {
}
impl Scanner {
pub fn find(
ip_address: String,
ip_type: u8,
conn: &mut MysqlConnection,
) -> Result<Option<Scanner>, DieselError> {
use crate::schema::scanners;
scanners
.select(Scanner::as_select())
.filter(scanners::ip.eq(ip_address))
.filter(scanners::ip_type.eq(ip_type))
.order((scanners::ip_type.desc(), scanners::created_at.desc()))
.first(conn)
.optional()
}
pub fn list_names(
scanner_name: Scanners,
conn: &mut MysqlConnection,