Skip to content
Snippets Groups Projects
Commit d52dcb0a authored by Arie Peterson's avatar Arie Peterson
Browse files

Implement app.oauthclients using relationship

parent b8e5bdb4
No related branches found
No related tags found
1 merge request!103Resolve "Allow deletion of apps"
Pipeline #38568 passed with stages
in 3 minutes and 11 seconds
......@@ -29,6 +29,7 @@ class App(db.Model):
# The URL is only stored in the DB for external applications; otherwise the
# URL is stored in a configmap (see get_url)
url = db.Column(String(length=128), unique=False)
oauthclients = relationship("OAuthClientApp", back_populates="app")
def __init__(self, slug, name, external=False, url=None):
self.slug = slug
......@@ -177,15 +178,6 @@ class App(db.Model):
app_id=self.id
).all()
@property
def oauthclients(self):
"""
All oauth clients related to this app
"""
return OAuthClientApp.query.filter_by(
app_id=self.id
).all()
@property
def kustomization(self):
"""Returns the kustomization object for this app"""
......@@ -329,7 +321,7 @@ class OAuthClientApp(db.Model): # pylint: disable=too-few-public-methods
oauthclient_id = db.Column(String(length=64), primary_key=True)
app_id = db.Column(Integer, ForeignKey("app.id"))
app = relationship("App")
app = relationship("App", back_populates="oauthclients")
def __repr__(self):
return (f"oauthclient_id: {self.oauthclient_id}, app_id: {self.app_id},"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment