Tweaks to database for users

This commit is contained in:
2025-04-23 19:49:44 -04:00
parent 3b5514e825
commit ebc1f30f24
5 changed files with 32 additions and 14 deletions

View File

@@ -489,8 +489,6 @@ impl Airport {
airport.into()
})
.collect();
Runway::insert_all(&all_runway_rows).await?;
Frequency::insert_all(&all_frequency_rows).await?;
for chunk in airport_rows.chunks(chunk_size) {
let mut query_builder: QueryBuilder<Postgres> = QueryBuilder::new(
@@ -519,6 +517,9 @@ impl Airport {
query.execute(pool).await?;
}
Runway::insert_all(&all_runway_rows).await?;
Frequency::insert_all(&all_frequency_rows).await?;
Ok(())
}
@@ -577,7 +578,7 @@ impl Airport {
column: &str,
field: &'a Option<String>,
) {
if let Some(ref value_str) = field {
if let Some(value_str) = field {
// Split on commas, trim whitespace, and drop empties.
let values: Vec<&str> = value_str
.split(',')
@@ -606,7 +607,7 @@ impl Airport {
field: &'a Option<String>,
) {
// Query column like
if let Some(ref value) = field {
if let Some(value) = field {
if !*has_where {
builder.push(" WHERE ");
*has_where = true;
@@ -627,7 +628,7 @@ impl Airport {
field: &'a Option<String>,
) -> ApiResult<()> {
// Query bounds
if let Some(ref bounds_string) = field {
if let Some(bounds_string) = field {
if !*has_where {
builder.push(" WHERE ");
*has_where = true;