Skip to content

Commit 92bb348

Browse files
committed
editoast:search: add ch OP search criteria
1 parent 511d09c commit 92bb348

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed

editoast/openapi.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -3070,6 +3070,7 @@ components:
30703070
- ch
30713071
- schematic
30723072
- trigram
3073+
- track_sections
30733074
properties:
30743075
obj_id:
30753076
type: string
@@ -3083,6 +3084,18 @@ components:
30833084
type: string
30843085
ch:
30853086
type: string
3087+
track_sections:
3088+
type: array
3089+
items:
3090+
type: object
3091+
required:
3092+
- track
3093+
- position
3094+
properties:
3095+
track:
3096+
type: string
3097+
position:
3098+
type: integer
30863099
geographic:
30873100
$ref: "#/components/schemas/MultiPoint"
30883101
schematic:

editoast/search.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ operationalpoint:
55
obj_id: string
66
infra_id: integer
77
name: string
8-
uic: string
8+
uic: integer
9+
ch: string
910
trigram: string
1011
result:
1112
joins: |

front/src/common/api/osrdEditoastApi.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,10 @@ export type SearchOperationalPointResult = {
11151115
uic?: number;
11161116
trigram: string;
11171117
ch: string;
1118+
track_sections: {
1119+
track: string;
1120+
position: number;
1121+
}[];
11181122
geographic: MultiPoint;
11191123
schematic: MultiPoint;
11201124
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Generated by Django 4.1.5 on 2023-06-21 13:46
2+
3+
from django.db import migrations
4+
5+
from osrd_infra.migrations import run_sql_create_infra_search_table
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
("osrd_infra", "0035_trainschedule_scheduled_points"),
12+
]
13+
14+
operations = [
15+
migrations.RunSQL(
16+
sql="""
17+
DROP TRIGGER IF EXISTS osrd_search_operationalpoint__ins_trig ON osrd_infra_operationalpointmodel;
18+
DROP TRIGGER IF EXISTS osrd_search_operationalpoint__upd_trig ON osrd_infra_operationalpointmodel;
19+
DROP TABLE IF EXISTS osrd_search_operationalpoint;
20+
""",
21+
reverse_sql="",
22+
),
23+
run_sql_create_infra_search_table(
24+
name="osrd_search_operationalpoint",
25+
source_table="osrd_infra_operationalpointmodel",
26+
search_columns={
27+
"name": "{source}.data#>>'{{extensions,identifier,name}}'",
28+
},
29+
extra_columns={
30+
"infra_id": ("{source}.infra_id", "INT"),
31+
"obj_id": ("{source}.obj_id", "VARCHAR(255)"),
32+
"uic": ("({source}.data#>'{{extensions,identifier,uic}}')::integer", "INT"),
33+
"ch": ("{source}.data->'extensions'->'sncf'->>'ch'", "TEXT"),
34+
"trigram": ("{source}.data#>>'{{extensions,sncf,trigram}}'", "VARCHAR(3)"),
35+
},
36+
triggers=True,
37+
phony_model_name="OsrdSearchOperationalPoint",
38+
),
39+
]

0 commit comments

Comments
 (0)