Added the functions to query db. To do:

- implement db facade
Ignoring resources
Implemented the db facade + tests