Skip to content

Commit 5fe1b38

Browse files
committed
editoast: add views for train schedule v2
1 parent 446c793 commit 5fe1b38

File tree

8 files changed

+989
-5
lines changed

8 files changed

+989
-5
lines changed

editoast/src/views/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub mod stdcm;
1717
pub mod study;
1818
pub mod timetable;
1919
pub mod train_schedule;
20+
pub mod v2;
2021

2122
use self::openapi::{merge_path_items, remove_discriminator, OpenApiMerger, Routes};
2223
use crate::client::get_app_version;
@@ -53,6 +54,7 @@ fn routes_v2() -> Routes<impl HttpServiceFactory> {
5354
documents::routes(),
5455
sprites::routes(),
5556
projects::routes(),
57+
v2::routes(),
5658
search::routes(),
5759
electrical_profiles::routes(),
5860
layers::routes(),
@@ -86,6 +88,7 @@ schemas! {
8688
light_rolling_stocks::schemas(),
8789
electrical_profiles::schemas(),
8890
infra::schemas(),
91+
v2::schemas(),
8992
}
9093

9194
#[derive(OpenApi)]

editoast/src/views/scenario.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ crate::schemas! {
5656
#[derive(Debug, Error, EditoastError)]
5757
#[editoast_error(base_id = "scenario")]
5858
#[allow(clippy::enum_variant_names)]
59-
enum ScenarioError {
59+
pub enum ScenarioError {
6060
/// Couldn't found the scenario with the given scenario ID
6161
6262
#[error("Scenario '{scenario_id}', could not be found")]
@@ -124,7 +124,7 @@ impl ScenarioResponse {
124124
}
125125

126126
/// Check if project and study exist given a study ID and a project ID
127-
async fn check_project_study(
127+
pub async fn check_project_study(
128128
db_pool: Data<DbPool>,
129129
project_id: i64,
130130
study_id: i64,
@@ -133,7 +133,7 @@ async fn check_project_study(
133133
check_project_study_conn(&mut conn, project_id, study_id).await
134134
}
135135

136-
async fn check_project_study_conn(
136+
pub async fn check_project_study_conn(
137137
conn: &mut PgConnection,
138138
project_id: i64,
139139
study_id: i64,

editoast/src/views/timetable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ crate::schemas! {
3737

3838
#[derive(Debug, Error, EditoastError)]
3939
#[editoast_error(base_id = "timetable")]
40-
enum TimetableError {
40+
pub enum TimetableError {
4141
#[error("Timetable '{timetable_id}', could not be found")]
4242
#[editoast_error(status = 404)]
4343
NotFound { timetable_id: i64 },

editoast/src/views/train_schedule/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub enum TrainScheduleError {
9595

9696
#[derive(IntoParams)]
9797
#[allow(unused)]
98-
struct TrainScheduleIdParam {
98+
pub struct TrainScheduleIdParam {
9999
/// A train schedule ID
100100
id: i64,
101101
}

editoast/src/views/v2/mod.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pub mod scenariov2;
2+
pub mod timetablev2;
3+
pub mod trainschedule;
4+
5+
crate::routes! {
6+
trainschedule::routes(),
7+
timetablev2::routes(),
8+
scenariov2::routes(),
9+
}
10+
11+
crate::schemas! {
12+
trainschedule::schemas(),
13+
scenariov2::schemas(),
14+
timetablev2::schemas(),
15+
}

0 commit comments

Comments
 (0)