From 62a9000ec25b46b871737b8478b23a6e849f57a9 Mon Sep 17 00:00:00 2001 From: Adrien Date: Thu, 13 Apr 2023 21:13:54 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20/stop/{stop=5Fid}/destination?= =?UTF-8?q?s=20endpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/main.py b/backend/main.py index fa9b01e..ebf50be 100644 --- a/backend/main.py +++ b/backend/main.py @@ -9,8 +9,8 @@ from fastapi.staticfiles import StaticFiles from rich import print from backend.db import db -from backend.idfm_interface import IdfmInterface from backend.models import Line, Stop, StopArea +from backend.idfm_interface import Destinations as IdfmDestinations, IdfmInterface from backend.schemas import ( Line as LineSchema, TransportMode, @@ -214,3 +214,12 @@ async def get_next_passages(stop_id: str) -> NextPassagesSchema | None: ts=service_delivery.ResponseTimestamp.timestamp(), passages=by_line_by_dst_passages, ) + + +@app.get("/stop/{stop_id}/destinations") +async def get_stop_destinations( + stop_id: int, +) -> IdfmDestinations | None: + destinations = await idfm_interface.get_destinations(stop_id) + + return destinations