Skip to content
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

feat(api): sort and order query params for filtering layouts #2535

Merged

Conversation

p-fernandez
Copy link
Contributor

What change does this PR introduce?

Adds query params and functionality to sort the filtered results by creation date.

Why was this change needed?

UI needs it. And probably users from API.

Other information (Screenshots)

@p-fernandez p-fernandez self-assigned this Jan 19, 2023
@linear
Copy link

linear bot commented Jan 19, 2023

Copy link
Contributor

@ainouzgali ainouzgali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay 💪🏻

): Promise<LayoutEntity[]> {
const order = pagination.orderBy ?? OrderDirectionEnum.ASC;
const sort = pagination.sortBy ? { [pagination.sortBy]: order } : { createdAt: 1 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const sort = pagination.sortBy ? { [pagination.sortBy]: order } : { createdAt: 1 };
const sort = pagination.sortBy ? { [pagination.sortBy]: order } : { createdAt: OrderDirectionEnum.DESC};

I think descending makes more sense as a default. So they will get first in the the last one they created. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. We might create a task in the feature to add in the list the default first of all.

@p-fernandez p-fernandez force-pushed the nv-1491-layouts-filtering-to-support-ordering-by branch from 5705b41 to 3a568f7 Compare January 19, 2023 14:35
@p-fernandez p-fernandez force-pushed the nv-1491-layouts-filtering-to-support-ordering-by branch from 3a568f7 to 97db630 Compare January 19, 2023 14:50
@p-fernandez p-fernandez merged commit 1ae6fc2 into feat-layouts Jan 19, 2023
@p-fernandez p-fernandez deleted the nv-1491-layouts-filtering-to-support-ordering-by branch January 19, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants