Entities & Database
Entity Overview
| Entity | Purpose | Key Fields |
|---|---|---|
| Product | Products with diff tracking | externalId, currentData, previousData, changedFields, context |
| Partner | Customers/contacts with hierarchy | externalId, type, parentId, externalParentId |
| SaleOrder | Orders (inbound & outbound) | externalId, direction |
| Stock | Stock levels per supplier/product | supplierExternalId, productExternalId, quantity, isQuantityChanged |
| PricelistItem | Extracted prices (avoids update explosion) | pricelistExternalId, productExternalId, price, previousPrice, priceChanged |
| PurchaseOrder | Purchase orders | externalId, name, vendor, state |
| PurchaseOrderLine | PO line items | purchaseOrderId, productExternalId, quantity, priceUnit |
| OutboundQueue | Async sync queue to Odoo | entityType, entityId, payload, status, attempts |
| SyncFailure | Sync failure records | entityType, externalId, source, status, errorMessage |
| WebhookConfig | Webhook endpoint configuration | url, entityType, direction, secret, isActive |
| WebhookDelivery | Webhook delivery attempts | webhookConfigId, syncFailureId, payload, status, attempts |
| ApiLog | HTTP request/response logging | method, path, direction, statusCode, duration |
| User | Application users | email, roles, isVerified |
| ApiToken | API authentication tokens | token, scopes, expiresAt |
| AllowedDomain | Email domain whitelist | domain |
Shared Traits
SyncableTrait (used by Product, Partner, SaleOrder, PurchaseOrder):
odooId,externalId(unique)currentData(JSON),previousData(JSON),changedFields(JSON array)processingState(pending/processing/completed/failed)isNew,idempotencyKey,fetchedAterrorMessage,retryCount
TimestampableTrait (used by most entities):
createdAt,updatedAt(auto-managed via lifecycle callbacks)
Enums
| Enum | Values |
|---|---|
ProcessingState |
pending, processing, completed, failed |
OutboundQueueStatus |
pending, processing, completed, failed |
EntityType |
product, partner, sale_order |
ApiLogDirection |
inbound, outbound |
FailureSource |
odoo, webshop |
FailureStatus |
open, resolved |
WebhookDirection |
to_odoo, to_webshop |
DeliveryStatus |
pending, delivered, failed |
Migrations
| Migration | Purpose |
|---|---|
Version20260122182230 |
User and authentication tables |
Version20260131170634 |
Core entities (Product, Partner, SaleOrder, Stock, PricelistItem, PurchaseOrder) |
Version20260201134916 |
Webhook, failure, and outbound queue entities |
Version20260213095840 |
ApiLog entity |
Version20260213104000 |
ApiLog indexes |
Version20260216120000 |
Additional performance indexes |