{"action":"created","comment":{"url":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/comments/116406079","pull_request_review_id":38024433,"id":116406079,"diff_hunk":"@@ -0,0 +1,63 @@\n+var Router = require('restify-router').Router;;\n+var router = new Router();\n+var map = require('bateeq-module').inventory.map;\n+var db = require('../../../db');\n+var resultFormatter = require(\"../../../result-formatter\");\n+var ObjectId = require(\"mongodb\").ObjectId;\n+var passport = require('../../../passports/jwt-passport');\n+const apiVersion = '1.0.0';\n+\n+router.get('/:id/exportall', passport, (request, response, next) => {\n+    db.get().then(db => {\n+        var Manager = map.get(\"efr-kb-rtu\");\n+        var manager = new Manager(db, request.user);\n+\n+        var id = request.params.id;\n+\n+        manager.getSingleById(id)\n+            .then(doc => {\n+                var dateFormat = \"DD MMM YYYY\";\n+                var locale = 'id-ID';\n+                var moment = require('moment');\n+                moment.locale(locale);\n+                var data = [];\n+                var index = 0;\n+                for (var item of doc.items) {\n+                    var _data = {\n+                        \"Nomor Referensi\": doc.code,\n+                        \"Dari\": doc.source.code,\n+                        \"Ke\": doc.destination.code,\n+                        \"Barcode\": item.item.code,\n+                        \"Nama\": item.item.name,\n+                        \"Kuantitas Pengiriman\": item.quantity,\n+                        \"Harga\": item.quantity * item.item.domesticSale,\n+                        \"Catatan\": item.remark\n+                    }\n+                    data.push(_data);\n+                }\n+\n+                if ((request.headers.accept || '').toString().indexOf(\"application/xls\") < 0) {\n+                    var result = resultFormatter.ok(apiVersion, 200, data);\n+                    response.send(200, result);\n+                } else {\n+                    var options = {\n+                        \"Nomor Referensi\": \"string\",\n+                        \"Dari\": \"string\",\n+                        \"Ke\": \"string\",\n+                        \"Barcode\": \"string\",\n+                        \"Nama\": \"string\",\n+                        \"QTY\": \"number\",\n+                        \"Catatan\": \"string\"\n+                    };\n+                    response.xls(`Report RTU - ${moment(new Date()).format(dateFormat)}.xlsx`, data, options);\n+                }\n+            })\n+            .catch(e => {","path":"src/routers/v1/inventory/inventory-efr-kb-rtu-module-router.js","position":55,"original_position":55,"commit_id":"2ee1e47c411e80d95de6b8d17ce19cf5da329f93","original_commit_id":"2ee1e47c411e80d95de6b8d17ce19cf5da329f93","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars3.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').","created_at":"2017-05-15T03:54:18Z","updated_at":"2017-05-15T03:54:19Z","html_url":"https://github.com/danliris/bateeq-inventory-api/pull/70#discussion_r116406079","pull_request_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/comments/116406079"},"html":{"href":"https://github.com/danliris/bateeq-inventory-api/pull/70#discussion_r116406079"},"pull_request":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70","id":120520819,"html_url":"https://github.com/danliris/bateeq-inventory-api/pull/70","diff_url":"https://github.com/danliris/bateeq-inventory-api/pull/70.diff","patch_url":"https://github.com/danliris/bateeq-inventory-api/pull/70.patch","issue_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/issues/70","number":70,"state":"open","locked":false,"title":"add router report and module rtu","user":{"login":"JanuitaM","id":19768390,"avatar_url":"https://avatars2.githubusercontent.com/u/19768390?v=3","gravatar_id":"","url":"https://api.github.com/users/JanuitaM","html_url":"https://github.com/JanuitaM","followers_url":"https://api.github.com/users/JanuitaM/followers","following_url":"https://api.github.com/users/JanuitaM/following{/other_user}","gists_url":"https://api.github.com/users/JanuitaM/gists{/gist_id}","starred_url":"https://api.github.com/users/JanuitaM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanuitaM/subscriptions","organizations_url":"https://api.github.com/users/JanuitaM/orgs","repos_url":"https://api.github.com/users/JanuitaM/repos","events_url":"https://api.github.com/users/JanuitaM/events{/privacy}","received_events_url":"https://api.github.com/users/JanuitaM/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-05-15T03:54:07Z","updated_at":"2017-05-15T03:54:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6e86c5c78e2392e432ced776ae01279227b8e690","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70/commits","review_comments_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70/comments","review_comment_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/issues/70/comments","statuses_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/statuses/2ee1e47c411e80d95de6b8d17ce19cf5da329f93","head":{"label":"JanuitaM:dev","ref":"dev","sha":"2ee1e47c411e80d95de6b8d17ce19cf5da329f93","user":{"login":"JanuitaM","id":19768390,"avatar_url":"https://avatars2.githubusercontent.com/u/19768390?v=3","gravatar_id":"","url":"https://api.github.com/users/JanuitaM","html_url":"https://github.com/JanuitaM","followers_url":"https://api.github.com/users/JanuitaM/followers","following_url":"https://api.github.com/users/JanuitaM/following{/other_user}","gists_url":"https://api.github.com/users/JanuitaM/gists{/gist_id}","starred_url":"https://api.github.com/users/JanuitaM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanuitaM/subscriptions","organizations_url":"https://api.github.com/users/JanuitaM/orgs","repos_url":"https://api.github.com/users/JanuitaM/repos","events_url":"https://api.github.com/users/JanuitaM/events{/privacy}","received_events_url":"https://api.github.com/users/JanuitaM/received_events","type":"User","site_admin":false},"repo":{"id":78837467,"name":"bateeq-inventory-api","full_name":"JanuitaM/bateeq-inventory-api","owner":{"login":"JanuitaM","id":19768390,"avatar_url":"https://avatars2.githubusercontent.com/u/19768390?v=3","gravatar_id":"","url":"https://api.github.com/users/JanuitaM","html_url":"https://github.com/JanuitaM","followers_url":"https://api.github.com/users/JanuitaM/followers","following_url":"https://api.github.com/users/JanuitaM/following{/other_user}","gists_url":"https://api.github.com/users/JanuitaM/gists{/gist_id}","starred_url":"https://api.github.com/users/JanuitaM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanuitaM/subscriptions","organizations_url":"https://api.github.com/users/JanuitaM/orgs","repos_url":"https://api.github.com/users/JanuitaM/repos","events_url":"https://api.github.com/users/JanuitaM/events{/privacy}","received_events_url":"https://api.github.com/users/JanuitaM/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JanuitaM/bateeq-inventory-api","description":"RESTful api for bateeq inventory","fork":true,"url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api","forks_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/forks","keys_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/teams","hooks_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/hooks","issue_events_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/issues/events{/number}","events_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/events","assignees_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/assignees{/user}","branches_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/branches{/branch}","tags_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/tags","blobs_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/statuses/{sha}","languages_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/languages","stargazers_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/stargazers","contributors_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/contributors","subscribers_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/subscribers","subscription_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/subscription","commits_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/contents/{+path}","compare_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/merges","archive_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/downloads","issues_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/issues{/number}","pulls_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/pulls{/number}","milestones_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/milestones{/number}","notifications_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/labels{/name}","releases_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/releases{/id}","deployments_url":"https://api.github.com/repos/JanuitaM/bateeq-inventory-api/deployments","created_at":"2017-01-13T10:00:16Z","updated_at":"2017-01-13T10:00:19Z","pushed_at":"2017-05-15T03:53:39Z","git_url":"git://github.com/JanuitaM/bateeq-inventory-api.git","ssh_url":"git@github.com:JanuitaM/bateeq-inventory-api.git","clone_url":"https://github.com/JanuitaM/bateeq-inventory-api.git","svn_url":"https://github.com/JanuitaM/bateeq-inventory-api","homepage":null,"size":263,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"danliris:dev","ref":"dev","sha":"57b1cad2380f93514a1e760fd3df8a55d5498a4f","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars3.githubusercontent.com/u/20855729?v=3","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":62210070,"name":"bateeq-inventory-api","full_name":"danliris/bateeq-inventory-api","owner":{"login":"danliris","id":20855729,"avatar_url":"https://avatars3.githubusercontent.com/u/20855729?v=3","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danliris/bateeq-inventory-api","description":"RESTful api for bateeq inventory","fork":false,"url":"https://api.github.com/repos/danliris/bateeq-inventory-api","forks_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/forks","keys_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/teams","hooks_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/hooks","issue_events_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/events","assignees_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/tags","blobs_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/languages","stargazers_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/stargazers","contributors_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/contributors","subscribers_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/subscribers","subscription_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/subscription","commits_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/merges","archive_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/downloads","issues_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/labels{/name}","releases_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/bateeq-inventory-api/deployments","created_at":"2016-06-29T08:39:52Z","updated_at":"2016-08-08T03:17:10Z","pushed_at":"2017-05-15T03:54:07Z","git_url":"git://github.com/danliris/bateeq-inventory-api.git","ssh_url":"git@github.com:danliris/bateeq-inventory-api.git","clone_url":"https://github.com/danliris/bateeq-inventory-api.git","svn_url":"https://github.com/danliris/bateeq-inventory-api","homepage":null,"size":263,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70"},"html":{"href":"https://github.com/danliris/bateeq-inventory-api/pull/70"},"issue":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/issues/70"},"comments":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/danliris/bateeq-inventory-api/statuses/2ee1e47c411e80d95de6b8d17ce19cf5da329f93"}}}}
{"actor":{"display_login":"houndci-bot"}}