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 ApplicableDirections to editoast_schemas #7206

Merged
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
2 changes: 2 additions & 0 deletions editoast/editoast_schemas/src/infra.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod applicable_directions;
mod direction;
mod directional_track_range;
mod side;
Expand All @@ -6,6 +7,7 @@ mod track_offset;
mod track_range;
mod waypoint;

pub use applicable_directions::ApplicableDirections;
pub use direction::Direction;
pub use directional_track_range::DirectionalTrackRange;
pub use side::Side;
Expand Down
13 changes: 13 additions & 0 deletions editoast/editoast_schemas/src/infra/applicable_directions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use derivative::Derivative;
use serde::Deserialize;
use serde::Serialize;

#[derive(Debug, Derivative, Copy, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[derivative(Default)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum ApplicableDirections {
StartToStop,
StopToStart,
#[derivative(Default)]
Both,
}
1 change: 1 addition & 0 deletions editoast/src/converters/osm_to_railjson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ pub fn parse_osm(osm_pbf_in: PathBuf) -> Result<RailJson, Box<dyn Error + Send +

#[cfg(test)]
mod tests {
use editoast_schemas::infra::ApplicableDirections;
use std::collections::HashMap;

use super::parse_osm;
Expand Down
1 change: 1 addition & 0 deletions editoast/src/converters/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use editoast_schemas::infra::ApplicableDirections;
use editoast_schemas::infra::Direction;
use std::collections::HashMap;
use std::str::FromStr;
Expand Down
2 changes: 1 addition & 1 deletion editoast/src/generated_data/error/speed_sections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::generated_data::error::ObjectErrorGenerator;
use crate::infra_cache::Graph;
use crate::infra_cache::InfraCache;
use crate::infra_cache::ObjectCache;
use crate::schema::ApplicableDirections;
use crate::schema::InfraError;
use editoast_schemas::infra::ApplicableDirections;
use editoast_schemas::infra::Direction;
use editoast_schemas::primitives::OSRDIdentified;
use editoast_schemas::primitives::ObjectRef;
Expand Down
2 changes: 1 addition & 1 deletion editoast/src/infra_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,6 @@ pub mod tests {
use crate::infra_cache::SwitchCache;
use crate::map::BoundingBox;
use crate::modelsv2::infra::tests::test_infra_transaction;
use crate::schema::ApplicableDirections;
use crate::schema::ApplicableDirectionsTrackRange;
use crate::schema::Electrification;
use crate::schema::Endpoint;
Expand All @@ -763,6 +762,7 @@ pub mod tests {
use crate::schema::TrackEndpoint;
use editoast_common::Identifier;
use editoast_common::NonBlankString;
use editoast_schemas::infra::ApplicableDirections;
use editoast_schemas::infra::Direction;
use editoast_schemas::primitives::OSRDIdentified;

Expand Down
11 changes: 1 addition & 10 deletions editoast/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub use buffer_stop::BufferStop;
pub use buffer_stop::BufferStopCache;
pub use detector::Detector;
pub use detector::DetectorCache;
use editoast_schemas::infra::ApplicableDirections;
use editoast_schemas::infra::Direction;
use editoast_schemas::infra::Side;
use editoast_schemas::primitives::OSRDIdentified;
Expand Down Expand Up @@ -105,16 +106,6 @@ impl ApplicableDirectionsTrackRange {
}
}

#[derive(Debug, Derivative, Copy, Clone, Deserialize, Serialize, PartialEq, Eq)]
#[derivative(Default)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum ApplicableDirections {
StartToStop,
StopToStart,
#[derivative(Default)]
Both,
}

#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "UPPERCASE")]
pub enum Endpoint {
Expand Down
2 changes: 1 addition & 1 deletion editoast/src/views/infra/auto_fixes/electrifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ mod tests {
use crate::infra_cache::operation::CacheOperation;
use crate::infra_cache::operation::Operation;
use crate::infra_cache::ObjectCache;
use crate::schema::ApplicableDirections;
use crate::schema::ApplicableDirectionsTrackRange;
use crate::schema::Electrification;
use crate::schema::InfraError;
use editoast_common::Identifier;
use editoast_schemas::infra::ApplicableDirections;
use editoast_schemas::primitives::OSRDObject as _;
use editoast_schemas::primitives::ObjectRef;
use editoast_schemas::primitives::ObjectType;
Expand Down
2 changes: 1 addition & 1 deletion editoast/src/views/infra/auto_fixes/speed_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ mod tests {
use crate::infra_cache::operation::CacheOperation;
use crate::infra_cache::operation::Operation;
use crate::infra_cache::ObjectCache;
use crate::schema::ApplicableDirections;
use crate::schema::ApplicableDirectionsTrackRange;
use crate::schema::InfraError;
use crate::schema::SpeedSection;
use editoast_common::Identifier;
use editoast_schemas::infra::ApplicableDirections;
use editoast_schemas::primitives::OSRDObject as _;
use editoast_schemas::primitives::ObjectRef;
use editoast_schemas::primitives::ObjectType;
Expand Down
2 changes: 1 addition & 1 deletion editoast/src/views/pathfinding/electrifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ pub mod tests {
use crate::models::pathfinding::tests::simple_pathfinding_fixture;
use crate::modelsv2::prelude::*;
use crate::modelsv2::ElectrificationModel;
use crate::schema::ApplicableDirections;
use crate::schema::ApplicableDirectionsTrackRange;
use crate::schema::Electrification as ElectrificationSchema;
use crate::views::tests::create_test_service;
use editoast_schemas::infra::ApplicableDirections;

#[fixture]
fn simple_mode_map() -> TrackMap<String> {
Expand Down
Loading