The cron job fetches all existing departures and arrivals which don't have an associatedMovement (which are all movements which have ever been created), resolves the associated movement and sets it.
The default function timeout of 1 minute is too short for the first run if there are several thousand movements to update. Therefore, it should be set to 9 minutes which is the maximum. 9 minutes still might not be enough, but the job runs every 15 minutes, so it simply will continue on the next run if it gets cancelled after 9 minutes before it was completed.
Also moved admin.initializeApp() to the main functions file as it can't be executed multiple times anyway.
associatedMovement
(which are all movements which have ever been created), resolves the associated movement and sets it.admin.initializeApp()
to the main functions file as it can't be executed multiple times anyway.