1
- mod power_restriction ;
2
- pub mod train_schedule_scenario_study_project ;
1
+ mod power_restrictions ;
2
+ mod rolling_stock_usage ;
3
3
4
4
use std:: collections:: HashMap ;
5
5
6
- use diesel:: sql_query;
7
- use diesel:: sql_types:: BigInt ;
8
6
use diesel:: ExpressionMethods ;
9
7
use diesel:: QueryDsl ;
10
8
use diesel:: SelectableHelper ;
@@ -18,11 +16,11 @@ use editoast_schemas::rolling_stock::RollingResistance;
18
16
use editoast_schemas:: rolling_stock:: RollingStock ;
19
17
use editoast_schemas:: rolling_stock:: RollingStockMetadata ;
20
18
use editoast_schemas:: rolling_stock:: RollingStockSupportedSignalingSystems ;
21
- use power_restriction :: PowerRestriction ;
19
+ use power_restrictions :: PowerRestriction ;
22
20
use serde:: Deserialize ;
23
21
use serde:: Serialize ;
24
22
use std:: sync:: Arc ;
25
- use train_schedule_scenario_study_project :: TrainScheduleScenarioStudyProject ;
23
+ pub use rolling_stock_usage :: TrainScheduleScenarioStudyProject ;
26
24
use utoipa:: ToSchema ;
27
25
use validator:: Validate ;
28
26
use validator:: ValidationError ;
@@ -31,7 +29,6 @@ use validator::ValidationErrors;
31
29
use crate :: error:: Result ;
32
30
use crate :: modelsv2:: prelude:: * ;
33
31
use crate :: modelsv2:: rolling_stock_livery:: RollingStockLiveryMetadataModel ;
34
- use crate :: modelsv2:: DbConnection ;
35
32
use crate :: modelsv2:: DbConnectionPool ;
36
33
use crate :: views:: rolling_stocks:: RollingStockWithLiveries ;
37
34
@@ -118,28 +115,6 @@ impl RollingStockModel {
118
115
. map ( |( key, _) | key. clone ( ) )
119
116
. collect ( )
120
117
}
121
-
122
- pub async fn get_power_restrictions ( conn : & mut DbConnection ) -> Result < Vec < PowerRestriction > > {
123
- let power_restrictions = sql_query ( include_str ! (
124
- "rolling_stock_model/sql/get_power_restrictions.sql"
125
- ) )
126
- . load :: < PowerRestriction > ( conn)
127
- . await ?;
128
- Ok ( power_restrictions)
129
- }
130
-
131
- pub async fn get_rolling_stock_usage (
132
- & self ,
133
- conn : & mut DbConnection ,
134
- ) -> Result < Vec < TrainScheduleScenarioStudyProject > > {
135
- let result = sql_query ( include_str ! (
136
- "rolling_stock_model/sql/get_train_schedules_with_scenario.sql"
137
- ) )
138
- . bind :: < BigInt , _ > ( self . id )
139
- . load :: < TrainScheduleScenarioStudyProject > ( conn)
140
- . await ?;
141
- Ok ( result)
142
- }
143
118
}
144
119
145
120
impl RollingStockModelChangeset {
0 commit comments