Skip to content

Commit

Permalink
Merge pull request #1391 from swisstopo/feature/1365-behebe-warnungen…
Browse files Browse the repository at this point in the history
…-im-backend

Feature 1365: Behebe Warnungen im Backend
  • Loading branch information
daniel-va authored Nov 26, 2024
2 parents 6fef90b + 8b2a053 commit deb570a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ jobs:
cd api
cargo fmt --check
- name: Run clippy
env:
# Treat warnings as errors
RUSTFLAGS: "-D warnings"
run: |
cd api
cargo clippy --frozen --quiet
Expand Down
33 changes: 17 additions & 16 deletions api/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ pub struct View {
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
#[allow(non_snake_case)]
#[serde(rename_all = "camelCase")]
pub struct Asset {
pub name: String,
pub key: String,
pub clampToGround: Option<bool>,
pub clamp_to_ground: Option<bool>,
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
Expand All @@ -86,27 +86,28 @@ pub struct Member {
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
#[allow(non_snake_case)]
#[serde(rename_all = "camelCase")]
pub struct Geometry {
r#type: String,
#[serde(rename = "type")]
typ: String,
positions: Vec<Cartesian3>,
id: Option<String>,
name: Option<String>,
show: Option<bool>,
area: Option<String>,
perimeter: Option<String>,
sidesLength: Option<Vec<Number>>,
numberOfSegments: Option<Number>,
sides_length: Option<Vec<Number>>,
number_of_segments: Option<Number>,
description: Option<String>,
image: Option<String>,
website: Option<String>,
pointSymbol: Option<String>,
point_symbol: Option<String>,
color: Option<CesiumColor>,
clampPoint: Option<bool>,
showSlicingBox: Option<bool>,
volumeShowed: Option<bool>,
volumeHeightLimits: Option<GeometryVolumeHeightLimits>,
swissforagesId: Option<String>,
clamp_point: Option<bool>,
show_slicing_box: Option<bool>,
volume_showed: Option<bool>,
volume_height_limits: Option<GeometryVolumeHeightLimits>,
swissforages_id: Option<String>,
depth: Option<Number>,
diameter: Option<Number>,
editable: Option<bool>,
Expand All @@ -129,9 +130,9 @@ struct CesiumColor {
}

#[derive(Serialize, Deserialize, Clone, Debug, FromRow)]
#[serde(rename_all = "camelCase")]
struct GeometryVolumeHeightLimits {
#[allow(non_snake_case)]
lowerLimit: Number,
lower_limit: Number,
height: Number,
}

Expand Down Expand Up @@ -480,7 +481,7 @@ pub async fn duplicate_project(
assets.push(Asset {
name: asset.name.clone(),
key: generated_file_name,
clampToGround: asset.clampToGround,
clamp_to_ground: asset.clamp_to_ground,
});
}
}
Expand Down Expand Up @@ -603,5 +604,5 @@ fn generate_asset_name() -> String {
.take(40)
.map(char::from)
.collect();
return format!("{}_{}.kml", Utc::now().timestamp(), rand_string);
format!("{}_{}.kml", Utc::now().timestamp(), rand_string)
}

0 comments on commit deb570a

Please sign in to comment.