Rewrite sqlachemy code for 1.4 to 2.x migration

This commit is contained in:
2024-01-11 20:48:13 +01:00
committed by Brain
parent 146eb995a8
commit 2ff958c55f
4 changed files with 9 additions and 9 deletions

View File

@ -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)