{"action":"created","issue":{"url":"https://api.github.com/repos/johnpapa/angular-ngrx-data/issues/187","repository_url":"https://api.github.com/repos/johnpapa/angular-ngrx-data","labels_url":"https://api.github.com/repos/johnpapa/angular-ngrx-data/issues/187/labels{/name}","comments_url":"https://api.github.com/repos/johnpapa/angular-ngrx-data/issues/187/comments","events_url":"https://api.github.com/repos/johnpapa/angular-ngrx-data/issues/187/events","html_url":"https://github.com/johnpapa/angular-ngrx-data/issues/187","id":360240725,"node_id":"MDU6SXNzdWUzNjAyNDA3MjU=","number":187,"title":"Implement new operations for an entity","user":{"login":"eweap","id":1033191,"node_id":"MDQ6VXNlcjEwMzMxOTE=","avatar_url":"https://avatars1.githubusercontent.com/u/1033191?v=4","gravatar_id":"","url":"https://api.github.com/users/eweap","html_url":"https://github.com/eweap","followers_url":"https://api.github.com/users/eweap/followers","following_url":"https://api.github.com/users/eweap/following{/other_user}","gists_url":"https://api.github.com/users/eweap/gists{/gist_id}","starred_url":"https://api.github.com/users/eweap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eweap/subscriptions","organizations_url":"https://api.github.com/users/eweap/orgs","repos_url":"https://api.github.com/users/eweap/repos","events_url":"https://api.github.com/users/eweap/events{/privacy}","received_events_url":"https://api.github.com/users/eweap/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-14T10:06:03Z","updated_at":"2018-09-14T20:17:15Z","closed_at":"2018-09-14T20:17:15Z","author_association":"NONE","body":"<!--\r\nIF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE MIGHT BE CLOSED WITHOUT FURTHER CONSIDERATION OR INVESTIGATION\r\n-->\r\n> Please provide us with the following information:\r\n> ---------------------------------------------------------------\r\n\r\n### This issue is for a: (mark with an `x`)\r\n```\r\n- [ ] bug report -> please search issues before submitting\r\n- [ ] feature request\r\n- [x] documentation issue or request\r\n- [ ] regression (a behavior that used to work and stopped in a new release)\r\n```\r\n\r\n### Expected/desired behavior\r\nHi ! I'm currently trying ngrx-data but I'm stuck for a few hours trying understand how to implement customs `loadNewerSince` and `loadOlderFrom` operations for my entity.\r\n\r\nWhere to create the new actions, configure the query parameters of HTTP requests created, ... ?\r\n\r\nThe current docs don't explain explicity how to achieve my goal.\r\nI think this issue https://github.com/johnpapa/angular-ngrx-data/issues/22 may be related to my questions but unfortunately there is no update since december.\r\n\r\nAny advices would be welcome :)\r\n\r\nThanks for your library @johnpapa @wardbell !\r\n\r\n### OS and Version?\r\n> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)\r\n\r\n### Versions\r\n>\r\n\r\n### Mention any other details that might be useful\r\n\r\n> ---------------------------------------------------------------\r\n> Thanks! We'll be in touch soon.\r\n"},"comment":{"url":"https://api.github.com/repos/johnpapa/angular-ngrx-data/issues/comments/421472874","html_url":"https://github.com/johnpapa/angular-ngrx-data/issues/187#issuecomment-421472874","issue_url":"https://api.github.com/repos/johnpapa/angular-ngrx-data/issues/187","id":421472874,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTQ3Mjg3NA==","user":{"login":"eweap","id":1033191,"node_id":"MDQ6VXNlcjEwMzMxOTE=","avatar_url":"https://avatars1.githubusercontent.com/u/1033191?v=4","gravatar_id":"","url":"https://api.github.com/users/eweap","html_url":"https://github.com/eweap","followers_url":"https://api.github.com/users/eweap/followers","following_url":"https://api.github.com/users/eweap/following{/other_user}","gists_url":"https://api.github.com/users/eweap/gists{/gist_id}","starred_url":"https://api.github.com/users/eweap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eweap/subscriptions","organizations_url":"https://api.github.com/users/eweap/orgs","repos_url":"https://api.github.com/users/eweap/repos","events_url":"https://api.github.com/users/eweap/events{/privacy}","received_events_url":"https://api.github.com/users/eweap/received_events","type":"User","site_admin":false},"created_at":"2018-09-14T20:17:15Z","updated_at":"2018-09-14T20:17:15Z","author_association":"NONE","body":"I close this issue because I now have a better understanding of how ngrx-data services work together.\r\n\r\nFor those who are interested, here is what my service looks like:\r\n\r\n```typescript\r\nimport { Injectable } from '@angular/core';\r\nimport { map, mergeMap, first } from 'rxjs/operators';\r\nimport { Observable } from 'rxjs';\r\nimport {\r\n    EntityCollectionServiceBase,\r\n    EntityCollectionServiceElementsFactory,\r\n    QueryParams,\r\n} from 'ngrx-data';\r\n\r\nimport { Message } from '../models/message.model';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class MessagesService extends EntityCollectionServiceBase<\r\n    Message\r\n> {\r\n    constructor(\r\n        serviceElementsFactory: EntityCollectionServiceElementsFactory\r\n    ) {\r\n        super('Message', serviceElementsFactory);\r\n    }\r\n\r\n    getLatest(count = 15): Observable<Message[]> {\r\n        return this.entities$.pipe(\r\n            first(),\r\n            // Get the newest message id in collection\r\n            map(messages => messages.shift().id),\r\n            // Create the query params\r\n            map(\r\n                (currentNewestId): QueryParams => ({\r\n                    count: count.toString(),\r\n                    since: currentNewestId,\r\n                })\r\n            ),\r\n            // Fetch newest messages\r\n            mergeMap(queryParams => super.getWithQuery(queryParams))\r\n        );\r\n    }\r\n\r\n    getOlder(count = 15): Observable<Message[]> {\r\n        return this.entities$.pipe(\r\n            first(),\r\n            // Get the oldest message id in collection\r\n            map(messages => messages.pop().id),\r\n            // Create the query params\r\n            map(\r\n                (currentNewestId): QueryParams => ({\r\n                    count: count.toString(),\r\n                    from: currentNewestId,\r\n                })\r\n            ),\r\n            // Fetch older messages\r\n            mergeMap(queryParams => super.getWithQuery(queryParams))\r\n        );\r\n    }\r\n}\r\n\r\n```\r\n\r\nSo this issue becomes a duplicate of #22"}}
{"actor":{"display_login":"eweap"}}