finished the database api for timetables