Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1365: Behebe Warnungen im Backend #1391

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -69,11 +69,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 @@ -84,27 +84,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 @@ -127,9 +128,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 @@ -473,7 +474,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 @@ -596,5 +597,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)
daniel-va marked this conversation as resolved.
Show resolved Hide resolved
}
3 changes: 1 addition & 2 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use axum::response::IntoResponse;
use axum::{
extract::{DefaultBodyLimit, Extension},
http::{HeaderValue, Method},
Expand All @@ -10,7 +9,7 @@ use axum::{
use clap::Parser;
use hyper::header::{ACCEPT, AUTHORIZATION, CONTENT_TYPE};
use sqlx::PgPool;
use tower::{ServiceBuilder, ServiceExt};
use tower::ServiceBuilder;
use tower_http::{cors::CorsLayer, trace::TraceLayer};

pub use config::Config;
Expand Down
Loading