-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix buildSortBy issue when sort is undefined #52
Conversation
@@ -35,6 +37,7 @@ export class Resource extends BaseResource { | |||
this.enums = getEnums(clientModule); | |||
this.manager = this.client[lowerCase(model.name)]; | |||
this.propertiesObject = this.prepareProperties(); | |||
this.idProperty = this.properties().find((p) => p.isId())!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-null assertion should be safe here... A resource without ID property wouldn't work in AdminJS anyway
@@ -69,15 +72,18 @@ export class Resource extends BaseResource { | |||
|
|||
public async find( | |||
filter: Filter, | |||
params: Record<string, any> = {}, | |||
params: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied types from BaseResource
. adminjs
should export a proper type for this
let { sortBy: path } = sort; | ||
const { direction = 'desc' } = sort; | ||
|
||
if (!path) path = this.idProperty.path(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort by id column if nothing to sort by is specified
🎉 This PR is included in version 5.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.