Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change: Converted the SQLAlchemy-related code to use async/await. (#618)
* Updated Flask and SQLAlchemy requirements to the async version. * Added the AsyncAttrs mixin to the models. * Added the async driver for Postgres. * Set the posts' user relationship to 'selectin' for the join. * Switched the roles' and permissions' relationship joins to 'selectin'. * Added async counterparts to all methods in the DB class. * Added missing deprecation warning. * Updated all endpoints to use the new async methods. * Installed Quart and Quart-cors to replace Flask (and Flask-cors). * Switched Auth to use async/await. * Replaced Flask and Flask-cors with Quart and Quart-cors. * Deleted most of the non-async methods. * Installed pytest-asyncio for tests. * Updated the tests to use the async versions of all functions. * Deleted the rest of the non-async functions in db. * Cleaned up some of the test fixtures. * Merged the two app fixtures. Now that we're not using the app context anymore, we don't really need separate fixtures for the app and the test_client. * Split the db setup fixtures. * Added missing role to test setup, * Replaced daatabase_url with async_database_url in the DB class setup. * Tweaked the fixtures a little more. * Changed asyncio_mode to auto in tests. * Changed the asyncio scope to session. * Updated the URL of the database in CI to include the driver. * Added a subscriptions task in tests. * Updated the way the database is reset in tests. * Updated the docstrings. * Deleted sh from the README as we no longer use it. * Disabled sending push notifications in tests. * Moved the mock to the function-scoped fixture. * Added some logging to see what the problem is. * Testing to see if it's the wrong location to patch. * Deleted the unneeded print. * Added a changelog entry. * Changed all db methods to return formatted objects. * Added missing parsing of dates to all dates coming from the front-end. * Cast all the IDs explicitly to integers. Seems that asyncpg isn't as good at handling str -> int as psycopg2... * Fixed the bug I caused in the GET users endpoint. * Added refreshes to the 'add' methods in the db. * Updated the db tests to the formatted return value. * Updated the date format in the dummy data to match the front-end. * Cast some more string IDs as integers... * Updated the error message in test_db to match the asyncpg syntax. * Updated the fixture in test_auth to the db fixture. * Fixed some issues with the fixtures setting up the database. * Added proepr logging to the db class. * Changed the name of the app. * Added a note to the README to include the driver in the URL. * Added missing engine.dispose to the suite setup. * Deleted the old changelog file. * Replaced gunicorn with hypercorn and removed psycopg as it's not needed anymore. * Changed the names of the db's attributes and methods back to their original names. They were originally named this way to avoid breaking any other methods that use the originals during the migration, but now that everything has been migrated and the old methods have been removed, the changed names are no longer needed. * Added a changelog entry. * Updated the date format in the API docs. * Fixed a 403 for user update. * Fixed the tests I broke...
- Loading branch information