{"action":"created","comment":{"url":"https://api.github.com/repos/StoryShop/api/pulls/comments/80581945","id":80581945,"diff_hunk":"@@ -196,3 +196,34 @@ export function remove ( collection, user, _id ) {\n     });\n }\n \n+export function archiveNode(nodeLabel, nodeId, userId) {\n+  const query = `\n+   MATCH (i:${nodeLabel} {_id:\"${nodeId}\"})\n+   OPTIONAL MATCH (i)-[r]-(e)\n+   SET i.archived = true, i.archived_at = ${Date.now()}, i.archiver = '${userId}'\n+   return type(r) as type,i._id AS start,e._id AS end`\n+  return this.flatMap(db =>\n+    db.neo.run(query)\n+      .flatMap(record =>\n+        record.get('type') == null\n+          ? Observable.of({start: record.get('start')})\n+          : this::archiveRelationship(record.get('type'),record.get('start'),record.get('end'), userId)\n+      )\n+      .toArray()\n+  )\n+}\n+\n+export function archiveRelationship(relType, fromNodeId, toNodeId, userId) {\n+  const query = `\n+   MATCH (start)-[rel:${relType}]-(end)","path":"src/falcor/transforms/index.js","position":95,"original_position":23,"commit_id":"a2ccef78208f8960c283528f5c261ca877f9ca5b","original_commit_id":"a2ccef78208f8960c283528f5c261ca877f9ca5b","user":{"login":"joshdmiller","id":101793,"avatar_url":"https://avatars.githubusercontent.com/u/101793?v=3","gravatar_id":"","url":"https://api.github.com/users/joshdmiller","html_url":"https://github.com/joshdmiller","followers_url":"https://api.github.com/users/joshdmiller/followers","following_url":"https://api.github.com/users/joshdmiller/following{/other_user}","gists_url":"https://api.github.com/users/joshdmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/joshdmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshdmiller/subscriptions","organizations_url":"https://api.github.com/users/joshdmiller/orgs","repos_url":"https://api.github.com/users/joshdmiller/repos","events_url":"https://api.github.com/users/joshdmiller/events{/privacy}","received_events_url":"https://api.github.com/users/joshdmiller/received_events","type":"User","site_admin":false},"body":"You can do the same pattern matching as above:\r\n\r\n```\r\nMATCH (start {_id: {fromNodeId}})-[rel]->(end {_id: {toNodeId}})\r\nWHERE type(rel) = {relType}\r\n```","created_at":"2016-09-26T21:52:11Z","updated_at":"2016-09-26T21:52:11Z","html_url":"https://github.com/StoryShop/api/pull/47#discussion_r80581945","pull_request_url":"https://api.github.com/repos/StoryShop/api/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/StoryShop/api/pulls/comments/80581945"},"html":{"href":"https://github.com/StoryShop/api/pull/47#discussion_r80581945"},"pull_request":{"href":"https://api.github.com/repos/StoryShop/api/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/StoryShop/api/pulls/47","id":86818742,"html_url":"https://github.com/StoryShop/api/pull/47","diff_url":"https://github.com/StoryShop/api/pull/47.diff","patch_url":"https://github.com/StoryShop/api/pull/47.patch","issue_url":"https://api.github.com/repos/StoryShop/api/issues/47","number":47,"state":"open","locked":false,"title":"feat(helpers): add node archiver and relationship archiver","user":{"login":"itsjgf","id":18426262,"avatar_url":"https://avatars.githubusercontent.com/u/18426262?v=3","gravatar_id":"","url":"https://api.github.com/users/itsjgf","html_url":"https://github.com/itsjgf","followers_url":"https://api.github.com/users/itsjgf/followers","following_url":"https://api.github.com/users/itsjgf/following{/other_user}","gists_url":"https://api.github.com/users/itsjgf/gists{/gist_id}","starred_url":"https://api.github.com/users/itsjgf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsjgf/subscriptions","organizations_url":"https://api.github.com/users/itsjgf/orgs","repos_url":"https://api.github.com/users/itsjgf/repos","events_url":"https://api.github.com/users/itsjgf/events{/privacy}","received_events_url":"https://api.github.com/users/itsjgf/received_events","type":"User","site_admin":false},"body":"#42 is necessary in order to merge this PR\r\n\r\nCloses #11 and #12\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/storyshop/api/47)\n<!-- Reviewable:end -->\n","created_at":"2016-09-26T21:05:36Z","updated_at":"2016-09-26T21:52:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bceddf622f39dff34fa8286dc5a58410e23a82c9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/StoryShop/api/pulls/47/commits","review_comments_url":"https://api.github.com/repos/StoryShop/api/pulls/47/comments","review_comment_url":"https://api.github.com/repos/StoryShop/api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StoryShop/api/issues/47/comments","statuses_url":"https://api.github.com/repos/StoryShop/api/statuses/a2ccef78208f8960c283528f5c261ca877f9ca5b","head":{"label":"StoryShop:archive-relationship","ref":"archive-relationship","sha":"a2ccef78208f8960c283528f5c261ca877f9ca5b","user":{"login":"StoryShop","id":16272322,"avatar_url":"https://avatars.githubusercontent.com/u/16272322?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryShop","html_url":"https://github.com/StoryShop","followers_url":"https://api.github.com/users/StoryShop/followers","following_url":"https://api.github.com/users/StoryShop/following{/other_user}","gists_url":"https://api.github.com/users/StoryShop/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryShop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryShop/subscriptions","organizations_url":"https://api.github.com/users/StoryShop/orgs","repos_url":"https://api.github.com/users/StoryShop/repos","events_url":"https://api.github.com/users/StoryShop/events{/privacy}","received_events_url":"https://api.github.com/users/StoryShop/received_events","type":"Organization","site_admin":false},"repo":{"id":51946237,"name":"api","full_name":"StoryShop/api","owner":{"login":"StoryShop","id":16272322,"avatar_url":"https://avatars.githubusercontent.com/u/16272322?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryShop","html_url":"https://github.com/StoryShop","followers_url":"https://api.github.com/users/StoryShop/followers","following_url":"https://api.github.com/users/StoryShop/following{/other_user}","gists_url":"https://api.github.com/users/StoryShop/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryShop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryShop/subscriptions","organizations_url":"https://api.github.com/users/StoryShop/orgs","repos_url":"https://api.github.com/users/StoryShop/repos","events_url":"https://api.github.com/users/StoryShop/events{/privacy}","received_events_url":"https://api.github.com/users/StoryShop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StoryShop/api","description":"Backend API for the StoryShop app","fork":false,"url":"https://api.github.com/repos/StoryShop/api","forks_url":"https://api.github.com/repos/StoryShop/api/forks","keys_url":"https://api.github.com/repos/StoryShop/api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StoryShop/api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StoryShop/api/teams","hooks_url":"https://api.github.com/repos/StoryShop/api/hooks","issue_events_url":"https://api.github.com/repos/StoryShop/api/issues/events{/number}","events_url":"https://api.github.com/repos/StoryShop/api/events","assignees_url":"https://api.github.com/repos/StoryShop/api/assignees{/user}","branches_url":"https://api.github.com/repos/StoryShop/api/branches{/branch}","tags_url":"https://api.github.com/repos/StoryShop/api/tags","blobs_url":"https://api.github.com/repos/StoryShop/api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StoryShop/api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StoryShop/api/git/refs{/sha}","trees_url":"https://api.github.com/repos/StoryShop/api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StoryShop/api/statuses/{sha}","languages_url":"https://api.github.com/repos/StoryShop/api/languages","stargazers_url":"https://api.github.com/repos/StoryShop/api/stargazers","contributors_url":"https://api.github.com/repos/StoryShop/api/contributors","subscribers_url":"https://api.github.com/repos/StoryShop/api/subscribers","subscription_url":"https://api.github.com/repos/StoryShop/api/subscription","commits_url":"https://api.github.com/repos/StoryShop/api/commits{/sha}","git_commits_url":"https://api.github.com/repos/StoryShop/api/git/commits{/sha}","comments_url":"https://api.github.com/repos/StoryShop/api/comments{/number}","issue_comment_url":"https://api.github.com/repos/StoryShop/api/issues/comments{/number}","contents_url":"https://api.github.com/repos/StoryShop/api/contents/{+path}","compare_url":"https://api.github.com/repos/StoryShop/api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StoryShop/api/merges","archive_url":"https://api.github.com/repos/StoryShop/api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StoryShop/api/downloads","issues_url":"https://api.github.com/repos/StoryShop/api/issues{/number}","pulls_url":"https://api.github.com/repos/StoryShop/api/pulls{/number}","milestones_url":"https://api.github.com/repos/StoryShop/api/milestones{/number}","notifications_url":"https://api.github.com/repos/StoryShop/api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StoryShop/api/labels{/name}","releases_url":"https://api.github.com/repos/StoryShop/api/releases{/id}","deployments_url":"https://api.github.com/repos/StoryShop/api/deployments","created_at":"2016-02-17T18:43:57Z","updated_at":"2016-08-29T19:58:11Z","pushed_at":"2016-09-26T21:05:41Z","git_url":"git://github.com/StoryShop/api.git","ssh_url":"git@github.com:StoryShop/api.git","clone_url":"https://github.com/StoryShop/api.git","svn_url":"https://github.com/StoryShop/api","homepage":null,"size":99,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":43,"forks":2,"open_issues":43,"watchers":5,"default_branch":"master"}},"base":{"label":"StoryShop:master","ref":"master","sha":"81c2adb386a1ee36fb6384d6ad8609362c783df8","user":{"login":"StoryShop","id":16272322,"avatar_url":"https://avatars.githubusercontent.com/u/16272322?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryShop","html_url":"https://github.com/StoryShop","followers_url":"https://api.github.com/users/StoryShop/followers","following_url":"https://api.github.com/users/StoryShop/following{/other_user}","gists_url":"https://api.github.com/users/StoryShop/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryShop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryShop/subscriptions","organizations_url":"https://api.github.com/users/StoryShop/orgs","repos_url":"https://api.github.com/users/StoryShop/repos","events_url":"https://api.github.com/users/StoryShop/events{/privacy}","received_events_url":"https://api.github.com/users/StoryShop/received_events","type":"Organization","site_admin":false},"repo":{"id":51946237,"name":"api","full_name":"StoryShop/api","owner":{"login":"StoryShop","id":16272322,"avatar_url":"https://avatars.githubusercontent.com/u/16272322?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryShop","html_url":"https://github.com/StoryShop","followers_url":"https://api.github.com/users/StoryShop/followers","following_url":"https://api.github.com/users/StoryShop/following{/other_user}","gists_url":"https://api.github.com/users/StoryShop/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryShop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryShop/subscriptions","organizations_url":"https://api.github.com/users/StoryShop/orgs","repos_url":"https://api.github.com/users/StoryShop/repos","events_url":"https://api.github.com/users/StoryShop/events{/privacy}","received_events_url":"https://api.github.com/users/StoryShop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StoryShop/api","description":"Backend API for the StoryShop app","fork":false,"url":"https://api.github.com/repos/StoryShop/api","forks_url":"https://api.github.com/repos/StoryShop/api/forks","keys_url":"https://api.github.com/repos/StoryShop/api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StoryShop/api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StoryShop/api/teams","hooks_url":"https://api.github.com/repos/StoryShop/api/hooks","issue_events_url":"https://api.github.com/repos/StoryShop/api/issues/events{/number}","events_url":"https://api.github.com/repos/StoryShop/api/events","assignees_url":"https://api.github.com/repos/StoryShop/api/assignees{/user}","branches_url":"https://api.github.com/repos/StoryShop/api/branches{/branch}","tags_url":"https://api.github.com/repos/StoryShop/api/tags","blobs_url":"https://api.github.com/repos/StoryShop/api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StoryShop/api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StoryShop/api/git/refs{/sha}","trees_url":"https://api.github.com/repos/StoryShop/api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StoryShop/api/statuses/{sha}","languages_url":"https://api.github.com/repos/StoryShop/api/languages","stargazers_url":"https://api.github.com/repos/StoryShop/api/stargazers","contributors_url":"https://api.github.com/repos/StoryShop/api/contributors","subscribers_url":"https://api.github.com/repos/StoryShop/api/subscribers","subscription_url":"https://api.github.com/repos/StoryShop/api/subscription","commits_url":"https://api.github.com/repos/StoryShop/api/commits{/sha}","git_commits_url":"https://api.github.com/repos/StoryShop/api/git/commits{/sha}","comments_url":"https://api.github.com/repos/StoryShop/api/comments{/number}","issue_comment_url":"https://api.github.com/repos/StoryShop/api/issues/comments{/number}","contents_url":"https://api.github.com/repos/StoryShop/api/contents/{+path}","compare_url":"https://api.github.com/repos/StoryShop/api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StoryShop/api/merges","archive_url":"https://api.github.com/repos/StoryShop/api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StoryShop/api/downloads","issues_url":"https://api.github.com/repos/StoryShop/api/issues{/number}","pulls_url":"https://api.github.com/repos/StoryShop/api/pulls{/number}","milestones_url":"https://api.github.com/repos/StoryShop/api/milestones{/number}","notifications_url":"https://api.github.com/repos/StoryShop/api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StoryShop/api/labels{/name}","releases_url":"https://api.github.com/repos/StoryShop/api/releases{/id}","deployments_url":"https://api.github.com/repos/StoryShop/api/deployments","created_at":"2016-02-17T18:43:57Z","updated_at":"2016-08-29T19:58:11Z","pushed_at":"2016-09-26T21:05:41Z","git_url":"git://github.com/StoryShop/api.git","ssh_url":"git@github.com:StoryShop/api.git","clone_url":"https://github.com/StoryShop/api.git","svn_url":"https://github.com/StoryShop/api","homepage":null,"size":99,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":43,"forks":2,"open_issues":43,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StoryShop/api/pulls/47"},"html":{"href":"https://github.com/StoryShop/api/pull/47"},"issue":{"href":"https://api.github.com/repos/StoryShop/api/issues/47"},"comments":{"href":"https://api.github.com/repos/StoryShop/api/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/StoryShop/api/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/StoryShop/api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StoryShop/api/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/StoryShop/api/statuses/a2ccef78208f8960c283528f5c261ca877f9ca5b"}}}}
{"actor":{"display_login":"joshdmiller"}}