transitmatters / shutdown-tracker

A dashboard to track MBTA Shutdowns, and their results
https://mbtashutdowns.info
MIT License
5 stars 2 forks source link

Add calendar filtering by line (backend only) #64

Closed DaAwesomeP closed 3 months ago

DaAwesomeP commented 4 months ago

Motivation

Since many people only take some of the MBTA lines, they may only want some of them in their calendar.

Changes

This pull adds the optional line query parameter to the /calendar route to filter shutdowns by line. One, multiple, or no lines may be specified.

The line names are currently validated against shutdowns.json and will return a 400 bad request if an unknown line is specified. This relies on shutdown.json listing empty arrays if a line does not have any shutdowns planned; if this cannot be guaranteed then I will remove this check and unknown lines will be silently discarded.

This PR only adds this feature to the backend for now (I am not experienced with React).

EDIT: Force pushes to fix lint.

Testing Instructions