Entities Module
Overview
The Entities module is responsible for managing all business entities within the system.
An entity represents either a Customer or a Supplier, including their addresses and users.
This module defines how entities are created, validated, updated and deleted before they are used
by sales, pricing, ordering and access-control modules.
All operations are tenant-aware and fully audited.
Services
The Entities module consists of the following services:
- Customer - manage customers and their details
- Supplier - manage suppliers and their details
- Entity Address - manage billing and shipping addresses
- Entity User - manage users assigned to entities
Models
This module exposes and consumes the following models.
Entity Model
Represents a business entity (customer).
Fields:
Id (type: long)- internal identifierCode (type: string?)- unique customer codeName (type: string?)- customer display nameEmail (type: string?)- primary email addressPhone (type: string?)- contact phone numberHasAccessToAllProducts (type: bool?)- access to all products flagDefaultBillingAddressId (type: long)- default billing addressDefaultShippingAddressId (type: long)- default shipping addressIsActive (type: bool?)- active flag
Validation:
IsReadyToAdd()- requires
Code - requires
Name
- requires
IsReadyToUpdate()- requires
Id > 0 - requires
Code - requires
Name
- requires
Notes:
- Used for customers
- Email must be unique across all entities
- Entity type is determined internally (
IsSupplierflag) - All data is tenant-scoped
Supplier Model
Represents a supplier entity.
Extends Entity Model with supplier-specific fields.
Additional Fields:
RelatedEntityId (type: long?)- related customer or entity identifierRelatedEntityRelationship (type: string?)- relationship descriptionPaymentTermsDays (type: int?)- payment terms in daysIsPayOnAccount (type: bool?)- pay on account flagCreditLimit (type: decimal?)- credit limit amount
Validation:
- Inherits validation from
Entity Model
Notes:
SupplierModelinherits fromEntityModel- Supplier-specific fields are applied only when
IsSupplier = true - Stored in the same entity data store as customers
- Tenant-scoped and audited
Address Model
Represents an address assigned to an entity.
Fields:
Id (type: long)- internal identifierEntityID (type: long?)- associated entity identifierName (type: string?)- address name or labelLine1 (type: string?)- first address lineLine2 (type: string?)- second address lineCity (type: string?)- cityStateRegion (type: string?)- state or regionPostalCode (type: string?)- postal codeCountryCode (type: string?)- ISO country codePhone (type: string?)- contact phoneEmail (type: string?)- contact emailIsBilling (type: bool?)- billing address flagIsShipping (type: bool?)- shipping address flag
Validation:
IsReadyToAdd()- requires
EntityID > 0 - requires
Name - requires
Line1 - requires
City - requires
PostalCode - requires
CountryCode
- requires
IsReadyToUpdate()- requires
Id > 0 - requires
Name
- requires
Notes:
- An entity may have multiple addresses
- Billing and shipping flags may coexist
- Address data is tenant-scoped