{"action":"created","comment":{"url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/comments/174636087","pull_request_review_id":104028969,"id":174636087,"diff_hunk":"@@ -0,0 +1,41 @@\n+from app.api.helpers import Service\n+from app import db\n+from app.models import User\n+from flask_login import current_user\n+from sqlalchemy import func\n+from sqlalchemy.sql.functions import concat\n+\n+\n+class UsersService(Service):\n+    __model__ = User\n+\n+    def __init__(self, *args, **kwargs):\n+        super(UsersService, self).__init__(*args, **kwargs)\n+\n+    def get_email_domain(self):\n+        \"\"\"Returns the user's email domain without the '@' symbol.\"\"\"\n+        return current_user.email_address.split('@')[-1]\n+\n+    def get_user_organisation(self):\n+        \"\"\"Returns the user's organisation based on their email domain.\"\"\"\n+        query = db.session.execute(\"\"\"SELECT name FROM govdomains WHERE domain = :domain\"\"\",\n+                                   {'domain': self.get_email_domain()})","path":"app/api/services/users.py","position":22,"original_position":22,"commit_id":"267d7d4ccc7d63fae1bd729f4be9c5d314a7a983","original_commit_id":"267d7d4ccc7d63fae1bd729f4be9c5d314a7a983","user":{"login":"malmas18","id":29763502,"avatar_url":"https://avatars1.githubusercontent.com/u/29763502?v=4","gravatar_id":"","url":"https://api.github.com/users/malmas18","html_url":"https://github.com/malmas18","followers_url":"https://api.github.com/users/malmas18/followers","following_url":"https://api.github.com/users/malmas18/following{/other_user}","gists_url":"https://api.github.com/users/malmas18/gists{/gist_id}","starred_url":"https://api.github.com/users/malmas18/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malmas18/subscriptions","organizations_url":"https://api.github.com/users/malmas18/orgs","repos_url":"https://api.github.com/users/malmas18/repos","events_url":"https://api.github.com/users/malmas18/events{/privacy}","received_events_url":"https://api.github.com/users/malmas18/received_events","type":"User","site_admin":false},"body":"i would pass the email domain as a param to this function.  it will make it more testable","created_at":"2018-03-14T23:03:08Z","updated_at":"2018-03-14T23:08:14Z","html_url":"https://github.com/AusDTO/dto-digitalmarketplace-api/pull/416#discussion_r174636087","pull_request_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/comments/174636087"},"html":{"href":"https://github.com/AusDTO/dto-digitalmarketplace-api/pull/416#discussion_r174636087"},"pull_request":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416"}}},"pull_request":{"url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416","id":171536372,"html_url":"https://github.com/AusDTO/dto-digitalmarketplace-api/pull/416","diff_url":"https://github.com/AusDTO/dto-digitalmarketplace-api/pull/416.diff","patch_url":"https://github.com/AusDTO/dto-digitalmarketplace-api/pull/416.patch","issue_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/416","number":416,"state":"open","locked":false,"title":"[Buyer Dashboard] Routes and queries for 'My briefs', 'Team briefs' and 'Team overview'","user":{"login":"tobiasbrown","id":2645932,"avatar_url":"https://avatars0.githubusercontent.com/u/2645932?v=4","gravatar_id":"","url":"https://api.github.com/users/tobiasbrown","html_url":"https://github.com/tobiasbrown","followers_url":"https://api.github.com/users/tobiasbrown/followers","following_url":"https://api.github.com/users/tobiasbrown/following{/other_user}","gists_url":"https://api.github.com/users/tobiasbrown/gists{/gist_id}","starred_url":"https://api.github.com/users/tobiasbrown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobiasbrown/subscriptions","organizations_url":"https://api.github.com/users/tobiasbrown/orgs","repos_url":"https://api.github.com/users/tobiasbrown/repos","events_url":"https://api.github.com/users/tobiasbrown/events{/privacy}","received_events_url":"https://api.github.com/users/tobiasbrown/received_events","type":"User","site_admin":false},"body":"Draft briefs are currently missing from test fixture. ","created_at":"2018-02-27T01:05:38Z","updated_at":"2018-03-14T23:08:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60e07f720c6266f7a976d5a38d7c16ace460afef","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ndavison","id":1152676,"avatar_url":"https://avatars1.githubusercontent.com/u/1152676?v=4","gravatar_id":"","url":"https://api.github.com/users/ndavison","html_url":"https://github.com/ndavison","followers_url":"https://api.github.com/users/ndavison/followers","following_url":"https://api.github.com/users/ndavison/following{/other_user}","gists_url":"https://api.github.com/users/ndavison/gists{/gist_id}","starred_url":"https://api.github.com/users/ndavison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndavison/subscriptions","organizations_url":"https://api.github.com/users/ndavison/orgs","repos_url":"https://api.github.com/users/ndavison/repos","events_url":"https://api.github.com/users/ndavison/events{/privacy}","received_events_url":"https://api.github.com/users/ndavison/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416/commits","review_comments_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416/comments","review_comment_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/416/comments","statuses_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/statuses/267d7d4ccc7d63fae1bd729f4be9c5d314a7a983","head":{"label":"AusDTO:mar-1507","ref":"mar-1507","sha":"267d7d4ccc7d63fae1bd729f4be9c5d314a7a983","user":{"login":"AusDTO","id":11763427,"avatar_url":"https://avatars3.githubusercontent.com/u/11763427?v=4","gravatar_id":"","url":"https://api.github.com/users/AusDTO","html_url":"https://github.com/AusDTO","followers_url":"https://api.github.com/users/AusDTO/followers","following_url":"https://api.github.com/users/AusDTO/following{/other_user}","gists_url":"https://api.github.com/users/AusDTO/gists{/gist_id}","starred_url":"https://api.github.com/users/AusDTO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AusDTO/subscriptions","organizations_url":"https://api.github.com/users/AusDTO/orgs","repos_url":"https://api.github.com/users/AusDTO/repos","events_url":"https://api.github.com/users/AusDTO/events{/privacy}","received_events_url":"https://api.github.com/users/AusDTO/received_events","type":"Organization","site_admin":false},"repo":{"id":62025672,"name":"dto-digitalmarketplace-api","full_name":"AusDTO/dto-digitalmarketplace-api","owner":{"login":"AusDTO","id":11763427,"avatar_url":"https://avatars3.githubusercontent.com/u/11763427?v=4","gravatar_id":"","url":"https://api.github.com/users/AusDTO","html_url":"https://github.com/AusDTO","followers_url":"https://api.github.com/users/AusDTO/followers","following_url":"https://api.github.com/users/AusDTO/following{/other_user}","gists_url":"https://api.github.com/users/AusDTO/gists{/gist_id}","starred_url":"https://api.github.com/users/AusDTO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AusDTO/subscriptions","organizations_url":"https://api.github.com/users/AusDTO/orgs","repos_url":"https://api.github.com/users/AusDTO/repos","events_url":"https://api.github.com/users/AusDTO/events{/privacy}","received_events_url":"https://api.github.com/users/AusDTO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AusDTO/dto-digitalmarketplace-api","description":"Digital Marketplace API.","fork":true,"url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api","forks_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/forks","keys_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/teams","hooks_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/hooks","issue_events_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/events{/number}","events_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/events","assignees_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/assignees{/user}","branches_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/branches{/branch}","tags_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/tags","blobs_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/statuses/{sha}","languages_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/languages","stargazers_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/stargazers","contributors_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/contributors","subscribers_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/subscribers","subscription_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/subscription","commits_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/contents/{+path}","compare_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/merges","archive_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/downloads","issues_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues{/number}","pulls_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls{/number}","milestones_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/milestones{/number}","notifications_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/labels{/name}","releases_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/releases{/id}","deployments_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/deployments","created_at":"2016-06-27T04:34:37Z","updated_at":"2018-03-14T23:07:31Z","pushed_at":"2018-03-14T23:07:35Z","git_url":"git://github.com/AusDTO/dto-digitalmarketplace-api.git","ssh_url":"git@github.com:AusDTO/dto-digitalmarketplace-api.git","clone_url":"https://github.com/AusDTO/dto-digitalmarketplace-api.git","svn_url":"https://github.com/AusDTO/dto-digitalmarketplace-api","homepage":null,"size":3313,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"AusDTO:master","ref":"master","sha":"30e2f8a7845170e5c7ac81a5eb39697f079f358d","user":{"login":"AusDTO","id":11763427,"avatar_url":"https://avatars3.githubusercontent.com/u/11763427?v=4","gravatar_id":"","url":"https://api.github.com/users/AusDTO","html_url":"https://github.com/AusDTO","followers_url":"https://api.github.com/users/AusDTO/followers","following_url":"https://api.github.com/users/AusDTO/following{/other_user}","gists_url":"https://api.github.com/users/AusDTO/gists{/gist_id}","starred_url":"https://api.github.com/users/AusDTO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AusDTO/subscriptions","organizations_url":"https://api.github.com/users/AusDTO/orgs","repos_url":"https://api.github.com/users/AusDTO/repos","events_url":"https://api.github.com/users/AusDTO/events{/privacy}","received_events_url":"https://api.github.com/users/AusDTO/received_events","type":"Organization","site_admin":false},"repo":{"id":62025672,"name":"dto-digitalmarketplace-api","full_name":"AusDTO/dto-digitalmarketplace-api","owner":{"login":"AusDTO","id":11763427,"avatar_url":"https://avatars3.githubusercontent.com/u/11763427?v=4","gravatar_id":"","url":"https://api.github.com/users/AusDTO","html_url":"https://github.com/AusDTO","followers_url":"https://api.github.com/users/AusDTO/followers","following_url":"https://api.github.com/users/AusDTO/following{/other_user}","gists_url":"https://api.github.com/users/AusDTO/gists{/gist_id}","starred_url":"https://api.github.com/users/AusDTO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AusDTO/subscriptions","organizations_url":"https://api.github.com/users/AusDTO/orgs","repos_url":"https://api.github.com/users/AusDTO/repos","events_url":"https://api.github.com/users/AusDTO/events{/privacy}","received_events_url":"https://api.github.com/users/AusDTO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AusDTO/dto-digitalmarketplace-api","description":"Digital Marketplace API.","fork":true,"url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api","forks_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/forks","keys_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/teams","hooks_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/hooks","issue_events_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/events{/number}","events_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/events","assignees_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/assignees{/user}","branches_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/branches{/branch}","tags_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/tags","blobs_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/statuses/{sha}","languages_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/languages","stargazers_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/stargazers","contributors_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/contributors","subscribers_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/subscribers","subscription_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/subscription","commits_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/contents/{+path}","compare_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/merges","archive_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/downloads","issues_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues{/number}","pulls_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls{/number}","milestones_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/milestones{/number}","notifications_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/labels{/name}","releases_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/releases{/id}","deployments_url":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/deployments","created_at":"2016-06-27T04:34:37Z","updated_at":"2018-03-14T23:07:31Z","pushed_at":"2018-03-14T23:07:35Z","git_url":"git://github.com/AusDTO/dto-digitalmarketplace-api.git","ssh_url":"git@github.com:AusDTO/dto-digitalmarketplace-api.git","clone_url":"https://github.com/AusDTO/dto-digitalmarketplace-api.git","svn_url":"https://github.com/AusDTO/dto-digitalmarketplace-api","homepage":null,"size":3313,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416"},"html":{"href":"https://github.com/AusDTO/dto-digitalmarketplace-api/pull/416"},"issue":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/416"},"comments":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/issues/416/comments"},"review_comments":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416/comments"},"review_comment":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/pulls/416/commits"},"statuses":{"href":"https://api.github.com/repos/AusDTO/dto-digitalmarketplace-api/statuses/267d7d4ccc7d63fae1bd729f4be9c5d314a7a983"}},"author_association":"NONE"}}
{"actor":{"display_login":"malmas18"}}