Skip to content

Commit

Permalink
Add primaryKey constant with value "id"
Browse files Browse the repository at this point in the history
  • Loading branch information
knokko committed Aug 19, 2021
1 parent 3041a19 commit 001f6e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions dist/Model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export declare abstract class Model<T extends ModelData> implements WorkAround {
* relation that has a different name.
*/
static backendResourceName: string;
static primaryKey: string;
static fileFields: string[];
static pickFields?: string[];
static omitFields: string[];
Expand Down
3 changes: 3 additions & 0 deletions dist/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@ class Model {
* relation that has a different name.
*/
Model.backendResourceName = '';
// Mobx-spine-ts doesn't support a different primary key than id
// but some of our code still relies on this static value being present
Model.primaryKey = 'id';
Model.fileFields = [];
Model.pickFields = undefined;
Model.omitFields = [];
Expand Down
3 changes: 3 additions & 0 deletions src/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ export abstract class Model<T extends ModelData> implements WorkAround {
* relation that has a different name.
*/
static backendResourceName: string = '';
// Mobx-spine-ts doesn't support a different primary key than id
// but some of our code still relies on this static value being present
static primaryKey: string = 'id';

static fileFields: string[] = [];
static pickFields?: string[] = undefined;
Expand Down

0 comments on commit 001f6e5

Please sign in to comment.