What's Changed
* Update fastapi-stack by jthurner in https://github.com/e2nIEE/pandahub/pull/32
**Full Changelog**: https://github.com/e2nIEE/pandahub/compare/v0.2.10...v0.3.0
BREAKING CHANGES:
- existing user collections have to be migrated (recreate with id field moved into _id - see below)
- changed variable names in fastapi-mail: `MAIL_TLS` -> `MAIL_STARTTLS` and `MAIL_SSL` -> `MAIL_SSL_TLS`
- applications integrating pandahub must adapt to changes introduced since [fastapi-users v9](https://fastapi-users.github.io/fastapi-users/12.1/migration/9x_to_10x/) and [fastapi v0.75](https://fastapi.tiangolo.com/release-notes/)
User database migration
pandahub v0.3.0 introduces a breaking change in the way user documents are stored. Log-ins will throw a backend error if you run pandahub >= v0.3.0 against a database containing users created with previous versions.
To migrate an existing database:
python
from pandahub import PandaHub
from pandahub.lib.database_toolbox import migrate_userdb_to_beanie
ph = PandaHub()
migrate_userdb_to_beanie(ph)
This migration breaks logins for pandahub < 0.3.0. Trying to create new users with an old pandahub version on a migrated database will fail if at least one user already exists. A backup of the original user collection will be created as `users_fa9_%Y-%m-%d_%H-%M`.
Background
[fastapi-users](https://fastapi-users.github.io), which pandahub depends on for user management, introduces a couple of [breaking changes in version 10](https://fastapi-users.github.io/fastapi-users/12.1/migration/9x_to_10x/). With the switch to [Beanie ODM](https://github.com/roman-right/beanie/) for mongodb support, user ids are now saved on the `_id` field instead of `id`:
fastapi v9
python
{'_id': ObjectId('637f2341304330c7511e4056'), 'id': UUID('2b52cf59-f5c3-433c-963c-834fbe9edbeb'), 'email': 'myuser.com'}
fastapi v10+
python
{'_id': UUID('2b52cf59-f5c3-433c-963c-834fbe9edbeb'), 'email': 'myuser.com'}
To migrate, drop the index on `id` and move the `id` field into `_id`:
python
db["user_management"]["users"].drop_index("id_1")
db["user_management"]["users"].aggregate([{'$addFields': {'_id': '$id'}}, {'$unset': 'id'}, {'$out': 'users'}]
To roll back to pre-0.3.0, apply the reverse transformation:
python
db["user_management"]["users"].aggregate([{'$addFields': {'id': '$_id'}}, {'$unset': '_id'}, {'$out': 'users'}]`