diff --git a/kibicara/platforms/mastodon/webapi.py b/kibicara/platforms/mastodon/webapi.py index 03a7440..bfaa7fc 100644 --- a/kibicara/platforms/mastodon/webapi.py +++ b/kibicara/platforms/mastodon/webapi.py @@ -159,7 +159,7 @@ async def mastodon_create(instance_url, username, password, hood=Depends(get_hoo except MastodonError: logger.warning("Login to Mastodon failed.", exc_info=True) return # show error to user - MastodonAccount.objects.create( + return await MastodonAccount.objects.create( hood=hood, instance=instance, access_token=access_token, diff --git a/kibicara/webapi/__init__.py b/kibicara/webapi/__init__.py index 0572d69..29c01f6 100644 --- a/kibicara/webapi/__init__.py +++ b/kibicara/webapi/__init__.py @@ -15,6 +15,7 @@ from fastapi import APIRouter from kibicara.platforms.email.webapi import router as email_router from kibicara.platforms.telegram.webapi import router as telegram_router from kibicara.platforms.test.webapi import router as test_router +from kibicara.platforms.mastodon.webapi import router as mastodon_router from kibicara.platforms.twitter.webapi import router as twitter_router from kibicara.platforms.twitter.webapi import twitter_callback_router from kibicara.webapi.admin import router as admin_router @@ -37,6 +38,9 @@ hoods_router.include_router( hoods_router.include_router( twitter_router, prefix='/{hood_id}/twitter', tags=['twitter'] ) +hoods_router.include_router( + mastodon_router, prefix='/{hood_id}/mastodon', tags=['mastodon'] +) router.include_router(twitter_callback_router, prefix='/twitter', tags=['twitter']) hoods_router.include_router(email_router, prefix='/{hood_id}/email', tags=['email']) router.include_router(hoods_router, prefix='/hoods')