[misc] Fix all 204 responses
This commit is contained in:
parent
96b1900b46
commit
3025d8b05a
|
@ -171,6 +171,7 @@ async def email_delete(email=Depends(get_email)):
|
||||||
:param hood: Hood the Email bot belongs to.
|
:param hood: Hood the Email bot belongs to.
|
||||||
"""
|
"""
|
||||||
await email.delete()
|
await email.delete()
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
|
@ -257,6 +258,7 @@ async def email_unsubscribe(token, hood=Depends(get_hood_unauthorized)):
|
||||||
hood=payload['hood'], email=payload['email']
|
hood=payload['hood'], email=payload['email']
|
||||||
).get()
|
).get()
|
||||||
await subscriber.delete()
|
await subscriber.delete()
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
except NoMatch:
|
except NoMatch:
|
||||||
return HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
return HTTPException(status_code=status.HTTP_404_NOT_FOUND)
|
||||||
except exceptions.CryptoError:
|
except exceptions.CryptoError:
|
||||||
|
|
|
@ -87,6 +87,7 @@ async def telegram_delete(telegram=Depends(get_telegram)):
|
||||||
for user in await TelegramUser.objects.filter(bot=telegram).all():
|
for user in await TelegramUser.objects.filter(bot=telegram).all():
|
||||||
await user.delete()
|
await user.delete()
|
||||||
await telegram.delete()
|
await telegram.delete()
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
|
|
|
@ -74,6 +74,7 @@ async def twitter_read(twitter=Depends(get_twitter)):
|
||||||
async def twitter_delete(twitter=Depends(get_twitter)):
|
async def twitter_delete(twitter=Depends(get_twitter)):
|
||||||
spawner.stop(twitter)
|
spawner.stop(twitter)
|
||||||
await twitter.delete()
|
await twitter.delete()
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
|
|
|
@ -106,6 +106,7 @@ async def hood_update(values: BodyHood, hood=Depends(get_hood)):
|
||||||
- **landingpage**: New Markdown formatted description of the hood
|
- **landingpage**: New Markdown formatted description of the hood
|
||||||
"""
|
"""
|
||||||
await hood.update(**values.__dict__)
|
await hood.update(**values.__dict__)
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
@router.delete(
|
@router.delete(
|
||||||
|
@ -124,3 +125,4 @@ async def hood_delete(hood=Depends(get_hood)):
|
||||||
for relation in await AdminHoodRelation.objects.filter(hood=hood).all():
|
for relation in await AdminHoodRelation.objects.filter(hood=hood).all():
|
||||||
await relation.delete()
|
await relation.delete()
|
||||||
await hood.delete()
|
await hood.delete()
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
|
@ -88,6 +88,7 @@ async def badword_update(values: BodyBadWord, badword=Depends(get_badword)):
|
||||||
- **pattern**: Regular expression which is used to match a badword
|
- **pattern**: Regular expression which is used to match a badword
|
||||||
"""
|
"""
|
||||||
await badword.update(**values.__dict__)
|
await badword.update(**values.__dict__)
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
@router.delete(
|
@router.delete(
|
||||||
|
@ -98,3 +99,4 @@ async def badword_update(values: BodyBadWord, badword=Depends(get_badword)):
|
||||||
async def badword_delete(badword=Depends(get_badword)):
|
async def badword_delete(badword=Depends(get_badword)):
|
||||||
""" Deletes badword with id **badword_id** for hood with id **hood_id**. """
|
""" Deletes badword with id **badword_id** for hood with id **hood_id**. """
|
||||||
await badword.delete()
|
await badword.delete()
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
|
@ -89,6 +89,7 @@ async def trigger_update(values: BodyTrigger, trigger=Depends(get_trigger)):
|
||||||
- **pattern**: Regular expression which is used to match a trigger
|
- **pattern**: Regular expression which is used to match a trigger
|
||||||
"""
|
"""
|
||||||
await trigger.update(**values.__dict__)
|
await trigger.update(**values.__dict__)
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
@router.delete(
|
@router.delete(
|
||||||
|
@ -99,3 +100,4 @@ async def trigger_update(values: BodyTrigger, trigger=Depends(get_trigger)):
|
||||||
async def trigger_delete(trigger=Depends(get_trigger)):
|
async def trigger_delete(trigger=Depends(get_trigger)):
|
||||||
""" Deletes trigger with id **trigger_id** for hood with id **hood_id**. """
|
""" Deletes trigger with id **trigger_id** for hood with id **hood_id**. """
|
||||||
await trigger.delete()
|
await trigger.delete()
|
||||||
|
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
Loading…
Reference in a new issue