{"action":"opened","number":193,"pull_request":{"url":"https://api.github.com/repos/scitran/core/pulls/193","id":62603288,"html_url":"https://github.com/scitran/core/pull/193","diff_url":"https://github.com/scitran/core/pull/193.diff","patch_url":"https://github.com/scitran/core/pull/193.patch","issue_url":"https://api.github.com/repos/scitran/core/issues/193","number":193,"state":"open","locked":false,"title":"Add origin tracking to files","user":{"login":"kofalt","id":265071,"avatar_url":"https://avatars.githubusercontent.com/u/265071?v=3","gravatar_id":"","url":"https://api.github.com/users/kofalt","html_url":"https://github.com/kofalt","followers_url":"https://api.github.com/users/kofalt/followers","following_url":"https://api.github.com/users/kofalt/following{/other_user}","gists_url":"https://api.github.com/users/kofalt/gists{/gist_id}","starred_url":"https://api.github.com/users/kofalt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kofalt/subscriptions","organizations_url":"https://api.github.com/users/kofalt/orgs","repos_url":"https://api.github.com/users/kofalt/repos","events_url":"https://api.github.com/users/kofalt/events{/privacy}","received_events_url":"https://api.github.com/users/kofalt/received_events","type":"User","site_admin":false},"body":"All files now have an `origin` map, with a `type` string (device, user, job, or unknown) and an `id` field pointing to the corresponding document. If a file was stored before this change, the type returns unknown.\r\n\r\nIn addition, routes that return an object, or objects, with a `files` array, can now take an optional `join=origin` request parameter. This will add a `join-origin` key to each object, containing a context map of the various origin documents. Use this to prevent N calls to various other endpoints. \r\n\r\nExample:\r\n\r\n```js\r\n// on the file object\r\n \"origin\": {\r\n      \"type\": \"user\",  // can be user | device | job | unknown\r\n      \"id\": \"nathanielkofalt@invenshure.com\"\r\n    }\r\n```\r\n\r\nExample of a `join-origin`:\r\n\r\n```js\r\n{\r\n    \"files\": [ \r\n        { \"origin\": { \"type\":\"user\", \"id\":\"foo\" }}\r\n        // ... \r\n    ],\r\n\r\n    \"join-origin\": {\r\n        \"users\":    {\"foo\": obj, \"bar\": obj },\r\n        \"devices\":  {\"foo\": obj},\r\n        \"jobs\":     {\"foo\": obj}\r\n    }\r\n}\r\n```\r\n\r\nAlong the way, the job generator had to gain additional insight to throw job IDs onto upload URLs, the Placer gained an origin field for placing files, not-Placer uploads had origin hacked into them, and the base request init now knows a bit more about the requester.","created_at":"2016-03-11T21:12:49Z","updated_at":"2016-03-11T21:12:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scitran/core/pulls/193/commits","review_comments_url":"https://api.github.com/repos/scitran/core/pulls/193/comments","review_comment_url":"https://api.github.com/repos/scitran/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scitran/core/issues/193/comments","statuses_url":"https://api.github.com/repos/scitran/core/statuses/de76bb384197d8923cf2cefcda2321dfc2e3015e","head":{"label":"scitran:origin","ref":"origin","sha":"de76bb384197d8923cf2cefcda2321dfc2e3015e","user":{"login":"scitran","id":7379762,"avatar_url":"https://avatars.githubusercontent.com/u/7379762?v=3","gravatar_id":"","url":"https://api.github.com/users/scitran","html_url":"https://github.com/scitran","followers_url":"https://api.github.com/users/scitran/followers","following_url":"https://api.github.com/users/scitran/following{/other_user}","gists_url":"https://api.github.com/users/scitran/gists{/gist_id}","starred_url":"https://api.github.com/users/scitran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scitran/subscriptions","organizations_url":"https://api.github.com/users/scitran/orgs","repos_url":"https://api.github.com/users/scitran/repos","events_url":"https://api.github.com/users/scitran/events{/privacy}","received_events_url":"https://api.github.com/users/scitran/received_events","type":"Organization","site_admin":false},"repo":{"id":16557832,"name":"core","full_name":"scitran/core","owner":{"login":"scitran","id":7379762,"avatar_url":"https://avatars.githubusercontent.com/u/7379762?v=3","gravatar_id":"","url":"https://api.github.com/users/scitran","html_url":"https://github.com/scitran","followers_url":"https://api.github.com/users/scitran/followers","following_url":"https://api.github.com/users/scitran/following{/other_user}","gists_url":"https://api.github.com/users/scitran/gists{/gist_id}","starred_url":"https://api.github.com/users/scitran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scitran/subscriptions","organizations_url":"https://api.github.com/users/scitran/orgs","repos_url":"https://api.github.com/users/scitran/repos","events_url":"https://api.github.com/users/scitran/events{/privacy}","received_events_url":"https://api.github.com/users/scitran/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scitran/core","description":"SciTran RESTful API","fork":false,"url":"https://api.github.com/repos/scitran/core","forks_url":"https://api.github.com/repos/scitran/core/forks","keys_url":"https://api.github.com/repos/scitran/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scitran/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scitran/core/teams","hooks_url":"https://api.github.com/repos/scitran/core/hooks","issue_events_url":"https://api.github.com/repos/scitran/core/issues/events{/number}","events_url":"https://api.github.com/repos/scitran/core/events","assignees_url":"https://api.github.com/repos/scitran/core/assignees{/user}","branches_url":"https://api.github.com/repos/scitran/core/branches{/branch}","tags_url":"https://api.github.com/repos/scitran/core/tags","blobs_url":"https://api.github.com/repos/scitran/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scitran/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scitran/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/scitran/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scitran/core/statuses/{sha}","languages_url":"https://api.github.com/repos/scitran/core/languages","stargazers_url":"https://api.github.com/repos/scitran/core/stargazers","contributors_url":"https://api.github.com/repos/scitran/core/contributors","subscribers_url":"https://api.github.com/repos/scitran/core/subscribers","subscription_url":"https://api.github.com/repos/scitran/core/subscription","commits_url":"https://api.github.com/repos/scitran/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/scitran/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/scitran/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/scitran/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/scitran/core/contents/{+path}","compare_url":"https://api.github.com/repos/scitran/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scitran/core/merges","archive_url":"https://api.github.com/repos/scitran/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scitran/core/downloads","issues_url":"https://api.github.com/repos/scitran/core/issues{/number}","pulls_url":"https://api.github.com/repos/scitran/core/pulls{/number}","milestones_url":"https://api.github.com/repos/scitran/core/milestones{/number}","notifications_url":"https://api.github.com/repos/scitran/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scitran/core/labels{/name}","releases_url":"https://api.github.com/repos/scitran/core/releases{/id}","deployments_url":"https://api.github.com/repos/scitran/core/deployments","created_at":"2014-02-05T20:48:50Z","updated_at":"2016-02-16T18:37:05Z","pushed_at":"2016-03-11T21:12:49Z","git_url":"git://github.com/scitran/core.git","ssh_url":"git@github.com:scitran/core.git","clone_url":"https://github.com/scitran/core.git","svn_url":"https://github.com/scitran/core","homepage":"","size":1143,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":29,"forks":6,"open_issues":29,"watchers":4,"default_branch":"master"}},"base":{"label":"scitran:master","ref":"master","sha":"02003945157d47bcec4c33c86d41dd5c4fd2ba5e","user":{"login":"scitran","id":7379762,"avatar_url":"https://avatars.githubusercontent.com/u/7379762?v=3","gravatar_id":"","url":"https://api.github.com/users/scitran","html_url":"https://github.com/scitran","followers_url":"https://api.github.com/users/scitran/followers","following_url":"https://api.github.com/users/scitran/following{/other_user}","gists_url":"https://api.github.com/users/scitran/gists{/gist_id}","starred_url":"https://api.github.com/users/scitran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scitran/subscriptions","organizations_url":"https://api.github.com/users/scitran/orgs","repos_url":"https://api.github.com/users/scitran/repos","events_url":"https://api.github.com/users/scitran/events{/privacy}","received_events_url":"https://api.github.com/users/scitran/received_events","type":"Organization","site_admin":false},"repo":{"id":16557832,"name":"core","full_name":"scitran/core","owner":{"login":"scitran","id":7379762,"avatar_url":"https://avatars.githubusercontent.com/u/7379762?v=3","gravatar_id":"","url":"https://api.github.com/users/scitran","html_url":"https://github.com/scitran","followers_url":"https://api.github.com/users/scitran/followers","following_url":"https://api.github.com/users/scitran/following{/other_user}","gists_url":"https://api.github.com/users/scitran/gists{/gist_id}","starred_url":"https://api.github.com/users/scitran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scitran/subscriptions","organizations_url":"https://api.github.com/users/scitran/orgs","repos_url":"https://api.github.com/users/scitran/repos","events_url":"https://api.github.com/users/scitran/events{/privacy}","received_events_url":"https://api.github.com/users/scitran/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scitran/core","description":"SciTran RESTful API","fork":false,"url":"https://api.github.com/repos/scitran/core","forks_url":"https://api.github.com/repos/scitran/core/forks","keys_url":"https://api.github.com/repos/scitran/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scitran/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scitran/core/teams","hooks_url":"https://api.github.com/repos/scitran/core/hooks","issue_events_url":"https://api.github.com/repos/scitran/core/issues/events{/number}","events_url":"https://api.github.com/repos/scitran/core/events","assignees_url":"https://api.github.com/repos/scitran/core/assignees{/user}","branches_url":"https://api.github.com/repos/scitran/core/branches{/branch}","tags_url":"https://api.github.com/repos/scitran/core/tags","blobs_url":"https://api.github.com/repos/scitran/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scitran/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scitran/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/scitran/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scitran/core/statuses/{sha}","languages_url":"https://api.github.com/repos/scitran/core/languages","stargazers_url":"https://api.github.com/repos/scitran/core/stargazers","contributors_url":"https://api.github.com/repos/scitran/core/contributors","subscribers_url":"https://api.github.com/repos/scitran/core/subscribers","subscription_url":"https://api.github.com/repos/scitran/core/subscription","commits_url":"https://api.github.com/repos/scitran/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/scitran/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/scitran/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/scitran/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/scitran/core/contents/{+path}","compare_url":"https://api.github.com/repos/scitran/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scitran/core/merges","archive_url":"https://api.github.com/repos/scitran/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scitran/core/downloads","issues_url":"https://api.github.com/repos/scitran/core/issues{/number}","pulls_url":"https://api.github.com/repos/scitran/core/pulls{/number}","milestones_url":"https://api.github.com/repos/scitran/core/milestones{/number}","notifications_url":"https://api.github.com/repos/scitran/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scitran/core/labels{/name}","releases_url":"https://api.github.com/repos/scitran/core/releases{/id}","deployments_url":"https://api.github.com/repos/scitran/core/deployments","created_at":"2014-02-05T20:48:50Z","updated_at":"2016-02-16T18:37:05Z","pushed_at":"2016-03-11T21:12:49Z","git_url":"git://github.com/scitran/core.git","ssh_url":"git@github.com:scitran/core.git","clone_url":"https://github.com/scitran/core.git","svn_url":"https://github.com/scitran/core","homepage":"","size":1143,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":29,"forks":6,"open_issues":29,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scitran/core/pulls/193"},"html":{"href":"https://github.com/scitran/core/pull/193"},"issue":{"href":"https://api.github.com/repos/scitran/core/issues/193"},"comments":{"href":"https://api.github.com/repos/scitran/core/issues/193/comments"},"review_comments":{"href":"https://api.github.com/repos/scitran/core/pulls/193/comments"},"review_comment":{"href":"https://api.github.com/repos/scitran/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scitran/core/pulls/193/commits"},"statuses":{"href":"https://api.github.com/repos/scitran/core/statuses/de76bb384197d8923cf2cefcda2321dfc2e3015e"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":159,"deletions":15,"changed_files":8}}