Some changes

This commit is contained in:
nemunaire 2022-10-22 03:12:59 +02:00
commit 259b78ebd3
4 changed files with 193 additions and 9 deletions

View file

@ -2,9 +2,11 @@ package api
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"strings"
"github.com/gin-gonic/gin"
)
@ -52,13 +54,13 @@ func init() {
func declareStationsRoutes(router *gin.RouterGroup) {
router.GET("/stations/:type/:code", func(c *gin.Context) {
code := convertLineType(string(c.Param("code")))
code := convertLineCode(string(c.Param("code")))
var stations []PGStation
for _, station := range IDFMStations {
if station.Fields.Id == code {
pgstation := PGStation{
Id: station.Fields.StopId,
Id: fmt.Sprintf("STIF:StopPoint:Q:%s:", strings.TrimPrefix(station.Fields.StopId, "IDFM:")),
Name: station.Fields.StopName,
}