switch all to be the default if filter is invalid

This commit is contained in:
Aaron Kimbre
2022-04-03 12:00:14 -05:00
parent 44689aad36
commit e5428dcd4d
4 changed files with 10 additions and 20 deletions

View File

@@ -194,9 +194,7 @@ def get(status="all"):
]
query = None
if status == "all":
query = db.session.query().select_from(Property).join(CharacterInfo, CharacterInfo.id == Property.owner_id).join(Account)
elif status == "approved":
if status == "approved":
query = db.session.query().select_from(Property).join(
CharacterInfo, CharacterInfo.id == Property.owner_id
).join(Account).filter(Property.mod_approved == True).filter(Property.privacy_option == 2)
@@ -205,7 +203,7 @@ def get(status="all"):
CharacterInfo, CharacterInfo.id == Property.owner_id
).join(Account).filter(Property.mod_approved == False).filter(Property.privacy_option == 2)
else:
raise Exception("Not a valid filter")
query = db.session.query().select_from(Property).join(CharacterInfo, CharacterInfo.id == Property.owner_id).join(Account)
params = request.args.to_dict()