@@ -140,6 +140,40 @@ Audit logging system was implemented to track modifications to **Book** entities
Audit logging is being triggered automatically whenever a book is updated.
### Request Logging
The application includes persistent HTTP request logging to track all requests (both MVC **AND** API).
**What is Logged:**
***Request Details**: Method, Path, Query String, Request ID
***User Context**: User ID, User Role (if authenticated)
***Client Information**: IP Address, User Agent
***Response Metrics**: Status Code, Response Time (ms), Content Length
***Error Tracking**: Error flag and message for failed requests
***Source Identification**: Distinguishes between API and MVC requests
**Database Technology:**
The current implementation stores logs in **SQLite**, using the same database as the applications primary data.
For production deployments at larger scale, alternative logging databases could be for sure considered. For example **MongoDB**, which is optimized for high-volume writes.
But for the current application requirements and expected traffic, SQLite provides an optimal solution.
**Implementation:**
Request logging is implemented using ASP.NET Core middleware that intercepts every HTTP request/response:
Both middlewares use the `IHttpRequestLogService` to persist logs to the database. The `Source` field distinguishes between "MVC" and "API" requests.
**Storage:**
All logs are stored persistently in the `HttpRequestLog` database table.
## Testing
The project includes unit tests in the `BusinessLayer.Tests` project.
@@ -210,7 +244,7 @@ These diagrams illustrate the systems main entities, relationships, and actors i
**Entity-Relationship Diagram**


ER Diagram represents the actual data structure of the whole BookHub system. Its modeling the necessary entities (Book, Author, Publisher, Genre, User, Purhcase and PurchaseItem) and capturing their relationships.