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

Chore: Use enum for handling order_by in website and API #73

Open
0ex-d opened this issue Jan 5, 2025 · 0 comments · May be fixed by #76
Open

Chore: Use enum for handling order_by in website and API #73

0ex-d opened this issue Jan 5, 2025 · 0 comments · May be fixed by #76

Comments

@0ex-d
Copy link
Contributor

0ex-d commented Jan 5, 2025

I suggest using BidsOrderBy enum Option<BidsOrderBy> (or generic OrderBy enum) to properly handle sorting in the api. This would in turn eliminate the need for some extra type conversions and more clarity.

pub order_by: Option<i8>,
}

if let Some(order) = filters.order() {
query.push_str(" ORDER BY block_submission.value ");
query.push_str(if order >= 0 { "ASC" } else { "DESC" });
} else {
query.push_str(" ORDER BY block_submission.slot_number DESC");
}

We can also improve the get_delivered_payloads logic by eliminating

query.push_str(if order >= 0 { "ASC" } else { "DESC" });
@0ex-d 0ex-d linked a pull request Jan 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant