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: allow listing all invoices #10

Merged
merged 5 commits into from
Feb 12, 2024
Merged

feat: allow listing all invoices #10

merged 5 commits into from
Feb 12, 2024

Conversation

Jooakar
Copy link
Contributor

@Jooakar Jooakar commented Feb 1, 2024

Allows listing all populated invoices with GET /invoices

@Jooakar Jooakar requested a review from lajp as a code owner February 1, 2024 18:43
@Jooakar Jooakar linked an issue Feb 1, 2024 that may be closed by this pull request
Copy link
Member

@lajp lajp left a comment

Choose a reason for hiding this comment

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

This looks good!
Only a couple of small things.

It'd also be nice if you could write tests for the feature. It should easy to write a couple of tests based on the existing ones.

src/api/mod.rs Outdated Show resolved Hide resolved
src/api/invoices.rs Outdated Show resolved Hide resolved
.select((Invoice::as_select(), Party::as_select()))
.load::<(Invoice, Party)>(&mut self.0)
.await?
.into_iter()
Copy link
Member

Choose a reason for hiding this comment

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

diesel_async supports streams that can be directly collected into a container that is not Vec<T>
See: https://docs.rs/diesel-async/latest/diesel_async/trait.RunQueryDsl.html#method.load_stream

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed this in d6d41c0 to use the recommended method

Copy link
Contributor Author

@Jooakar Jooakar left a comment

Choose a reason for hiding this comment

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

Added two new tests, not entirely sure how testing should be approached in a project like this (or in general :D) so feedback would be appreciated

.select((Invoice::as_select(), Party::as_select()))
.load::<(Invoice, Party)>(&mut self.0)
.await?
.into_iter()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed this in d6d41c0 to use the recommended method

@Jooakar Jooakar requested a review from lajp February 8, 2024 21:25
Copy link
Member

@lajp lajp left a comment

Choose a reason for hiding this comment

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

lgtm!
Thanks for your contribution!

@lajp lajp merged commit a84ee7f into main Feb 12, 2024
6 of 8 checks passed
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 this pull request may close these issues.

feat: Allow listing all invoices
2 participants