Skip to content

Commit

Permalink
front: saving nge nodes
Browse files Browse the repository at this point in the history
See osrd-project/osrd-confidential#597

- adding editoast API to manage nge nodes
- refacto osrd-nge sync to use the API
- apply layout with webcola on nodes
  • Loading branch information
sim51 committed Sep 30, 2024
1 parent 2c47f6a commit 3a13325
Show file tree
Hide file tree
Showing 20 changed files with 2,221 additions and 666 deletions.
22 changes: 22 additions & 0 deletions editoast/editoast_models/src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,26 @@ diesel::table! {
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;

macro_node (id) {
id -> Int8,
scenario_id -> Int8,
position_x -> Float8,
position_y -> Float8,
#[max_length = 255]
full_name -> Nullable<Varchar>,
connection_time -> Int8,
labels -> Array<Text>,
#[max_length = 25]
trigram -> Nullable<Varchar>,
#[max_length = 255]
path_item_key -> Varchar,
}
}

diesel::table! {
use diesel::sql_types::*;
use postgis_diesel::sql_types::*;
Expand Down Expand Up @@ -731,6 +751,7 @@ diesel::joinable!(infra_object_signal -> infra (infra_id));
diesel::joinable!(infra_object_speed_section -> infra (infra_id));
diesel::joinable!(infra_object_switch -> infra (infra_id));
diesel::joinable!(infra_object_track_section -> infra (infra_id));
diesel::joinable!(macro_node -> scenario (scenario_id));
diesel::joinable!(project -> document (image_id));
diesel::joinable!(rolling_stock_livery -> document (compound_image_id));
diesel::joinable!(rolling_stock_livery -> rolling_stock (rolling_stock_id));
Expand Down Expand Up @@ -784,6 +805,7 @@ diesel::allow_tables_to_appear_in_same_query!(
infra_object_speed_section,
infra_object_switch,
infra_object_track_section,
macro_node,
project,
rolling_stock,
rolling_stock_livery,
Expand Down
1 change: 1 addition & 0 deletions editoast/migrations/20240926-113351_ngraph_nodes/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS macro_node;
15 changes: 15 additions & 0 deletions editoast/migrations/20240926-113351_ngraph_nodes/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS macro_node (
id int8 PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
scenario_id int8 NOT NULL,
position_x float8 NOT NULL,
position_y float8 NOT NULL,
full_name varchar(255),
connection_time int8 NOT NULL DEFAULT 0,
labels text[] NOT NULL,
trigram varchar(25),
path_item_key varchar(255) NOT NULL,
UNIQUE (scenario_id, path_item_key) ,
CONSTRAINT fk_scenario
FOREIGN KEY(scenario_id)
REFERENCES scenario(id)
);
Loading

0 comments on commit 3a13325

Please sign in to comment.