Skip to content

Commit

Permalink
Adding team url to datasource.
Browse files Browse the repository at this point in the history
  • Loading branch information
julialawrence committed Nov 15, 2023
1 parent 43b6db0 commit ae1d545
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ae1d545

Please sign in to comment.