Commit 72680343 authored by Josef Skorpik's avatar Josef Skorpik
Browse files

docs: update ER diagram, and add request logging documentation to README

parent 48638e7d
Loading
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -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:

  * **MVC Application**: `MVC/Middlewares/RequestLoggingMiddleware.cs`
  * **API Application**: `BookHub/Middlewares/RequestLoggingMiddleware.cs`

  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**

![](./docs/er_diagram.png)
![](./docs/er_diagram_updated.png)

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.

docs/er_diagram.png

deleted100644 → 0
−131 KiB
Loading image diff...
+152 KiB
Loading image diff...