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

Replace API Server's mock data responses with database calls #1190

Merged
merged 4 commits into from
Sep 15, 2023

Conversation

alfiedotwtf
Copy link
Contributor

Most of the current API server endpoints are now pulling from a database handle.

Copy link
Collaborator

@TheQuantumPhysicist TheQuantumPhysicist left a comment

Choose a reason for hiding this comment

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

Actually this is looking good as is. I'm happy to merge it.

api-server/web-server/src/main.rs Outdated Show resolved Hide resolved
@alfiedotwtf alfiedotwtf marked this pull request as ready for review September 15, 2023 11:54
Copy link
Contributor

@iljakuklic iljakuklic left a comment

Choose a reason for hiding this comment

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

Looks good. A tiny style comment below:

Comment on lines +95 to +102
state
.db
.transaction_ro()
.map_err(|_| {
APIServerWebServerError::ServerError(
APIServerWebServerServerError::InternalServerError,
)
})?
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you define a constant or something for the error? I don't like how a mere conversion of error type takes up 5 lines while the actual "substantive" code is a fraction of that.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is replicated many times over.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. There's currently not that many error types, but once it's fully fleshed out, I'll replace the errors with real constants.

@TheQuantumPhysicist TheQuantumPhysicist merged commit af0c789 into master Sep 15, 2023
23 checks passed
@TheQuantumPhysicist TheQuantumPhysicist deleted the alfie/web_server_with_db branch September 15, 2023 14:14
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.

None yet

3 participants