unicenta-pos icon indicating copy to clipboard operation
unicenta-pos copied to clipboard

Add Journal or Event Log

Open poolborges opened this issue 3 months ago • 0 comments

This type of system is also known as an event log or an event-sourced architecture. It provides a historical record of all business activities, which is invaluable for auditing, debugging, and business analytics.

Here is a breakdown of how to structure your event journal for a point-of-sale (POS) system, including key sales and inventory events.

Core components of an event journal

Every event entry in your journal should be a single, immutable record that contains essential metadata. A standard event object would contain:

  • eventId: A unique identifier for the event.
  • eventType: A string indicating the type of action performed (e.g., Sales.OrderCreated, Inventory.ProductReceived).
  • timestamp: The date and time the event occurred.
  • userId: The ID of the employee or system user who initiated the action.
  • storeId: The ID of the store or location where the event took place.
  • payload: A JSON object containing the specific data for that event type.

Journaling sales events

The sales process involves a sequence of granular, trackable events. This journal provides a clear, unalterable log of how each order was handled.

Example sales events

Sales.OrderCreated: A new order is started. Payload: { "orderId": "UUID", "customer": { ... } }

Sales.ProductAdded: A product is added to an order. Payload: { "orderId": "UUID", "productId": "SKU", "quantity": 1, "price": 10.99 }

Sales.ProductQuantityUpdated: The quantity of a product is changed. Payload: { "orderId": "UUID", "productId": "SKU", "oldQuantity": 1, "newQuantity": 2 }

Sales.ProductRemoved: A product is taken off an order. Payload: { "orderId": "UUID", "productId": "SKU" }

Sales.DiscountApplied: A discount is added to an order or a specific item. Payload: { "orderId": "UUID", "discountCode": "SUMMER20", "amount": 5.00, "scope": "order" }

Sales.PaymentTendered: A payment is made towards an order. Payload: { "orderId": "UUID", "paymentType": "CreditCard", "amount": 25.50 }

Sales.ReceiptPrinted: The customer's receipt is generated. Payload: { "orderId": "UUID", "receiptId": "UUID" }

Sales.OrderCompleted: The transaction is finalized. Payload: { "orderId": "UUID" }

Sales.OrderSplit: An order is divided into multiple new orders. Payload: { "originalOrderId": "UUID", "newOrderIds": ["UUID1", "UUID2"] }

Sales.CustomerAssigned: A customer profile is linked to an order. Payload: { "orderId": "UUID", "customerId": "UUID" }

poolborges avatar Oct 10 '25 23:10 poolborges