What’s Changed
Persistence Layer Integration
- Added a database-backed persistence layer to the Calculator API, enabling durable storage of calculation operations using both PostgreSQL and MongoDB.
- Implemented PostgreSQL persistence via Prisma, including schema definitions, migrations, and typed data access for relational storage.
- Implemented MongoDB persistence via Mongoose, enabling document-based storage of operations alongside the relational model.
- Introduced explicit persistence method selection (e.g., POSTGRES or MONGO) with strict validation and predictable behavior.
Operation Recording and Data Consistency
- Calculation operations are now persisted only on successful execution.
Invalid requests, failed validations, or failed calculations are explicitly excluded from database writes. - Ensured consistent operation data models across PostgreSQL and MongoDB, allowing results fetched from either database to be logically comparable.
- Added safeguards and error handling to prevent partial writes and ensure database integrity.
In-Memory and Database History Behavior
- Preserved existing in-memory history as a fallback when no persistence method is provided.
- Clarified and enforced behavior when switching between in-memory, PostgreSQL, and MongoDB-backed history retrieval.
Documentation and Configuration Updates
- Updated project documentation to reflect the new persistence capabilities, configuration requirements, and runtime behavior.
- Added environment and setup guidance for running PostgreSQL and MongoDB alongside the API.
New Contributors
- @Copilot made their first contribution by implementing and integrating the persistence layers.
Full Changelog: Ex_05...Ex_07