{"action":"created","comment":{"url":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments/237514472","pull_request_review_id":179830010,"id":237514472,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzUxNDQ3Mg==","diff_hunk":"@@ -0,0 +1,18 @@\n+import {Entity, model, property, belongsToUniquely} from '@loopback/repository';\n+import {TodoList} from './todo-list.model';\n+\n+@model()\n+export class Author extends Entity {\n+  @belongsToUniquely(() => TodoList)","path":"examples/todo-list/src/models/author.model.ts","position":6,"original_position":6,"commit_id":"b747642050d08b24bb24dd25aa467ac9c4039ce1","original_commit_id":"b747642050d08b24bb24dd25aa467ac9c4039ce1","user":{"login":"bajtos","id":1140553,"node_id":"MDQ6VXNlcjExNDA1NTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1140553?v=4","gravatar_id":"","url":"https://api.github.com/users/bajtos","html_url":"https://github.com/bajtos","followers_url":"https://api.github.com/users/bajtos/followers","following_url":"https://api.github.com/users/bajtos/following{/other_user}","gists_url":"https://api.github.com/users/bajtos/gists{/gist_id}","starred_url":"https://api.github.com/users/bajtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bajtos/subscriptions","organizations_url":"https://api.github.com/users/bajtos/orgs","repos_url":"https://api.github.com/users/bajtos/repos","events_url":"https://api.github.com/users/bajtos/events{/privacy}","received_events_url":"https://api.github.com/users/bajtos/received_events","type":"User","site_admin":false},"body":"This scenario does not make sense to me. In a typical application, a single author has many todos.\r\n\r\nWhat are the arguments for using Author instead of other alternatives you have considered?","created_at":"2018-11-29T14:45:45Z","updated_at":"2018-11-29T14:53:35Z","html_url":"https://github.com/strongloop/loopback-next/pull/2005#discussion_r237514472","pull_request_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments/237514472"},"html":{"href":"https://github.com/strongloop/loopback-next/pull/2005#discussion_r237514472"},"pull_request":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005"}}},"pull_request":{"url":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005","id":229753557,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5NzUzNTU3","html_url":"https://github.com/strongloop/loopback-next/pull/2005","diff_url":"https://github.com/strongloop/loopback-next/pull/2005.diff","patch_url":"https://github.com/strongloop/loopback-next/pull/2005.patch","issue_url":"https://api.github.com/repos/strongloop/loopback-next/issues/2005","number":2005,"state":"open","locked":false,"title":"feat(repository): hasOne relation","user":{"login":"b-admike","id":13950637,"node_id":"MDQ6VXNlcjEzOTUwNjM3","avatar_url":"https://avatars3.githubusercontent.com/u/13950637?v=4","gravatar_id":"","url":"https://api.github.com/users/b-admike","html_url":"https://github.com/b-admike","followers_url":"https://api.github.com/users/b-admike/followers","following_url":"https://api.github.com/users/b-admike/following{/other_user}","gists_url":"https://api.github.com/users/b-admike/gists{/gist_id}","starred_url":"https://api.github.com/users/b-admike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b-admike/subscriptions","organizations_url":"https://api.github.com/users/b-admike/orgs","repos_url":"https://api.github.com/users/b-admike/repos","events_url":"https://api.github.com/users/b-admike/events{/privacy}","received_events_url":"https://api.github.com/users/b-admike/received_events","type":"User","site_admin":false},"body":"**EDIT - Continuation of #1879 **\r\n\r\n> First iteration of `hasOne` relation. This PR includes the the repository factory, repository interface and default hasOne repository, and has one decorator implementations (mostly taken from our hasMany implementation since they're very similar in nature). It also includes an acceptance test with a Customer has one Address relation to drive it and a unit test as well. Please note that only the **EDIT** `get` and `create` methods are implemented at the moment and tests covering them, so that we can focus on that and incrementally add patch and delete methods to the hasOne repository interface.\r\n> \r\n> **Todos**\r\n> - [ ] Add documentation for `hasOne` relation\r\n> - [x] Add example that uses `hasOne` relation\r\n\r\nSee discussion in https://github.com/strongloop/loopback-next/issues/1956. @bajtos proposed using the PK of a target model in a `hasOne` relation to enforce uniqueness and 1-to-1 relation between source and target model instances (see https://github.com/strongloop/loopback-next/issues/1956#issuecomment-437360566). ~This is just a quick spike to see the feasibility of the proposal and get more feedback.~ \r\n\r\n## Checklist\r\n\r\n- [x] `npm test` passes on your machine\r\n- [x] New tests added or existing tests modified to cover all changes\r\n- [x] Code conforms with the [style guide](http://loopback.io/doc/en/contrib/style-guide.html)\r\n- [x] API Documentation in code was updated\r\n- [ ] Documentation in [/docs/site](../tree/master/docs/site) was updated\r\n- [ ] Affected artifact templates in `packages/cli` were updated\r\n- [x] Affected example projects in `examples/*` were updated\r\n","created_at":"2018-11-09T16:46:31Z","updated_at":"2018-11-29T14:53:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c471bcbf89385dd76274fc13731a15cd5528fe1","assignee":null,"assignees":[],"requested_reviewers":[{"login":"raymondfeng","id":540892,"node_id":"MDQ6VXNlcjU0MDg5Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/540892?v=4","gravatar_id":"","url":"https://api.github.com/users/raymondfeng","html_url":"https://github.com/raymondfeng","followers_url":"https://api.github.com/users/raymondfeng/followers","following_url":"https://api.github.com/users/raymondfeng/following{/other_user}","gists_url":"https://api.github.com/users/raymondfeng/gists{/gist_id}","starred_url":"https://api.github.com/users/raymondfeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raymondfeng/subscriptions","organizations_url":"https://api.github.com/users/raymondfeng/orgs","repos_url":"https://api.github.com/users/raymondfeng/repos","events_url":"https://api.github.com/users/raymondfeng/events{/privacy}","received_events_url":"https://api.github.com/users/raymondfeng/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005/commits","review_comments_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005/comments","review_comment_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments{/number}","comments_url":"https://api.github.com/repos/strongloop/loopback-next/issues/2005/comments","statuses_url":"https://api.github.com/repos/strongloop/loopback-next/statuses/b747642050d08b24bb24dd25aa467ac9c4039ce1","head":{"label":"strongloop:spike/hasone-relation","ref":"spike/hasone-relation","sha":"b747642050d08b24bb24dd25aa467ac9c4039ce1","user":{"login":"strongloop","id":3020012,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjAwMTI=","avatar_url":"https://avatars1.githubusercontent.com/u/3020012?v=4","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":78452015,"node_id":"MDEwOlJlcG9zaXRvcnk3ODQ1MjAxNQ==","name":"loopback-next","full_name":"strongloop/loopback-next","private":false,"owner":{"login":"strongloop","id":3020012,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjAwMTI=","avatar_url":"https://avatars1.githubusercontent.com/u/3020012?v=4","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/strongloop/loopback-next","description":"LoopBack makes it easy to build modern API applications that require complex integrations.","fork":false,"url":"https://api.github.com/repos/strongloop/loopback-next","forks_url":"https://api.github.com/repos/strongloop/loopback-next/forks","keys_url":"https://api.github.com/repos/strongloop/loopback-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/loopback-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/loopback-next/teams","hooks_url":"https://api.github.com/repos/strongloop/loopback-next/hooks","issue_events_url":"https://api.github.com/repos/strongloop/loopback-next/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/loopback-next/events","assignees_url":"https://api.github.com/repos/strongloop/loopback-next/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/loopback-next/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/loopback-next/tags","blobs_url":"https://api.github.com/repos/strongloop/loopback-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/loopback-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/loopback-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/loopback-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/loopback-next/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/loopback-next/languages","stargazers_url":"https://api.github.com/repos/strongloop/loopback-next/stargazers","contributors_url":"https://api.github.com/repos/strongloop/loopback-next/contributors","subscribers_url":"https://api.github.com/repos/strongloop/loopback-next/subscribers","subscription_url":"https://api.github.com/repos/strongloop/loopback-next/subscription","commits_url":"https://api.github.com/repos/strongloop/loopback-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/loopback-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/loopback-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/loopback-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongloop/loopback-next/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/loopback-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/loopback-next/merges","archive_url":"https://api.github.com/repos/strongloop/loopback-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/loopback-next/downloads","issues_url":"https://api.github.com/repos/strongloop/loopback-next/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/loopback-next/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/loopback-next/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/loopback-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/loopback-next/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/loopback-next/releases{/id}","deployments_url":"https://api.github.com/repos/strongloop/loopback-next/deployments","created_at":"2017-01-09T17:27:14Z","updated_at":"2018-11-29T13:36:05Z","pushed_at":"2018-11-29T14:42:22Z","git_url":"git://github.com/strongloop/loopback-next.git","ssh_url":"git@github.com:strongloop/loopback-next.git","clone_url":"https://github.com/strongloop/loopback-next.git","svn_url":"https://github.com/strongloop/loopback-next","homepage":"https://v4.loopback.io","size":10072,"stargazers_count":1187,"watchers_count":1187,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":147,"mirror_url":null,"archived":false,"open_issues_count":349,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":147,"open_issues":349,"watchers":1187,"default_branch":"master"}},"base":{"label":"strongloop:master","ref":"master","sha":"7be76a4c891d00875d4774d5ca2e3783f9ece53d","user":{"login":"strongloop","id":3020012,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjAwMTI=","avatar_url":"https://avatars1.githubusercontent.com/u/3020012?v=4","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":78452015,"node_id":"MDEwOlJlcG9zaXRvcnk3ODQ1MjAxNQ==","name":"loopback-next","full_name":"strongloop/loopback-next","private":false,"owner":{"login":"strongloop","id":3020012,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjAwMTI=","avatar_url":"https://avatars1.githubusercontent.com/u/3020012?v=4","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/strongloop/loopback-next","description":"LoopBack makes it easy to build modern API applications that require complex integrations.","fork":false,"url":"https://api.github.com/repos/strongloop/loopback-next","forks_url":"https://api.github.com/repos/strongloop/loopback-next/forks","keys_url":"https://api.github.com/repos/strongloop/loopback-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/loopback-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/loopback-next/teams","hooks_url":"https://api.github.com/repos/strongloop/loopback-next/hooks","issue_events_url":"https://api.github.com/repos/strongloop/loopback-next/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/loopback-next/events","assignees_url":"https://api.github.com/repos/strongloop/loopback-next/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/loopback-next/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/loopback-next/tags","blobs_url":"https://api.github.com/repos/strongloop/loopback-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/loopback-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/loopback-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/loopback-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/loopback-next/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/loopback-next/languages","stargazers_url":"https://api.github.com/repos/strongloop/loopback-next/stargazers","contributors_url":"https://api.github.com/repos/strongloop/loopback-next/contributors","subscribers_url":"https://api.github.com/repos/strongloop/loopback-next/subscribers","subscription_url":"https://api.github.com/repos/strongloop/loopback-next/subscription","commits_url":"https://api.github.com/repos/strongloop/loopback-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/loopback-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/loopback-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/loopback-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongloop/loopback-next/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/loopback-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/loopback-next/merges","archive_url":"https://api.github.com/repos/strongloop/loopback-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/loopback-next/downloads","issues_url":"https://api.github.com/repos/strongloop/loopback-next/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/loopback-next/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/loopback-next/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/loopback-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/loopback-next/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/loopback-next/releases{/id}","deployments_url":"https://api.github.com/repos/strongloop/loopback-next/deployments","created_at":"2017-01-09T17:27:14Z","updated_at":"2018-11-29T13:36:05Z","pushed_at":"2018-11-29T14:42:22Z","git_url":"git://github.com/strongloop/loopback-next.git","ssh_url":"git@github.com:strongloop/loopback-next.git","clone_url":"https://github.com/strongloop/loopback-next.git","svn_url":"https://github.com/strongloop/loopback-next","homepage":"https://v4.loopback.io","size":10072,"stargazers_count":1187,"watchers_count":1187,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":147,"mirror_url":null,"archived":false,"open_issues_count":349,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":147,"open_issues":349,"watchers":1187,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005"},"html":{"href":"https://github.com/strongloop/loopback-next/pull/2005"},"issue":{"href":"https://api.github.com/repos/strongloop/loopback-next/issues/2005"},"comments":{"href":"https://api.github.com/repos/strongloop/loopback-next/issues/2005/comments"},"review_comments":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005/comments"},"review_comment":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/2005/commits"},"statuses":{"href":"https://api.github.com/repos/strongloop/loopback-next/statuses/b747642050d08b24bb24dd25aa467ac9c4039ce1"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"bajtos"}}