Skip to content

Commit

Permalink
Fix LegacyAPIWarning of SQLalchemy
Browse files Browse the repository at this point in the history
  • Loading branch information
dorthrithil committed Feb 2, 2025
1 parent f89077e commit 8b17dc8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions server/src/util/generic_relationships.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from extensions import db
from models.area import Area
from models.crag import Crag
from models.line import Line
Expand All @@ -10,15 +11,15 @@ def check_object_exists(object_type, object_id):
Check if an object with the given object_type and object_id exists.
"""
if object_type == "User":
return User.query.get(object_id) is not None
return db.session.get(User, object_id) is not None
if object_type == "Line":
return Line.query.get(object_id) is not None
return db.session.get(Line, object_id) is not None
if object_type == "Area":
return Area.query.get(object_id) is not None
return db.session.get(Area, object_id) is not None
if object_type == "Sector":
return Sector.query.get(object_id) is not None
return db.session.get(Sector, object_id) is not None
if object_type == "Crag":
return Crag.query.get(object_id) is not None
return db.session.get(Crag, object_id) is not None
return False


Expand Down

0 comments on commit 8b17dc8

Please sign in to comment.