Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editoast: add search criteria "ch" for operational points #4406

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions editoast/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,7 @@ components:
- ch
- schematic
- trigram
- track_sections
properties:
obj_id:
type: string
Expand All @@ -3085,6 +3086,18 @@ components:
type: string
ch:
type: string
track_sections:
type: array
items:
type: object
required:
- track
- position
properties:
track:
type: string
position:
type: integer
geographic:
$ref: "#/components/schemas/MultiPoint"
schematic:
Expand Down
3 changes: 2 additions & 1 deletion editoast/search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ operationalpoint:
obj_id: string
infra_id: integer
name: string
uic: string
uic: integer
ch: string
trigram: string
result:
joins: |
Expand Down
4 changes: 4 additions & 0 deletions front/src/common/api/osrdEditoastApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,10 @@ export type SearchOperationalPointResult = {
uic?: number;
trigram: string;
ch: string;
track_sections: {
track: string;
position: number;
}[];
geographic: MultiPoint;
schematic: MultiPoint;
};
Expand Down
39 changes: 39 additions & 0 deletions python/api/osrd_infra/migrations/0036_search_op_add_ch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by Django 4.1.5 on 2023-06-21 13:46

from django.db import migrations

from osrd_infra.migrations import run_sql_create_infra_search_table


class Migration(migrations.Migration):

dependencies = [
("osrd_infra", "0035_trainschedule_scheduled_points"),
]

operations = [
migrations.RunSQL(
sql="""
DROP TRIGGER IF EXISTS osrd_search_operationalpoint__ins_trig ON osrd_infra_operationalpointmodel;
DROP TRIGGER IF EXISTS osrd_search_operationalpoint__upd_trig ON osrd_infra_operationalpointmodel;
DROP TABLE IF EXISTS osrd_search_operationalpoint;
""",
reverse_sql="",
),
run_sql_create_infra_search_table(
name="osrd_search_operationalpoint",
source_table="osrd_infra_operationalpointmodel",
search_columns={
"name": "{source}.data#>>'{{extensions,identifier,name}}'",
},
extra_columns={
"infra_id": ("{source}.infra_id", "INT"),
"obj_id": ("{source}.obj_id", "VARCHAR(255)"),
"uic": ("({source}.data#>'{{extensions,identifier,uic}}')::integer", "INT"),
"ch": ("{source}.data->'extensions'->'sncf'->>'ch'", "TEXT"),
"trigram": ("{source}.data#>>'{{extensions,sncf,trigram}}'", "VARCHAR(3)"),
},
triggers=True,
phony_model_name="OsrdSearchOperationalPoint",
),
]