Skip to content

Commit 8280844

Browse files
committed
editoast:search: add ch OP search criteria
1 parent 6328186 commit 8280844

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
@@ -3072,6 +3072,7 @@ components:
30723072
- ch
30733073
- schematic
30743074
- trigram
3075+
- track_sections
30753076
properties:
30763077
obj_id:
30773078
type: string
@@ -3085,6 +3086,18 @@ components:
30853086
type: string
30863087
ch:
30873088
type: string
3089+
track_sections:
3090+
type: array
3091+
items:
3092+
type: object
3093+
required:
3094+
- track
3095+
- position
3096+
properties:
3097+
track:
3098+
type: string
3099+
position:
3100+
type: integer
30883101
geographic:
30893102
$ref: "#/components/schemas/MultiPoint"
30903103
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
@@ -1228,6 +1228,10 @@ export type SearchOperationalPointResult = {
12281228
uic?: number;
12291229
trigram: string;
12301230
ch: string;
1231+
track_sections: {
1232+
track: string;
1233+
position: number;
1234+
}[];
12311235
geographic: MultiPoint;
12321236
schematic: MultiPoint;
12331237
};
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)