{"action":"created","comment":{"url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/comments/154891513","pull_request_review_id":81120315,"id":154891513,"diff_hunk":"@@ -0,0 +1,55 @@\n+//\n+//  HistoryViewModel.swift\n+//  ATFoody\n+//\n+//  Created by Phu Tran on 12/1/17.\n+//  Copyright © 2017 Asian Tech. All rights reserved.\n+//\n+\n+import Foundation\n+import RealmS\n+import RealmSwift\n+import MVVM\n+\n+final class HistoryViewModel: ViewModel {\n+    func getVenue(by id: String) -> Venue {\n+        let realm = RealmS()\n+        if let venue = realm.objects(Venue.self).filter({ (venue) -> Bool in\n+                venue.id == id\n+            }).first {\n+            return venue\n+        } else {\n+            return Venue()\n+        }\n+    }\n+\n+    var histories: [History] {\n+        var result: [History] = []\n+        let realm = RealmS()\n+        let objc = realm.objects(History.self)\n+        result.append(contentsOf: objc)\n+        return result\n+    }\n+\n+    func deleteVenueHistory(venueId: String) {\n+        let realm = RealmS()\n+        realm.write {\n+            if let history = realm.objects(History.self).filter(\"venueId = '\\(venueId)'\").first {","path":"ATFoody/View/Controller/History/HistoryViewModel.swift","position":37,"original_position":37,"commit_id":"589d3fae266c5a464716ad422cf402059d3f82e5","original_commit_id":"9435ccf5f0198e7598c8e412fee1b97e625532cc","user":{"login":"at-daiho","id":13515505,"avatar_url":"https://avatars2.githubusercontent.com/u/13515505?v=4","gravatar_id":"","url":"https://api.github.com/users/at-daiho","html_url":"https://github.com/at-daiho","followers_url":"https://api.github.com/users/at-daiho/followers","following_url":"https://api.github.com/users/at-daiho/following{/other_user}","gists_url":"https://api.github.com/users/at-daiho/gists{/gist_id}","starred_url":"https://api.github.com/users/at-daiho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-daiho/subscriptions","organizations_url":"https://api.github.com/users/at-daiho/orgs","repos_url":"https://api.github.com/users/at-daiho/repos","events_url":"https://api.github.com/users/at-daiho/events{/privacy}","received_events_url":"https://api.github.com/users/at-daiho/received_events","type":"User","site_admin":false},"body":"WARNING - Prefer using `.first(where:)` over `.filter { }.first` in collections.\n","created_at":"2017-12-05T09:42:18Z","updated_at":"2017-12-05T09:42:18Z","html_url":"https://github.com/blkbrds/intern09-phut/pull/23#discussion_r154891513","pull_request_url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/comments/154891513"},"html":{"href":"https://github.com/blkbrds/intern09-phut/pull/23#discussion_r154891513"},"pull_request":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23","id":156390660,"html_url":"https://github.com/blkbrds/intern09-phut/pull/23","diff_url":"https://github.com/blkbrds/intern09-phut/pull/23.diff","patch_url":"https://github.com/blkbrds/intern09-phut/pull/23.patch","issue_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues/23","number":23,"state":"open","locked":false,"title":"feature - history venue","user":{"login":"at-phutran","id":32055580,"avatar_url":"https://avatars0.githubusercontent.com/u/32055580?v=4","gravatar_id":"","url":"https://api.github.com/users/at-phutran","html_url":"https://github.com/at-phutran","followers_url":"https://api.github.com/users/at-phutran/followers","following_url":"https://api.github.com/users/at-phutran/following{/other_user}","gists_url":"https://api.github.com/users/at-phutran/gists{/gist_id}","starred_url":"https://api.github.com/users/at-phutran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-phutran/subscriptions","organizations_url":"https://api.github.com/users/at-phutran/orgs","repos_url":"https://api.github.com/users/at-phutran/repos","events_url":"https://api.github.com/users/at-phutran/events{/privacy}","received_events_url":"https://api.github.com/users/at-phutran/received_events","type":"User","site_admin":false},"body":"- UI\r\n- Save the venue has been viewed recently\r\n- Load history list from DB\r\n- Delete history","created_at":"2017-12-05T07:36:12Z","updated_at":"2017-12-05T09:42:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"57302fa36ae9b49072d5c28df86344259f827005","assignee":null,"assignees":[],"requested_reviewers":[{"login":"at-quangphu","id":22438112,"avatar_url":"https://avatars1.githubusercontent.com/u/22438112?v=4","gravatar_id":"","url":"https://api.github.com/users/at-quangphu","html_url":"https://github.com/at-quangphu","followers_url":"https://api.github.com/users/at-quangphu/followers","following_url":"https://api.github.com/users/at-quangphu/following{/other_user}","gists_url":"https://api.github.com/users/at-quangphu/gists{/gist_id}","starred_url":"https://api.github.com/users/at-quangphu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-quangphu/subscriptions","organizations_url":"https://api.github.com/users/at-quangphu/orgs","repos_url":"https://api.github.com/users/at-quangphu/repos","events_url":"https://api.github.com/users/at-quangphu/events{/privacy}","received_events_url":"https://api.github.com/users/at-quangphu/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23/commits","review_comments_url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23/comments","review_comment_url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/comments{/number}","comments_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues/23/comments","statuses_url":"https://api.github.com/repos/blkbrds/intern09-phut/statuses/589d3fae266c5a464716ad422cf402059d3f82e5","head":{"label":"blkbrds:feature/history-venue","ref":"feature/history-venue","sha":"589d3fae266c5a464716ad422cf402059d3f82e5","user":{"login":"blkbrds","id":28261672,"avatar_url":"https://avatars1.githubusercontent.com/u/28261672?v=4","gravatar_id":"","url":"https://api.github.com/users/blkbrds","html_url":"https://github.com/blkbrds","followers_url":"https://api.github.com/users/blkbrds/followers","following_url":"https://api.github.com/users/blkbrds/following{/other_user}","gists_url":"https://api.github.com/users/blkbrds/gists{/gist_id}","starred_url":"https://api.github.com/users/blkbrds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blkbrds/subscriptions","organizations_url":"https://api.github.com/users/blkbrds/orgs","repos_url":"https://api.github.com/users/blkbrds/repos","events_url":"https://api.github.com/users/blkbrds/events{/privacy}","received_events_url":"https://api.github.com/users/blkbrds/received_events","type":"Organization","site_admin":false},"repo":{"id":104010626,"name":"intern09-phut","full_name":"blkbrds/intern09-phut","owner":{"login":"blkbrds","id":28261672,"avatar_url":"https://avatars1.githubusercontent.com/u/28261672?v=4","gravatar_id":"","url":"https://api.github.com/users/blkbrds","html_url":"https://github.com/blkbrds","followers_url":"https://api.github.com/users/blkbrds/followers","following_url":"https://api.github.com/users/blkbrds/following{/other_user}","gists_url":"https://api.github.com/users/blkbrds/gists{/gist_id}","starred_url":"https://api.github.com/users/blkbrds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blkbrds/subscriptions","organizations_url":"https://api.github.com/users/blkbrds/orgs","repos_url":"https://api.github.com/users/blkbrds/repos","events_url":"https://api.github.com/users/blkbrds/events{/privacy}","received_events_url":"https://api.github.com/users/blkbrds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/blkbrds/intern09-phut","description":"iOS intern - Trần Phú","fork":false,"url":"https://api.github.com/repos/blkbrds/intern09-phut","forks_url":"https://api.github.com/repos/blkbrds/intern09-phut/forks","keys_url":"https://api.github.com/repos/blkbrds/intern09-phut/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blkbrds/intern09-phut/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blkbrds/intern09-phut/teams","hooks_url":"https://api.github.com/repos/blkbrds/intern09-phut/hooks","issue_events_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues/events{/number}","events_url":"https://api.github.com/repos/blkbrds/intern09-phut/events","assignees_url":"https://api.github.com/repos/blkbrds/intern09-phut/assignees{/user}","branches_url":"https://api.github.com/repos/blkbrds/intern09-phut/branches{/branch}","tags_url":"https://api.github.com/repos/blkbrds/intern09-phut/tags","blobs_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/refs{/sha}","trees_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blkbrds/intern09-phut/statuses/{sha}","languages_url":"https://api.github.com/repos/blkbrds/intern09-phut/languages","stargazers_url":"https://api.github.com/repos/blkbrds/intern09-phut/stargazers","contributors_url":"https://api.github.com/repos/blkbrds/intern09-phut/contributors","subscribers_url":"https://api.github.com/repos/blkbrds/intern09-phut/subscribers","subscription_url":"https://api.github.com/repos/blkbrds/intern09-phut/subscription","commits_url":"https://api.github.com/repos/blkbrds/intern09-phut/commits{/sha}","git_commits_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/commits{/sha}","comments_url":"https://api.github.com/repos/blkbrds/intern09-phut/comments{/number}","issue_comment_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues/comments{/number}","contents_url":"https://api.github.com/repos/blkbrds/intern09-phut/contents/{+path}","compare_url":"https://api.github.com/repos/blkbrds/intern09-phut/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blkbrds/intern09-phut/merges","archive_url":"https://api.github.com/repos/blkbrds/intern09-phut/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blkbrds/intern09-phut/downloads","issues_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues{/number}","pulls_url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls{/number}","milestones_url":"https://api.github.com/repos/blkbrds/intern09-phut/milestones{/number}","notifications_url":"https://api.github.com/repos/blkbrds/intern09-phut/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blkbrds/intern09-phut/labels{/name}","releases_url":"https://api.github.com/repos/blkbrds/intern09-phut/releases{/id}","deployments_url":"https://api.github.com/repos/blkbrds/intern09-phut/deployments","created_at":"2017-09-19T01:30:29Z","updated_at":"2017-11-02T05:50:33Z","pushed_at":"2017-12-05T09:23:42Z","git_url":"git://github.com/blkbrds/intern09-phut.git","ssh_url":"git@github.com:blkbrds/intern09-phut.git","clone_url":"https://github.com/blkbrds/intern09-phut.git","svn_url":"https://github.com/blkbrds/intern09-phut","homepage":null,"size":2007,"stargazers_count":0,"watchers_count":0,"language":"Swift","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":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"blkbrds:master","ref":"master","sha":"6e5b7b2791a3b11fa1c72b2b793bafd5ce0387cf","user":{"login":"blkbrds","id":28261672,"avatar_url":"https://avatars1.githubusercontent.com/u/28261672?v=4","gravatar_id":"","url":"https://api.github.com/users/blkbrds","html_url":"https://github.com/blkbrds","followers_url":"https://api.github.com/users/blkbrds/followers","following_url":"https://api.github.com/users/blkbrds/following{/other_user}","gists_url":"https://api.github.com/users/blkbrds/gists{/gist_id}","starred_url":"https://api.github.com/users/blkbrds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blkbrds/subscriptions","organizations_url":"https://api.github.com/users/blkbrds/orgs","repos_url":"https://api.github.com/users/blkbrds/repos","events_url":"https://api.github.com/users/blkbrds/events{/privacy}","received_events_url":"https://api.github.com/users/blkbrds/received_events","type":"Organization","site_admin":false},"repo":{"id":104010626,"name":"intern09-phut","full_name":"blkbrds/intern09-phut","owner":{"login":"blkbrds","id":28261672,"avatar_url":"https://avatars1.githubusercontent.com/u/28261672?v=4","gravatar_id":"","url":"https://api.github.com/users/blkbrds","html_url":"https://github.com/blkbrds","followers_url":"https://api.github.com/users/blkbrds/followers","following_url":"https://api.github.com/users/blkbrds/following{/other_user}","gists_url":"https://api.github.com/users/blkbrds/gists{/gist_id}","starred_url":"https://api.github.com/users/blkbrds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blkbrds/subscriptions","organizations_url":"https://api.github.com/users/blkbrds/orgs","repos_url":"https://api.github.com/users/blkbrds/repos","events_url":"https://api.github.com/users/blkbrds/events{/privacy}","received_events_url":"https://api.github.com/users/blkbrds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/blkbrds/intern09-phut","description":"iOS intern - Trần Phú","fork":false,"url":"https://api.github.com/repos/blkbrds/intern09-phut","forks_url":"https://api.github.com/repos/blkbrds/intern09-phut/forks","keys_url":"https://api.github.com/repos/blkbrds/intern09-phut/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blkbrds/intern09-phut/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blkbrds/intern09-phut/teams","hooks_url":"https://api.github.com/repos/blkbrds/intern09-phut/hooks","issue_events_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues/events{/number}","events_url":"https://api.github.com/repos/blkbrds/intern09-phut/events","assignees_url":"https://api.github.com/repos/blkbrds/intern09-phut/assignees{/user}","branches_url":"https://api.github.com/repos/blkbrds/intern09-phut/branches{/branch}","tags_url":"https://api.github.com/repos/blkbrds/intern09-phut/tags","blobs_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/refs{/sha}","trees_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blkbrds/intern09-phut/statuses/{sha}","languages_url":"https://api.github.com/repos/blkbrds/intern09-phut/languages","stargazers_url":"https://api.github.com/repos/blkbrds/intern09-phut/stargazers","contributors_url":"https://api.github.com/repos/blkbrds/intern09-phut/contributors","subscribers_url":"https://api.github.com/repos/blkbrds/intern09-phut/subscribers","subscription_url":"https://api.github.com/repos/blkbrds/intern09-phut/subscription","commits_url":"https://api.github.com/repos/blkbrds/intern09-phut/commits{/sha}","git_commits_url":"https://api.github.com/repos/blkbrds/intern09-phut/git/commits{/sha}","comments_url":"https://api.github.com/repos/blkbrds/intern09-phut/comments{/number}","issue_comment_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues/comments{/number}","contents_url":"https://api.github.com/repos/blkbrds/intern09-phut/contents/{+path}","compare_url":"https://api.github.com/repos/blkbrds/intern09-phut/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blkbrds/intern09-phut/merges","archive_url":"https://api.github.com/repos/blkbrds/intern09-phut/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blkbrds/intern09-phut/downloads","issues_url":"https://api.github.com/repos/blkbrds/intern09-phut/issues{/number}","pulls_url":"https://api.github.com/repos/blkbrds/intern09-phut/pulls{/number}","milestones_url":"https://api.github.com/repos/blkbrds/intern09-phut/milestones{/number}","notifications_url":"https://api.github.com/repos/blkbrds/intern09-phut/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blkbrds/intern09-phut/labels{/name}","releases_url":"https://api.github.com/repos/blkbrds/intern09-phut/releases{/id}","deployments_url":"https://api.github.com/repos/blkbrds/intern09-phut/deployments","created_at":"2017-09-19T01:30:29Z","updated_at":"2017-11-02T05:50:33Z","pushed_at":"2017-12-05T09:23:42Z","git_url":"git://github.com/blkbrds/intern09-phut.git","ssh_url":"git@github.com:blkbrds/intern09-phut.git","clone_url":"https://github.com/blkbrds/intern09-phut.git","svn_url":"https://github.com/blkbrds/intern09-phut","homepage":null,"size":2007,"stargazers_count":0,"watchers_count":0,"language":"Swift","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":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23"},"html":{"href":"https://github.com/blkbrds/intern09-phut/pull/23"},"issue":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/issues/23"},"comments":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/blkbrds/intern09-phut/statuses/589d3fae266c5a464716ad422cf402059d3f82e5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"at-daiho"}}