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

editoast: move TrackLocation to editoast_schemas #7202

Merged
merged 1 commit into from
Apr 12, 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 editoast/editoast_schemas/src/infra.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
mod direction;
mod track_location;
mod track_offset;
mod track_range;
mod waypoint;

pub use direction::Direction;
pub use track_location::TrackLocation;
pub use track_offset::TrackOffset;
pub use track_range::TrackRange;
pub use waypoint::Waypoint;

editoast_common::schemas! {
track_offset::schemas(),
direction::schemas(),
track_location::schemas(),
}
18 changes: 18 additions & 0 deletions editoast/editoast_schemas/src/infra/track_location.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use editoast_common::Identifier;
use serde::Deserialize;
use serde::Serialize;
use utoipa::ToSchema;

editoast_common::schemas! {
TrackLocation,
}

/// A track location is a track section and an offset
#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, ToSchema)]
pub struct TrackLocation {
/// The track section UUID
#[schema(inline)]
pub track_section: Identifier,
/// The offset on the track section in meters
pub offset: f64,
}
2 changes: 1 addition & 1 deletion editoast/src/core/pathfinding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use super::Json;
use crate::models::CurveGraph;
use crate::models::RoutePath;
use crate::models::SlopeGraph;
use crate::schema::TrackLocation;
use editoast_schemas::infra::Direction;
use editoast_schemas::infra::TrackLocation;

pub type PathfindingWaypoints = Vec<Vec<Waypoint>>;

Expand Down
2 changes: 1 addition & 1 deletion editoast/src/core/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::models::RoutePath;
use crate::models::ScheduledPoint;
use crate::models::SignalSighting;
use crate::models::ZoneUpdate;
use crate::schema::TrackLocation;
use editoast_schemas::infra::TrackLocation;

editoast_common::schemas! {
SignalUpdate,
Expand Down
2 changes: 1 addition & 1 deletion editoast/src/models/pathfinding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use utoipa::ToSchema;

use crate::models::Identifiable;
use crate::schema::DirectionalTrackRange;
use crate::schema::TrackLocation;
use crate::tables::pathfinding;
use editoast_schemas::infra::Direction;
use editoast_schemas::infra::TrackLocation;

editoast_common::schemas! {
Slope,
Expand Down
11 changes: 0 additions & 11 deletions editoast/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ use editoast_common::Identifier;
use editoast_common::NonBlankString;

editoast_common::schemas! {
TrackLocation,
DirectionalTrackRange,
utils::schemas(),
editoast_schemas::schemas(),
Expand Down Expand Up @@ -229,13 +228,3 @@ pub struct Sign {
pub value: String,
pub kp: String,
}

/// A track location is a track section and an offset
#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, ToSchema)]
pub struct TrackLocation {
/// The track section UUID
#[schema(inline)]
pub track_section: Identifier,
/// The offset on the track section in meters
pub offset: f64,
}
Loading