mirror of
https://github.com/Crocmagnon/lyon-transports.git
synced 2024-12-04 19:53:42 +01:00
add test stop
This commit is contained in:
parent
9192140405
commit
b16b3a36b0
1 changed files with 25 additions and 0 deletions
25
main.go
25
main.go
|
@ -53,6 +53,31 @@ func addRoutes(api huma.API, glConfig GrandLyonConfig, now func() time.Time) {
|
||||||
huma.Get(api, "/tcl/stop/{stopID}", func(ctx context.Context, input *struct {
|
huma.Get(api, "/tcl/stop/{stopID}", func(ctx context.Context, input *struct {
|
||||||
StopID int `path:"stopID" doc:"Stop id to monitor. Can be obtained using https://data.grandlyon.com/portail/fr/jeux-de-donnees/points-arret-reseau-transports-commun-lyonnais/donnees"`
|
StopID int `path:"stopID" doc:"Stop id to monitor. Can be obtained using https://data.grandlyon.com/portail/fr/jeux-de-donnees/points-arret-reseau-transports-commun-lyonnais/donnees"`
|
||||||
}) (*stopOutput, error) {
|
}) (*stopOutput, error) {
|
||||||
|
if input.StopID == 0 {
|
||||||
|
return &stopOutput{
|
||||||
|
Body: Passages{
|
||||||
|
Passages: []Passage{
|
||||||
|
{
|
||||||
|
Ligne: "C00",
|
||||||
|
Delays: []string{
|
||||||
|
"Passé",
|
||||||
|
"Proche",
|
||||||
|
"5 min",
|
||||||
|
},
|
||||||
|
Destination: Stop{
|
||||||
|
ID: 0,
|
||||||
|
Name: "Test stop",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Stop: Stop{
|
||||||
|
ID: input.StopID,
|
||||||
|
Name: "Test stop",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
passages, err := getPassages(ctx, glConfig, now, input.StopID)
|
passages, err := getPassages(ctx, glConfig, now, input.StopID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.ErrorContext(ctx, "error getting passages", "err", err, getRequestIDAttr(ctx))
|
slog.ErrorContext(ctx, "error getting passages", "err", err, getRequestIDAttr(ctx))
|
||||||
|
|
Loading…
Reference in a new issue