Skip to content

Commit

Permalink
editoast: move TrackLocation to editoast_schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
hamz2a committed Apr 12, 2024
1 parent 6289b27 commit 4d9ddda
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
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,
}

0 comments on commit 4d9ddda

Please sign in to comment.