From ae1d545b4a1e8edee3c08e43800f0dc897aa54a3 Mon Sep 17 00:00:00 2001 From: julialawrence Date: Wed, 15 Nov 2023 08:40:18 +0000 Subject: [PATCH] Adding team url to datasource. --- app/app.py | 7 +++++-- app/models.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/app.py b/app/app.py index 3dc7231..21cf7a2 100644 --- a/app/app.py +++ b/app/app.py @@ -214,15 +214,18 @@ def create_data_source(): team_info = team_creation_response.json() print(f"Team Info: %s", team_info) team_id = team_info.get("id") - if team_id: + team_web_url = team_info.get("webUrl") + if team_id and team_web_url: data_source.team_id = team_id + data_source.team_web_url = team_web_url + db.session.commit() flash( "Team created and associated with data source successfully!", "success", ) else: - flash("Failed to extract team ID from the response.", "error") + flash("Failed to extract team ID or web url from the response.", "error") else: # If there was an error flash("Failed to create the team.", "error") else: diff --git a/app/models.py b/app/models.py index a95fb1d..4ddd27d 100644 --- a/app/models.py +++ b/app/models.py @@ -31,6 +31,7 @@ class DataSource(db.Model): created_by = db.Column(db.String(255), db.ForeignKey("users.id")) aad_group_id = db.Column(db.String(255), unique=True) team_id = db.Column(db.String(255), unique=True) + team_web_url = db.Column(db.String(255), unique=True) # Relationships permissions = db.relationship(