-
Notifications
You must be signed in to change notification settings - Fork 3
Added jira endpoint #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ec4870c
Added jira endpoint
samhotep 78afc48
Fixed bug with ambiguous parent
samhotep db48238
Fixed ci params typo
samhotep ee9a7dc
Removed task utils
samhotep 25cb710
Use explicit names for request types
samhotep 5011502
Updated epic fields
samhotep 5fb521c
Updated readme
samhotep 14bb8e1
Removed unused type models
samhotep 66e74b1
Use issue key instead of id
samhotep b52d253
Use string for key
samhotep 112547e
Update webapp/jira.py
samhotep e5b788a
Removed created_at field override
samhotep 8b5b914
Reformat exceptions as 500 errors
samhotep a81779b
Removed infrastructure component
samhotep 773e191
Added deployment config
samhotep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,45 @@ | ||
| from webapp.models import get_or_create, db, User | ||
| from webapp.models import JiraTask, User, db, get_or_create | ||
|
|
||
|
|
||
| def get_or_create_user_id(user): | ||
| # If user does not exist, create a new user in the "users" table | ||
| user_hrc_id = user.get("id") | ||
| user_exists = User.query.filter_by(hrc_id=user_hrc_id).first() | ||
| if not user_exists: | ||
| user_exists, _ = get_or_create(db.session, | ||
| User, | ||
| name=user.get("name"), | ||
| email=user.get("email"), | ||
| team=user.get("team"), | ||
| department=user.get("department"), | ||
| job_title=user.get("jobTitle"), | ||
| hrc_id=user_hrc_id) | ||
| user_exists, _ = get_or_create( | ||
| db.session, | ||
| User, | ||
| name=user.get("name"), | ||
| email=user.get("email"), | ||
| team=user.get("team"), | ||
| department=user.get("department"), | ||
| job_title=user.get("jobTitle"), | ||
| hrc_id=user_hrc_id, | ||
| ) | ||
|
|
||
| return user_exists.id | ||
|
|
||
|
|
||
| def create_jira_task(app, task): | ||
| """ | ||
| Create a new issue on jira and add a record to the db | ||
| """ | ||
| # TODO: If an epic already exists for this request, add subtasks to it. | ||
|
|
||
| jira = app.config["JIRA"] | ||
| issue = jira.create_issue( | ||
| due_date=task["due_date"], | ||
| reporter_id=task["reporter_id"], | ||
| webpage_id=task["webpage_id"], | ||
| request_type=task["type"], | ||
| description=task["description"], | ||
| ) | ||
|
|
||
| # Create jira task in the database | ||
| get_or_create( | ||
| db.session, | ||
| JiraTask, | ||
| jira_id=issue["id"], | ||
| webpage_id=task["webpage_id"], | ||
| user_id=task["reporter_id"], | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.