Rewrite sqlachemy code for 1.4 to 2.x migration
This commit is contained in:
@ -33,7 +33,7 @@ def update_languages(profile, languages_data):
|
||||
if "id" not in language_data["language"]:
|
||||
continue
|
||||
|
||||
language = Language.query.get(language_data["language"]["id"])
|
||||
language = db.session.get(Language, language_data["language"]["id"])
|
||||
profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile,
|
||||
ProfileLanguage.language == language).first()
|
||||
|
||||
@ -110,7 +110,7 @@ def update_contacts(profile, contacts_data):
|
||||
if "id" in contact_data:
|
||||
contact_id = int(contact_data["id"])
|
||||
contact_ids_to_be_deleted.remove(contact_id)
|
||||
contact = Contact.query.get(contact_id)
|
||||
contact = db.session.get(Contact, contact_id)
|
||||
else:
|
||||
contact = Contact(profile=profile, contacttype=contacttype)
|
||||
db.session.add(contact)
|
||||
@ -122,7 +122,7 @@ def update_contacts(profile, contacts_data):
|
||||
|
||||
|
||||
def update_profile(user_id: int):
|
||||
user = User.query.get(user_id)
|
||||
user = db.session.get(User, user_id)
|
||||
|
||||
if user is None:
|
||||
return make_response({}, 404)
|
||||
|
Reference in New Issue
Block a user