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 {
29
29
readonly userId: number = 0;
30
30
readonly title: string = '';
31
31
readonly completed: boolean = false;
32
-
33
- pk() {
34
- return `${this.id}`;
35
- }
36
32
}
37
33
```
38
34
39
35
```js
40
36
import { Entity } from '@data-client/endpoint';
41
37
42
38
class Todo extends Entity {
43
- pk() {
44
- return `${this.id}`;
45
- }
46
39
}
47
40
```
48
41
Original file line number Diff line number Diff line change @@ -94,10 +94,6 @@ class User extends Entity {
94
94
id = ' ' ;
95
95
username = ' ' ;
96
96
97
- pk() {
98
- return this .id ;
99
- }
100
-
101
97
// highlight-next-line
102
98
static key = ' User' ;
103
99
}
Original file line number Diff line number Diff line change @@ -36,10 +36,6 @@ export class Currency extends Entity {
36
36
return iconTable [ this . id ] ?. img_url ;
37
37
}
38
38
39
- pk ( ) : string {
40
- return this . id ;
41
- }
42
-
43
39
static key = 'Currency' ;
44
40
45
41
static process (
Original file line number Diff line number Diff line change @@ -11,10 +11,6 @@ export class Product extends Entity {
11
11
trading_disabled = false ;
12
12
stats = Stats . fromJS ( ) ;
13
13
14
- pk ( ) : string {
15
- return this . id ;
16
- }
17
-
18
14
static key = 'Product' ;
19
15
static schema = {
20
16
stats : Stats ,
Original file line number Diff line number Diff line change @@ -24,10 +24,6 @@ const HOST = 'https://api.github.com';
24
24
25
25
export class GithubEntity extends Entity {
26
26
readonly id : number = - 1 ;
27
-
28
- pk ( ) {
29
- return this . id ?. toString ( ) ;
30
- }
31
27
}
32
28
33
29
export const GithubGqlEndpoint = new GQLEndpoint (
Original file line number Diff line number Diff line change @@ -7,10 +7,6 @@ export class Label extends GithubEntity {
7
7
readonly description : string = '' ;
8
8
readonly color : string = '000000' ;
9
9
readonly default : boolean = false ;
10
-
11
- pk ( ) {
12
- return this . id ?. toString ( ) ;
13
- }
14
10
}
15
11
export const LabelResource = githubResource ( {
16
12
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 {
10
10
commits : Commit [ ] = [ ] ;
11
11
12
12
pk ( ) {
13
- return ` ${ this . pushId } ` ;
13
+ return this . pushId ;
14
14
}
15
15
}
16
16
Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ export class Reaction extends GithubEntity {
14
14
return contentToIcon [ this . content ] ;
15
15
}
16
16
17
- pk ( ) {
18
- return this . id ?. toString ( ) ;
19
- }
20
-
21
17
static schema = {
22
18
user : User ,
23
19
createdAt : Temporal . Instant . from ,
Original file line number Diff line number Diff line change @@ -7,12 +7,8 @@ import {
7
7
} from '@data-client/rest' ;
8
8
9
9
export abstract class PlaceholderEntity extends Entity {
10
- id = 0 ;
11
-
12
10
// all Resources of `jsonplaceholder` use an id for the primary key
13
- pk ( ) {
14
- return `${ this . id } ` ;
15
- }
11
+ id = 0 ;
16
12
}
17
13
18
14
/** Common patterns in the https://jsonplaceholder.typicode.com API */
Original file line number Diff line number Diff line change 1
1
import { schema , Entity } from '@data-client/endpoint' ;
2
2
3
- class BaseEntity extends Entity {
4
- id = 0 ;
3
+ export class User extends Entity { }
5
4
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 {
14
6
sha = '' ;
15
7
16
8
static schema = {
@@ -23,15 +15,15 @@ export class Commit extends BaseEntity {
23
15
}
24
16
}
25
17
26
- export class Label extends BaseEntity { }
18
+ export class Label extends Entity { }
27
19
28
- export class Milestone extends BaseEntity {
20
+ export class Milestone extends Entity {
29
21
static schema = {
30
22
creator : User ,
31
23
} ;
32
24
}
33
25
34
- export class Issue extends BaseEntity {
26
+ export class Issue extends Entity {
35
27
static schema = {
36
28
assignee : User ,
37
29
assignees : [ User ] ,
@@ -41,7 +33,7 @@ export class Issue extends BaseEntity {
41
33
} ;
42
34
}
43
35
44
- export class PullRequest extends BaseEntity {
36
+ export class PullRequest extends Entity {
45
37
static schema = {
46
38
assignee : User ,
47
39
assignees : [ User ] ,
You can’t perform that action at this time.
0 commit comments