diff --git a/app/routers_v2/awards.py b/app/routers_v2/awards.py index 30cfbe2..3cebc18 100644 --- a/app/routers_v2/awards.py +++ b/app/routers_v2/awards.py @@ -136,7 +136,7 @@ async def delete_award(award_id, token: str = Depends(oauth2_scheme)): count = this_award.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Award {award_id} has been deleted') + return {"detail": f'Award {award_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Award {award_id} was not deleted') diff --git a/app/routers_v2/batstats.py b/app/routers_v2/batstats.py index d0dfd05..21e84b4 100644 --- a/app/routers_v2/batstats.py +++ b/app/routers_v2/batstats.py @@ -223,7 +223,7 @@ async def post_batstats(stats: BattingStatModel, token: str = Depends(oauth2_sch with db.atomic(): BattingStat.bulk_create(new_stats, batch_size=15) - raise HTTPException(status_code=200, detail=f'{len(new_stats)} batting lines have been added') + return {"detail": f'{len(new_stats)} batting lines have been added'} @router.delete('/{stat_id}', include_in_schema=PRIVATE_IN_SCHEMA) @@ -242,7 +242,7 @@ async def delete_batstat(stat_id, token: str = Depends(oauth2_scheme)): count = this_stat.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Stat {stat_id} has been deleted') + return {"detail": f'Stat {stat_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Stat {stat_id} was not deleted') diff --git a/app/routers_v2/cards.py b/app/routers_v2/cards.py index 419b236..063a80a 100644 --- a/app/routers_v2/cards.py +++ b/app/routers_v2/cards.py @@ -181,7 +181,7 @@ async def v1_cards_post(cards: CardModel, token: str = Depends(oauth2_scheme)): cost_query.execute() # sheets.post_new_cards(SHEETS_AUTH, lc_id) - raise HTTPException(status_code=200, detail=f'{len(new_cards)} cards have been added') + return {"detail": f'{len(new_cards)} cards have been added'} # @router.post('/ai-update') @@ -195,7 +195,7 @@ async def v1_cards_post(cards: CardModel, token: str = Depends(oauth2_scheme)): # ) # # sheets.send_ai_cards(SHEETS_AUTH) -# raise HTTPException(status_code=200, detail=f'Just sent AI cards to sheets') +# return {"detail": f'Just sent AI cards to sheets'} @router.post('/legal-check/{rarity_name}') @@ -241,7 +241,7 @@ async def v1_cards_post_update(starting_id: int, token: str = Depends(oauth2_sch ) # sheets.post_new_cards(SHEETS_AUTH, starting_id) - raise HTTPException(status_code=200, detail=f'Just sent cards to sheets starting at ID {starting_id}') + return {"detail": f'Just sent cards to sheets starting at ID {starting_id}'} @router.post('/post-delete') @@ -338,6 +338,6 @@ async def v1_cards_delete(card_id, token: str = Depends(oauth2_scheme)): count = this_card.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Card {card_id} has been deleted') + return {"detail": f'Card {card_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Card {card_id} was not deleted') diff --git a/app/routers_v2/cardsets.py b/app/routers_v2/cardsets.py index 610680b..9dc19da 100644 --- a/app/routers_v2/cardsets.py +++ b/app/routers_v2/cardsets.py @@ -247,7 +247,7 @@ async def delete_cardsets(cardset_id, token: str = Depends(oauth2_scheme)): count = this_cardset.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Cardset {cardset_id} has been deleted') + return {"detail": f'Cardset {cardset_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Cardset {cardset_id} was not deleted') diff --git a/app/routers_v2/current.py b/app/routers_v2/current.py index c122229..cee4552 100644 --- a/app/routers_v2/current.py +++ b/app/routers_v2/current.py @@ -142,6 +142,6 @@ async def delete_current(current_id, token: str = Depends(oauth2_scheme)): count = this_curr.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Current {current_id} has been deleted') + return {"detail": f'Current {current_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Current {current_id} was not deleted') diff --git a/app/routers_v2/events.py b/app/routers_v2/events.py index ce368a6..e311d59 100644 --- a/app/routers_v2/events.py +++ b/app/routers_v2/events.py @@ -169,6 +169,6 @@ async def v1_events_delete(event_id, token: str = Depends(oauth2_scheme)): count = this_event.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Event {event_id} has been deleted') + return {"detail": f'Event {event_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Event {event_id} was not deleted') diff --git a/app/routers_v2/gamerewards.py b/app/routers_v2/gamerewards.py index bef669f..27aea4e 100644 --- a/app/routers_v2/gamerewards.py +++ b/app/routers_v2/gamerewards.py @@ -167,7 +167,7 @@ async def v1_gamerewards_delete(gamereward_id, token: str = Depends(oauth2_schem count = this_award.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Game Reward {gamereward_id} has been deleted') + return {"detail": f'Game Reward {gamereward_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Game Reward {gamereward_id} was not deleted') diff --git a/app/routers_v2/notifications.py b/app/routers_v2/notifications.py index c29012a..9a8480b 100644 --- a/app/routers_v2/notifications.py +++ b/app/routers_v2/notifications.py @@ -179,6 +179,6 @@ async def delete_notif(notif_id, token: str = Depends(oauth2_scheme)): count = this_notif.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Notification {notif_id} has been deleted') + return {"detail": f'Notification {notif_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Notification {notif_id} was not deleted') diff --git a/app/routers_v2/packs.py b/app/routers_v2/packs.py index 19b43c9..5a9e31a 100644 --- a/app/routers_v2/packs.py +++ b/app/routers_v2/packs.py @@ -148,7 +148,7 @@ async def post_pack(packs: PackModel, token: str = Depends(oauth2_scheme)): with db.atomic(): Pack.bulk_create(new_packs, batch_size=15) - raise HTTPException(status_code=200, detail=f'{len(new_packs)} packs have been added') + return {"detail": f'{len(new_packs)} packs have been added'} @router.post('/one') @@ -240,6 +240,6 @@ async def delete_pack(pack_id, token: str = Depends(oauth2_scheme)): count = this_pack.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Pack {pack_id} has been deleted') + return {"detail": f'Pack {pack_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Pack {pack_id} was not deleted') diff --git a/app/routers_v2/packtypes.py b/app/routers_v2/packtypes.py index 5ce5195..5bac2e3 100644 --- a/app/routers_v2/packtypes.py +++ b/app/routers_v2/packtypes.py @@ -169,6 +169,6 @@ async def delete_packtype(packtype_id, token: str = Depends(oauth2_scheme)): count = this_packtype.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Packtype {packtype_id} has been deleted') + return {"detail": f'Packtype {packtype_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Packtype {packtype_id} was not deleted') diff --git a/app/routers_v2/paperdex.py b/app/routers_v2/paperdex.py index 6328906..b868f83 100644 --- a/app/routers_v2/paperdex.py +++ b/app/routers_v2/paperdex.py @@ -171,7 +171,7 @@ async def delete_paperdex(paperdex_id, token: str = Depends(oauth2_scheme)): count = this_dex.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Paperdex {this_dex} has been deleted') + return {"detail": f'Paperdex {this_dex} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Paperdex {this_dex} was not deleted') diff --git a/app/routers_v2/pitstats.py b/app/routers_v2/pitstats.py index c5f812c..b558c71 100644 --- a/app/routers_v2/pitstats.py +++ b/app/routers_v2/pitstats.py @@ -157,7 +157,7 @@ async def post_pitstat(stats: PitchingStatModel, token: str = Depends(oauth2_sch with db.atomic(): PitchingStat.bulk_create(new_stats, batch_size=15) - raise HTTPException(status_code=200, detail=f'{len(new_stats)} pitching lines have been added') + return {"detail": f'{len(new_stats)} pitching lines have been added'} @router.delete('/{stat_id}') @@ -176,6 +176,6 @@ async def delete_pitstat(stat_id, token: str = Depends(oauth2_scheme)): count = this_stat.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Stat {stat_id} has been deleted') + return {"detail": f'Stat {stat_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Stat {stat_id} was not deleted') diff --git a/app/routers_v2/rarity.py b/app/routers_v2/rarity.py index 057daa8..8f1e95b 100644 --- a/app/routers_v2/rarity.py +++ b/app/routers_v2/rarity.py @@ -161,6 +161,6 @@ async def v1_rarities_delete(rarity_id, token: str = Depends(oauth2_scheme)): count = this_rarity.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Rarity {rarity_id} has been deleted') + return {"detail": f'Rarity {rarity_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Rarity {rarity_id} was not deleted') diff --git a/app/routers_v2/results.py b/app/routers_v2/results.py index 173d145..1691197 100644 --- a/app/routers_v2/results.py +++ b/app/routers_v2/results.py @@ -397,7 +397,7 @@ async def delete_result(result_id, token: str = Depends(oauth2_scheme)): count = this_result.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Result {result_id} has been deleted') + return {"detail": f'Result {result_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Result {result_id} was not deleted') diff --git a/app/routers_v2/rewards.py b/app/routers_v2/rewards.py index 6886e99..4ca4d3a 100644 --- a/app/routers_v2/rewards.py +++ b/app/routers_v2/rewards.py @@ -167,7 +167,7 @@ async def delete_reward(reward_id, token: str = Depends(oauth2_scheme)): count = this_reward.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f'Reward {reward_id} has been deleted') + return {"detail": f'Reward {reward_id} has been deleted'} else: raise HTTPException(status_code=500, detail=f'Reward {reward_id} was not deleted') diff --git a/app/routers_v2/teams.py b/app/routers_v2/teams.py index a2b31d8..94ae4b8 100644 --- a/app/routers_v2/teams.py +++ b/app/routers_v2/teams.py @@ -1506,6 +1506,6 @@ async def delete_team(team_id, token: str = Depends(oauth2_scheme)): count = this_team.delete_instance() if count == 1: - raise HTTPException(status_code=200, detail=f"Team {team_id} has been deleted") + return {"message": f"Team {team_id} has been deleted"} else: raise HTTPException(status_code=500, detail=f"Team {team_id} was not deleted")