File tree Expand file tree Collapse file tree 15 files changed +19
-90
lines changed Expand file tree Collapse file tree 15 files changed +19
-90
lines changed Original file line number Diff line number Diff line change @@ -29,20 +29,13 @@ class Todo extends Entity {
2929 readonly userId: number = 0;
3030 readonly title: string = '';
3131 readonly completed: boolean = false;
32-
33- pk() {
34- return `${this.id}`;
35- }
3632}
3733```
3834
3935```js
4036import { Entity } from '@data-client/endpoint';
4137
4238class Todo extends Entity {
43- pk() {
44- return `${this.id}`;
45- }
4639}
4740```
4841
Original file line number Diff line number Diff line change @@ -94,10 +94,6 @@ class User extends Entity {
9494 id = ' ' ;
9595 username = ' ' ;
9696
97- pk() {
98- return this .id ;
99- }
100-
10197 // highlight-next-line
10298 static key = ' User' ;
10399}
Original file line number Diff line number Diff line change @@ -36,10 +36,6 @@ export class Currency extends Entity {
3636 return iconTable [ this . id ] ?. img_url ;
3737 }
3838
39- pk ( ) : string {
40- return this . id ;
41- }
42-
4339 static key = 'Currency' ;
4440
4541 static process (
Original file line number Diff line number Diff line change @@ -11,10 +11,6 @@ export class Product extends Entity {
1111 trading_disabled = false ;
1212 stats = Stats . fromJS ( ) ;
1313
14- pk ( ) : string {
15- return this . id ;
16- }
17-
1814 static key = 'Product' ;
1915 static schema = {
2016 stats : Stats ,
Original file line number Diff line number Diff line change @@ -24,10 +24,6 @@ const HOST = 'https://api.github.com';
2424
2525export class GithubEntity extends Entity {
2626 readonly id : number = - 1 ;
27-
28- pk ( ) {
29- return this . id ?. toString ( ) ;
30- }
3127}
3228
3329export const GithubGqlEndpoint = new GQLEndpoint (
Original file line number Diff line number Diff line change @@ -7,10 +7,6 @@ export class Label extends GithubEntity {
77 readonly description : string = '' ;
88 readonly color : string = '000000' ;
99 readonly default : boolean = false ;
10-
11- pk ( ) {
12- return this . id ?. toString ( ) ;
13- }
1410}
1511export const LabelResource = githubResource ( {
1612 path : '/repos/:owner/:repo/labels/:name' ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export class Push extends GithubEntity {
1010 commits : Commit [ ] = [ ] ;
1111
1212 pk ( ) {
13- return ` ${ this . pushId } ` ;
13+ return this . pushId ;
1414 }
1515}
1616
Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ export class Reaction extends GithubEntity {
1414 return contentToIcon [ this . content ] ;
1515 }
1616
17- pk ( ) {
18- return this . id ?. toString ( ) ;
19- }
20-
2117 static schema = {
2218 user : User ,
2319 createdAt : Temporal . Instant . from ,
Original file line number Diff line number Diff line change @@ -7,12 +7,8 @@ import {
77} from '@data-client/rest' ;
88
99export abstract class PlaceholderEntity extends Entity {
10- id = 0 ;
11-
1210 // all Resources of `jsonplaceholder` use an id for the primary key
13- pk ( ) {
14- return `${ this . id } ` ;
15- }
11+ id = 0 ;
1612}
1713
1814/** Common patterns in the https://jsonplaceholder.typicode.com API */
Original file line number Diff line number Diff line change 11import { schema , Entity } from '@data-client/endpoint' ;
22
3- class BaseEntity extends Entity {
4- id = 0 ;
3+ export class User extends Entity { }
54
6- pk ( ) {
7- return this . id ;
8- }
9- }
10-
11- export class User extends BaseEntity { }
12-
13- export class Commit extends BaseEntity {
5+ export class Commit extends Entity {
146 sha = '' ;
157
168 static schema = {
@@ -23,15 +15,15 @@ export class Commit extends BaseEntity {
2315 }
2416}
2517
26- export class Label extends BaseEntity { }
18+ export class Label extends Entity { }
2719
28- export class Milestone extends BaseEntity {
20+ export class Milestone extends Entity {
2921 static schema = {
3022 creator : User ,
3123 } ;
3224}
3325
34- export class Issue extends BaseEntity {
26+ export class Issue extends Entity {
3527 static schema = {
3628 assignee : User ,
3729 assignees : [ User ] ,
@@ -41,7 +33,7 @@ export class Issue extends BaseEntity {
4133 } ;
4234}
4335
44- export class PullRequest extends BaseEntity {
36+ export class PullRequest extends Entity {
4537 static schema = {
4638 assignee : User ,
4739 assignees : [ User ] ,
You can’t perform that action at this time.
0 commit comments