This commit is contained in:
2026-05-05 05:03:11 +02:00
parent 3e994995d7
commit f2c227e08f
132 changed files with 5767 additions and 4461 deletions

View File

@@ -30,7 +30,7 @@ impl KbKnownHttpEndpointDto {
enabled: bool,
roles: std::vec::Vec<std::string::String>,
) -> Self {
Self {
return Self {
name,
provider,
url,
@@ -38,7 +38,7 @@ impl KbKnownHttpEndpointDto {
roles,
last_seen_at: None,
updated_at: chrono::Utc::now(),
}
};
}
}
@@ -55,7 +55,7 @@ impl TryFrom<crate::KbKnownHttpEndpointEntity> for KbKnownHttpEndpointDto {
"cannot parse known http endpoint roles_json '{}': {}",
entity.roles_json, error
)));
}
},
};
let updated_at_result = chrono::DateTime::parse_from_rfc3339(&entity.updated_at);
let updated_at = match updated_at_result {
@@ -65,7 +65,7 @@ impl TryFrom<crate::KbKnownHttpEndpointEntity> for KbKnownHttpEndpointDto {
"cannot parse known http endpoint updated_at '{}': {}",
entity.updated_at, error
)));
}
},
};
let last_seen_at = match entity.last_seen_at {
Some(last_seen_at_text) => {
@@ -77,12 +77,12 @@ impl TryFrom<crate::KbKnownHttpEndpointEntity> for KbKnownHttpEndpointDto {
"cannot parse known http endpoint last_seen_at '{}': {}",
last_seen_at_text, error
)));
}
},
}
}
},
None => None,
};
Ok(Self {
return Ok(Self {
name: entity.name,
provider: entity.provider,
url: entity.url,
@@ -90,7 +90,7 @@ impl TryFrom<crate::KbKnownHttpEndpointEntity> for KbKnownHttpEndpointDto {
roles,
last_seen_at,
updated_at,
})
});
}
}
@@ -106,16 +106,16 @@ impl TryFrom<KbKnownHttpEndpointDto> for crate::KbKnownHttpEndpointEntity {
"cannot serialize known http endpoint roles: {}",
error
)));
}
},
};
Ok(Self {
return Ok(Self {
name: dto.name,
provider: dto.provider,
url: dto.url,
enabled: if dto.enabled { 1 } else { 0 },
roles_json,
last_seen_at: dto.last_seen_at.map(|value| value.to_rfc3339()),
last_seen_at: dto.last_seen_at.map(|value| return value.to_rfc3339()),
updated_at: dto.updated_at.to_rfc3339(),
})
});
}
}