db & test refactoring

* db session now bound to request
* using transaction manager
* set up functional testing