NEEDS TESTS: Add subqueries to events query endpoint

not sure if this is the cleanest way to implement it. seems like the other endpoints have a ton of stuff directly in query.clj. but imported the required stuff here instead.