diff --git a/editoast/editoast_schemas/src/infra/operational_point.rs b/editoast/editoast_schemas/src/infra/operational_point.rs index d9f9a84033e..449086b329c 100644 --- a/editoast/editoast_schemas/src/infra/operational_point.rs +++ b/editoast/editoast_schemas/src/infra/operational_point.rs @@ -26,7 +26,7 @@ pub struct OperationalPoint { #[schema(inline)] pub extensions: OperationalPointExtensions, #[serde(default)] - pub weight: Option, + pub weight: Option, } #[derive(Debug, Derivative, Clone, Deserialize, Serialize, ToSchema)] diff --git a/editoast/migrations/2024-11-19-143456_add_weight_to_operational_point/down.sql b/editoast/migrations/2024-11-19-143456_add_weight_to_operational_point/down.sql new file mode 100644 index 00000000000..e7cc26340d8 --- /dev/null +++ b/editoast/migrations/2024-11-19-143456_add_weight_to_operational_point/down.sql @@ -0,0 +1,9 @@ +UPDATE infra_object_operational_point +SET data = data - 'weight'; + +UPDATE infra +SET railjson_version = '3.4.12'; + +ALTER TABLE infra +ALTER COLUMN railjson_version +SET DEFAULT '3.4.12'; diff --git a/editoast/migrations/2024-11-19-143456_add_weight_to_operational_point/up.sql b/editoast/migrations/2024-11-19-143456_add_weight_to_operational_point/up.sql new file mode 100644 index 00000000000..b0c5fe53915 --- /dev/null +++ b/editoast/migrations/2024-11-19-143456_add_weight_to_operational_point/up.sql @@ -0,0 +1,14 @@ +UPDATE infra_object_operational_point +SET data = jsonb_set( + data, + '{weight}', + 'null'::jsonb, + true +); + +UPDATE infra +SET railjson_version = '3.4.13'; + +ALTER TABLE infra +ALTER COLUMN railjson_version +SET DEFAULT '3.4.13'; diff --git a/editoast/openapi.yaml b/editoast/openapi.yaml index 64979c67117..10590c6a898 100644 --- a/editoast/openapi.yaml +++ b/editoast/openapi.yaml @@ -7008,6 +7008,11 @@ components: type: array items: $ref: '#/components/schemas/OperationalPointPart' + weight: + type: integer + format: int32 + nullable: true + minimum: 0 additionalProperties: false OperationalPointExtensions: type: object diff --git a/front/src/common/api/generatedEditoastApi.ts b/front/src/common/api/generatedEditoastApi.ts index 46c08776cb4..b7a77a93035 100644 --- a/front/src/common/api/generatedEditoastApi.ts +++ b/front/src/common/api/generatedEditoastApi.ts @@ -1887,6 +1887,7 @@ export type OperationalPoint = { }; id: string; parts: OperationalPointPart[]; + weight?: number | null; }; export type Waypoint = | {