Overview
The Customer data model represents both vehicle owners (propietarios) and drivers (conductores) in the MotorDesk fleet management system. Customers can own vehicles, be assigned as habitual drivers, or both.TypeScript Interface
Field Reference
Unique identifier for the customerFormat:
cust-XXX where XXX is a sequential numberExample: cust-001Type of identity documentValid Values:
RUC- Tax identification number for companies (11 digits)DNI- National identity document for individuals (8 digits)
RUC or DNIIdentity document numberValidation Rules:
- Must be numeric
- DNI: Exactly 8 digits
- RUC: Exactly 11 digits
20987654321 (RUC), 76543210 (DNI)Full name (for individuals) or business name (for companies)Format: Free text, typically in uppercase for companiesExamples:
TRANSPORTES RAPIDOS S.A.C.(Company)Juan Perez (Chofer)(Individual)
Physical address of the customerFormat: Street address including district/city when applicableExample:
Calle Los Camiones 123 or Av. Industrial 500, AteContact phone numberFormat: Phone number (can include country code or area code)Examples:
987654321, 01-444-5555Email address for electronic billing and communicationsValidation: Must be a valid email formatExample:
[email protected]Relationships
Vehicles as Owner
Vehicles as Owner
A customer can own multiple vehicles. The relationship is established through the
propietarioId field in the Vehicle model.Vehicles as Driver
Vehicles as Driver
A customer can be assigned as the habitual driver for multiple vehicles. The relationship is established through the
conductorHabitualId field in the Vehicle model.Sales
Sales
Customers are referenced in sales transactions through the
customerId field in the Sale model. They can also be referenced as the driver through the choferId field.Example Data
Individual Customer (DNI)
Company Customer (RUC)
Validation Rules
SUNAT/RENIEC IntegrationMotorDesk integrates with the Decolecta API to validate and auto-fill customer information from SUNAT (for RUC) and RENIEC (for DNI) databases. This ensures data accuracy and reduces manual entry errors.
Business Logic
Customer Creation Flow
- User enters document type and number
- System queries Decolecta API for validation
- If found, auto-fills
nombreRazonSocialanddireccion - User reviews and completes remaining fields
- System validates all required fields
- Customer record is created
Decolecta API Integration
Data Storage
Mock Data Location
/src/data/mock/customers.tsTypeScript export with sample customer dataJSON Data Location
/src/data/json/customers.jsonRaw JSON array of customer objects