Skip to content

Commit

Permalink
editoast: harmonize comfort type
Browse files Browse the repository at this point in the history
  • Loading branch information
younesschrifi committed Aug 21, 2024
1 parent 9eb267b commit 2d9ca2b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
1 change: 0 additions & 1 deletion editoast/editoast_schemas/src/rolling_stock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub use effort_curves::EffortCurve;
pub use effort_curves::EffortCurveConditions;
pub use effort_curves::EffortCurves;
pub use effort_curves::ModeEffortCurves;
pub use effort_curves::RollingStockComfortType;

mod rolling_resistance;
pub use rolling_resistance::RollingResistance;
Expand Down
19 changes: 3 additions & 16 deletions editoast/editoast_schemas/src/rolling_stock/effort_curves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ use serde::Deserialize;
use serde::Deserializer;
use serde::Serialize;
use std::collections::BTreeMap;
use strum::Display;
use strum::EnumString;
use utoipa::ToSchema;

use crate::train_schedule::Comfort;

editoast_common::schemas! {
ConditionalEffortCurve,
EffortCurve,
EffortCurves,
EffortCurveConditions,
ModeEffortCurves,
RollingStockComfortType,
}

#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize, ToSchema, Hash)]
Expand Down Expand Up @@ -52,25 +51,13 @@ pub struct ConditionalEffortCurve {
#[serde(deny_unknown_fields)]
pub struct EffortCurveConditions {
#[schema(required)]
comfort: Option<RollingStockComfortType>,
comfort: Option<Comfort>,
#[schema(required)]
electrical_profile_level: Option<String>,
#[schema(required)]
power_restriction_code: Option<String>,
}

/// Train comfort that will be used for the simulation
#[derive(
Display, Clone, Default, Debug, EnumString, PartialEq, Deserialize, Serialize, ToSchema, Hash,
)]
#[strum(serialize_all = "UPPERCASE")]
#[serde(rename_all = "UPPERCASE")]
pub enum RollingStockComfortType {
#[default]
Standard,
AC,
Heating,
}

#[derive(Clone, Debug, PartialEq, Serialize, ToSchema, Derivative)]
#[derivative(Hash)]
Expand Down
9 changes: 1 addition & 8 deletions editoast/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5081,7 +5081,7 @@ components:
properties:
comfort:
allOf:
- $ref: '#/components/schemas/RollingStockComfortType'
- $ref: '#/components/schemas/Comfort'
nullable: true
electrical_profile_level:
type: string
Expand Down Expand Up @@ -7680,13 +7680,6 @@ components:
version:
type: integer
format: int64
RollingStockComfortType:
type: string
description: Train comfort that will be used for the simulation
enum:
- STANDARD
- AC
- HEATING
RollingStockError:
oneOf:
- type: string
Expand Down
5 changes: 2 additions & 3 deletions front/src/common/api/generatedEditoastApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2290,9 +2290,9 @@ export type StudyPatchForm = {
study_type?: string | null;
tags?: Tags | null;
};
export type RollingStockComfortType = 'STANDARD' | 'AC' | 'HEATING';
export type Comfort = 'STANDARD' | 'AIR_CONDITIONING' | 'HEATING';
export type EffortCurveConditions = {
comfort: RollingStockComfortType | null;
comfort: Comfort | null;
electrical_profile_level: string | null;
power_restriction_code: string | null;
};
Expand Down Expand Up @@ -2818,7 +2818,6 @@ export type SimulationResponse =
core_error: InternalError;
status: 'simulation_failed';
};
export type Comfort = 'STANDARD' | 'AIR_CONDITIONING' | 'HEATING';
export type StepTimingData = {
/** Time at which the train should arrive at the location */
arrival_time: string;
Expand Down

0 comments on commit 2d9ca2b

Please sign in to comment.