{"action":"created","comment":{"url":"https://api.github.com/repos/thinblock/tb-core-api/pulls/comments/207528088","pull_request_review_id":143147731,"id":207528088,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzUyODA4OA==","diff_hunk":"@@ -0,0 +1,68 @@\n+import * as restify from 'restify';\n+import { InternalServerError, NotFoundError } from 'restify-errors';\n+import IController from '../../interfaces/utils/IController';\n+import { IRequest, IResponse } from '../../interfaces/utils/IServer';\n+import Wallet from '../../models/wallet.model';\n+import WalletAddress from '../../models/wallet_address.model';\n+import WalletUser from '../../models/wallet_user.model';\n+import { IWallet } from '../../interfaces/models';\n+\n+export default class WalletsController implements IController {\n+  public async post(req: IRequest, res: IResponse, next: restify.Next) {\n+    try {\n+      const walletObj = req.body;\n+      const wallet = <IWallet> await Wallet.create({\n+        ...walletObj,\n+        client_id: req.client_id\n+      });\n+      return res.send(wallet);\n+    } catch (e) {\n+      req.log.error(e);\n+      throw new InternalServerError(e);\n+    }\n+    return next();\n+  }\n+\n+  public async get(req: IRequest, res: IResponse, next: restify.Next) {\n+    try {\n+      const wallet = await Wallet.findOne({\n+        where: { id: req.params.wallet_id },\n+        include: [\n+          {\n+            model: WalletAddress,\n+            as: 'addresses',\n+            attributes: ['id'],\n+            where: { wallet_id: req.params.wallet_id }\n+          },\n+          {\n+            model: WalletUser,\n+            as: 'users',\n+            attributes: ['id'],\n+            where: { wallet_id: req.params.wallet_id }\n+          },\n+        ]\n+      });\n+\n+      if (!wallet) {\n+        return res.send(new restify.NotFoundError('Wallet not found for given id'));\n+      }\n+\n+      return res.send(wallet);\n+    } catch (e) {\n+      req.log.error(e);\n+      throw new InternalServerError(e);\n+    }\n+    return next();\n+  }\n+\n+  public async getAll(req: IRequest, res: IResponse, next: restify.Next) {\n+    try {\n+      const wallets = await Wallet.findAll({ where: { client_id: req.client_id } });\n+      return res.send(wallets);","path":"app/modules/wallet/wallet.controller.ts","position":61,"original_position":61,"commit_id":"e010153d121d9e01a6381abacfd43a602c1febd5","original_commit_id":"e010153d121d9e01a6381abacfd43a602c1febd5","user":{"login":"hamxabaig","id":12872177,"node_id":"MDQ6VXNlcjEyODcyMTc3","avatar_url":"https://avatars2.githubusercontent.com/u/12872177?v=4","gravatar_id":"","url":"https://api.github.com/users/hamxabaig","html_url":"https://github.com/hamxabaig","followers_url":"https://api.github.com/users/hamxabaig/followers","following_url":"https://api.github.com/users/hamxabaig/following{/other_user}","gists_url":"https://api.github.com/users/hamxabaig/gists{/gist_id}","starred_url":"https://api.github.com/users/hamxabaig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamxabaig/subscriptions","organizations_url":"https://api.github.com/users/hamxabaig/orgs","repos_url":"https://api.github.com/users/hamxabaig/repos","events_url":"https://api.github.com/users/hamxabaig/events{/privacy}","received_events_url":"https://api.github.com/users/hamxabaig/received_events","type":"User","site_admin":false},"body":"Read responses guide here https://github.com/thinblock/tb-core-api/wiki/Contribution-Guidelines#responses","created_at":"2018-08-03T12:25:43Z","updated_at":"2018-08-03T12:26:44Z","html_url":"https://github.com/thinblock/tb-core-api/pull/11#discussion_r207528088","pull_request_url":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/thinblock/tb-core-api/pulls/comments/207528088"},"html":{"href":"https://github.com/thinblock/tb-core-api/pull/11#discussion_r207528088"},"pull_request":{"href":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11","id":205646606,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NjQ2NjA2","html_url":"https://github.com/thinblock/tb-core-api/pull/11","diff_url":"https://github.com/thinblock/tb-core-api/pull/11.diff","patch_url":"https://github.com/thinblock/tb-core-api/pull/11.patch","issue_url":"https://api.github.com/repos/thinblock/tb-core-api/issues/11","number":11,"state":"open","locked":false,"title":"Feature/tb 28","user":{"login":"abdullahtariq91","id":19329006,"node_id":"MDQ6VXNlcjE5MzI5MDA2","avatar_url":"https://avatars0.githubusercontent.com/u/19329006?v=4","gravatar_id":"","url":"https://api.github.com/users/abdullahtariq91","html_url":"https://github.com/abdullahtariq91","followers_url":"https://api.github.com/users/abdullahtariq91/followers","following_url":"https://api.github.com/users/abdullahtariq91/following{/other_user}","gists_url":"https://api.github.com/users/abdullahtariq91/gists{/gist_id}","starred_url":"https://api.github.com/users/abdullahtariq91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abdullahtariq91/subscriptions","organizations_url":"https://api.github.com/users/abdullahtariq91/orgs","repos_url":"https://api.github.com/users/abdullahtariq91/repos","events_url":"https://api.github.com/users/abdullahtariq91/events{/privacy}","received_events_url":"https://api.github.com/users/abdullahtariq91/received_events","type":"User","site_admin":false},"body":"Created models for `wallets`, `wallet users`, and `wallet addresses`.\r\nAdded test cases.\r\nAdded the following endpoints:\r\n\r\n```\r\nGET /api/wallets <- get all wallets\r\nGET /api/wallets/:id <- get single wallet\r\nPOST /api/wallets <- create wallet\r\n\r\nGET /api/wallets/:id/addresses <-get wallet addresses\r\nDELETE /api/wallets/:id/addresses/:id <- delete wallet address\r\nPUT /api/wallets/:id/addresses <- add address\r\n\r\nGET /api/wallets/:id/users <- get wallet users\r\nDELETE /api/wallets/:id/users/:id <- delete wallet user\r\nPUT /api/wallets/:id/users <- add user \r\n```\r\n\r\nToDo:\r\nAdd Swagger text\r\nMake Activity Log changes\r\n","created_at":"2018-08-02T07:49:14Z","updated_at":"2018-08-03T12:26:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f691a5854c7984efe1fb92962e741714e8605260","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11/commits","review_comments_url":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11/comments","review_comment_url":"https://api.github.com/repos/thinblock/tb-core-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thinblock/tb-core-api/issues/11/comments","statuses_url":"https://api.github.com/repos/thinblock/tb-core-api/statuses/e010153d121d9e01a6381abacfd43a602c1febd5","head":{"label":"thinblock:feature/tb-28","ref":"feature/tb-28","sha":"e010153d121d9e01a6381abacfd43a602c1febd5","user":{"login":"thinblock","id":38830334,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4ODMwMzM0","avatar_url":"https://avatars3.githubusercontent.com/u/38830334?v=4","gravatar_id":"","url":"https://api.github.com/users/thinblock","html_url":"https://github.com/thinblock","followers_url":"https://api.github.com/users/thinblock/followers","following_url":"https://api.github.com/users/thinblock/following{/other_user}","gists_url":"https://api.github.com/users/thinblock/gists{/gist_id}","starred_url":"https://api.github.com/users/thinblock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thinblock/subscriptions","organizations_url":"https://api.github.com/users/thinblock/orgs","repos_url":"https://api.github.com/users/thinblock/repos","events_url":"https://api.github.com/users/thinblock/events{/privacy}","received_events_url":"https://api.github.com/users/thinblock/received_events","type":"Organization","site_admin":false},"repo":{"id":139976427,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk5NzY0Mjc=","name":"tb-core-api","full_name":"thinblock/tb-core-api","owner":{"login":"thinblock","id":38830334,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4ODMwMzM0","avatar_url":"https://avatars3.githubusercontent.com/u/38830334?v=4","gravatar_id":"","url":"https://api.github.com/users/thinblock","html_url":"https://github.com/thinblock","followers_url":"https://api.github.com/users/thinblock/followers","following_url":"https://api.github.com/users/thinblock/following{/other_user}","gists_url":"https://api.github.com/users/thinblock/gists{/gist_id}","starred_url":"https://api.github.com/users/thinblock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thinblock/subscriptions","organizations_url":"https://api.github.com/users/thinblock/orgs","repos_url":"https://api.github.com/users/thinblock/repos","events_url":"https://api.github.com/users/thinblock/events{/privacy}","received_events_url":"https://api.github.com/users/thinblock/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thinblock/tb-core-api","description":"ThinBlock's Core API using Restify Framework","fork":false,"url":"https://api.github.com/repos/thinblock/tb-core-api","forks_url":"https://api.github.com/repos/thinblock/tb-core-api/forks","keys_url":"https://api.github.com/repos/thinblock/tb-core-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thinblock/tb-core-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thinblock/tb-core-api/teams","hooks_url":"https://api.github.com/repos/thinblock/tb-core-api/hooks","issue_events_url":"https://api.github.com/repos/thinblock/tb-core-api/issues/events{/number}","events_url":"https://api.github.com/repos/thinblock/tb-core-api/events","assignees_url":"https://api.github.com/repos/thinblock/tb-core-api/assignees{/user}","branches_url":"https://api.github.com/repos/thinblock/tb-core-api/branches{/branch}","tags_url":"https://api.github.com/repos/thinblock/tb-core-api/tags","blobs_url":"https://api.github.com/repos/thinblock/tb-core-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thinblock/tb-core-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thinblock/tb-core-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/thinblock/tb-core-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thinblock/tb-core-api/statuses/{sha}","languages_url":"https://api.github.com/repos/thinblock/tb-core-api/languages","stargazers_url":"https://api.github.com/repos/thinblock/tb-core-api/stargazers","contributors_url":"https://api.github.com/repos/thinblock/tb-core-api/contributors","subscribers_url":"https://api.github.com/repos/thinblock/tb-core-api/subscribers","subscription_url":"https://api.github.com/repos/thinblock/tb-core-api/subscription","commits_url":"https://api.github.com/repos/thinblock/tb-core-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/thinblock/tb-core-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/thinblock/tb-core-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/thinblock/tb-core-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/thinblock/tb-core-api/contents/{+path}","compare_url":"https://api.github.com/repos/thinblock/tb-core-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thinblock/tb-core-api/merges","archive_url":"https://api.github.com/repos/thinblock/tb-core-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thinblock/tb-core-api/downloads","issues_url":"https://api.github.com/repos/thinblock/tb-core-api/issues{/number}","pulls_url":"https://api.github.com/repos/thinblock/tb-core-api/pulls{/number}","milestones_url":"https://api.github.com/repos/thinblock/tb-core-api/milestones{/number}","notifications_url":"https://api.github.com/repos/thinblock/tb-core-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thinblock/tb-core-api/labels{/name}","releases_url":"https://api.github.com/repos/thinblock/tb-core-api/releases{/id}","deployments_url":"https://api.github.com/repos/thinblock/tb-core-api/deployments","created_at":"2018-07-06T11:29:51Z","updated_at":"2018-08-02T06:56:00Z","pushed_at":"2018-08-03T10:30:22Z","git_url":"git://github.com/thinblock/tb-core-api.git","ssh_url":"git@github.com:thinblock/tb-core-api.git","clone_url":"https://github.com/thinblock/tb-core-api.git","svn_url":"https://github.com/thinblock/tb-core-api","homepage":null,"size":225,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"base":{"label":"thinblock:development","ref":"development","sha":"a69aea4118bbce46badad2f0c25f4e540185abb0","user":{"login":"thinblock","id":38830334,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4ODMwMzM0","avatar_url":"https://avatars3.githubusercontent.com/u/38830334?v=4","gravatar_id":"","url":"https://api.github.com/users/thinblock","html_url":"https://github.com/thinblock","followers_url":"https://api.github.com/users/thinblock/followers","following_url":"https://api.github.com/users/thinblock/following{/other_user}","gists_url":"https://api.github.com/users/thinblock/gists{/gist_id}","starred_url":"https://api.github.com/users/thinblock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thinblock/subscriptions","organizations_url":"https://api.github.com/users/thinblock/orgs","repos_url":"https://api.github.com/users/thinblock/repos","events_url":"https://api.github.com/users/thinblock/events{/privacy}","received_events_url":"https://api.github.com/users/thinblock/received_events","type":"Organization","site_admin":false},"repo":{"id":139976427,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk5NzY0Mjc=","name":"tb-core-api","full_name":"thinblock/tb-core-api","owner":{"login":"thinblock","id":38830334,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4ODMwMzM0","avatar_url":"https://avatars3.githubusercontent.com/u/38830334?v=4","gravatar_id":"","url":"https://api.github.com/users/thinblock","html_url":"https://github.com/thinblock","followers_url":"https://api.github.com/users/thinblock/followers","following_url":"https://api.github.com/users/thinblock/following{/other_user}","gists_url":"https://api.github.com/users/thinblock/gists{/gist_id}","starred_url":"https://api.github.com/users/thinblock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thinblock/subscriptions","organizations_url":"https://api.github.com/users/thinblock/orgs","repos_url":"https://api.github.com/users/thinblock/repos","events_url":"https://api.github.com/users/thinblock/events{/privacy}","received_events_url":"https://api.github.com/users/thinblock/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thinblock/tb-core-api","description":"ThinBlock's Core API using Restify Framework","fork":false,"url":"https://api.github.com/repos/thinblock/tb-core-api","forks_url":"https://api.github.com/repos/thinblock/tb-core-api/forks","keys_url":"https://api.github.com/repos/thinblock/tb-core-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thinblock/tb-core-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thinblock/tb-core-api/teams","hooks_url":"https://api.github.com/repos/thinblock/tb-core-api/hooks","issue_events_url":"https://api.github.com/repos/thinblock/tb-core-api/issues/events{/number}","events_url":"https://api.github.com/repos/thinblock/tb-core-api/events","assignees_url":"https://api.github.com/repos/thinblock/tb-core-api/assignees{/user}","branches_url":"https://api.github.com/repos/thinblock/tb-core-api/branches{/branch}","tags_url":"https://api.github.com/repos/thinblock/tb-core-api/tags","blobs_url":"https://api.github.com/repos/thinblock/tb-core-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thinblock/tb-core-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thinblock/tb-core-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/thinblock/tb-core-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thinblock/tb-core-api/statuses/{sha}","languages_url":"https://api.github.com/repos/thinblock/tb-core-api/languages","stargazers_url":"https://api.github.com/repos/thinblock/tb-core-api/stargazers","contributors_url":"https://api.github.com/repos/thinblock/tb-core-api/contributors","subscribers_url":"https://api.github.com/repos/thinblock/tb-core-api/subscribers","subscription_url":"https://api.github.com/repos/thinblock/tb-core-api/subscription","commits_url":"https://api.github.com/repos/thinblock/tb-core-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/thinblock/tb-core-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/thinblock/tb-core-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/thinblock/tb-core-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/thinblock/tb-core-api/contents/{+path}","compare_url":"https://api.github.com/repos/thinblock/tb-core-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thinblock/tb-core-api/merges","archive_url":"https://api.github.com/repos/thinblock/tb-core-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thinblock/tb-core-api/downloads","issues_url":"https://api.github.com/repos/thinblock/tb-core-api/issues{/number}","pulls_url":"https://api.github.com/repos/thinblock/tb-core-api/pulls{/number}","milestones_url":"https://api.github.com/repos/thinblock/tb-core-api/milestones{/number}","notifications_url":"https://api.github.com/repos/thinblock/tb-core-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thinblock/tb-core-api/labels{/name}","releases_url":"https://api.github.com/repos/thinblock/tb-core-api/releases{/id}","deployments_url":"https://api.github.com/repos/thinblock/tb-core-api/deployments","created_at":"2018-07-06T11:29:51Z","updated_at":"2018-08-02T06:56:00Z","pushed_at":"2018-08-03T10:30:22Z","git_url":"git://github.com/thinblock/tb-core-api.git","ssh_url":"git@github.com:thinblock/tb-core-api.git","clone_url":"https://github.com/thinblock/tb-core-api.git","svn_url":"https://github.com/thinblock/tb-core-api","homepage":null,"size":225,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11"},"html":{"href":"https://github.com/thinblock/tb-core-api/pull/11"},"issue":{"href":"https://api.github.com/repos/thinblock/tb-core-api/issues/11"},"comments":{"href":"https://api.github.com/repos/thinblock/tb-core-api/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/thinblock/tb-core-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thinblock/tb-core-api/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/thinblock/tb-core-api/statuses/e010153d121d9e01a6381abacfd43a602c1febd5"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"hamxabaig"}}