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

185 database client for the backend #231

Merged
merged 31 commits into from
Dec 8, 2024
Merged

Conversation

m-milek
Copy link
Member

@m-milek m-milek commented Dec 6, 2024

Summary

This PR introduces a fully functional database interface for persisting all domain types, including deeply nested structures such as reports and their associated items. This is a complex task in PostgreSQL—or any other database system—but the implementation here achieves it with an elegant and efficient design.

Key Features

  • Transactional Integrity: All operations are executed within transactions. In case of any error, every single change is automatically rolled back, ensuring data consistency and system reliability.
  • Clean API Design: The interface provides a neat, sealed API that simplifies database interactions while maintaining robust functionality.

Limitations

This PR primarily addresses the saving functionality for our domain types. Fetching operations are not covered here and will need to be implemented separately. However, fetching is expected to be less complex, especially for operations specific to a single type. For example, fetching a report by a specific criterion will require minimal additional effort.

Additional Notes

This is a significant and sizable PR, containing a substantial amount of code that reflects the complexity of the task. Despite this, the resulting implementation is both powerful and easy to use, addressing challenges that are otherwise difficult to solve in traditional database systems.

@m-milek m-milek linked an issue Dec 6, 2024 that may be closed by this pull request
Copy link

deepsource-io bot commented Dec 6, 2024

Here's the code health analysis summary for commits aff9706..70af8bc. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Secrets LogoSecrets✅ SuccessView Check ↗
DeepSource Docker LogoDocker✅ SuccessView Check ↗
DeepSource Rust LogoRust✅ Success
❗ 9 occurences introduced
🎯 5 occurences resolved
View Check ↗
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@m-milek m-milek force-pushed the 185-database-client-for-the-backend branch from 716138f to c86787c Compare December 7, 2024 21:43
@m-milek m-milek force-pushed the 185-database-client-for-the-backend branch from 12ee382 to afa9be6 Compare December 7, 2024 22:07
@m-milek m-milek self-assigned this Dec 7, 2024
@m-milek m-milek added backend Related to the backend database Related to our DB labels Dec 7, 2024
# Conflicts:
#	backend/src/api/auth/login.rs
#	backend/src/api/report/generate.rs
#	backend/src/api/user/mod.rs
#	backend/src/auth/jwt.rs
#	backend/src/main.rs
#	backend/src/websocket/mod.rs
#	backend/src/websocket/peers.rs
#	backend/src/websocket/socket_handler.rs
@m-milek m-milek marked this pull request as ready for review December 7, 2024 23:18
@Smixie Smixie merged commit 1100994 into dev Dec 8, 2024
15 checks passed
@Smixie Smixie deleted the 185-database-client-for-the-backend branch December 8, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to the backend database Related to our DB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Database client for the backend
4 participants