In order to separate application layers we need to move all "low-level" database related code into models.
In the scope of this task we need to encapsulate all models quirying functionality into models methods. We need to get rid of using session.query() in our routes, because this is a database layer responsibility.
Below are changes we expect to be in routes.py. "Before" designates what code we have now, "After" designates what code we want to see after this refactoring.
In order to separate application layers we need to move all "low-level" database related code into models.
In the scope of this task we need to encapsulate all models quirying functionality into models methods. We need to get rid of using session.query() in our routes, because this is a database layer responsibility.
Below are changes we expect to be in routes.py. "Before" designates what code we have now, "After" designates what code we want to see after this refactoring.
Before:
After:
Before:
After:
Before:
After:
Before:
After:
Before:
After:
Before:
After:
Before:
After: