4.7 KiB
GenericRecord Data Model Analysis
Overview
GenericRecord is a C# class defined in Models/Shared/GenericRecord.cs that serves as a base class in MotoVaultPro's architecture, implementing the Generic Record Pattern for shared vehicle maintenance record properties.
Properties
The GenericRecord class has 10 properties:
Core Properties
int Id- Primary key identifierint VehicleId- Foreign key linking to vehicleDateTime Date- When the record occurredint Mileage- Vehicle odometer readingstring Description- Human-readable descriptiondecimal Cost- Monetary cost associated with recordstring Notes- Additional notes/comments
Collection Properties
List<UploadedFiles> Files- File attachments (Name, Location, IsPending)List<string> Tags- Categorization tagsList<ExtraField> ExtraFields- Custom fields (Name, Value, IsRequired, FieldType)List<SupplyUsageHistory> RequisitionHistory- Supply usage tracking
Architecture Role
GenericRecord implements the Generic Record Pattern mentioned in the architecture documentation. It serves as a base class that provides common properties shared across different record types, promoting code reuse and maintainability.
Inheritance Pattern
Classes that inherit from GenericRecord
ServiceRecord- Maintenance and repair recordsUpgradeRecord- Vehicle modification records
Classes with similar structure (not inheriting)
GasRecord- Fuel tracking with additional properties (Gallons, IsFillToFull, MissedFuelUp)TaxRecord- Registration and tax records with recurring reminder fieldsSupplyRecord- Parts and supplies with specific properties (PartNumber, PartSupplier, Quantity)PlanRecord- Maintenance planning with priority/progress trackingOdometerRecord- Simplified for mileage tracking onlyReminderRecord- Focused on reminder scheduling and intervals
Supporting Classes
UploadedFiles
Located in Models/Shared/UploadedFiles.cs:
string Name- File namestring Location- File storage pathbool IsPending- Upload status flag
ExtraField
Located in Models/Shared/ExtraField.cs:
string Name- Field namestring Value- Field valuebool IsRequired- Required field flagExtraFieldType FieldType- Field data type
SupplyUsageHistory
Located in Models/Supply/SupplyUsageHistory.cs:
int Id- Record identifierDateTime Date- Usage datestring PartNumber- Part identifierstring Description- Part descriptiondecimal Quantity- Amount useddecimal Cost- Cost of usage
ExtraFieldType Enum
Located in Enum/ExtraFieldType.cs:
Text(0) - Text inputNumber(1) - Integer inputDecimal(2) - Decimal inputDate(3) - Date pickerTime(4) - Time pickerLocation(5) - Location input
Usage Throughout Application
GenericRecord is utilized extensively across MotoVaultPro:
API Layer
- GenericRecordExportModel - JSON serialization for import/export operations
- API endpoints - Service and upgrade record CRUD operations
- Webhook notifications - WebHookPayload.FromGenericRecord for external integrations
UI Layer
- GenericRecordEditModel - Bulk editing operations across multiple records
- _GenericRecordModal - Modal interface for multi-record editing
- Sticker generation - Vehicle maintenance stickers with record data
Data Access Layer
- Repository pattern - Common interface for record operations
- Database abstraction - Unified storage across LiteDB and PostgreSQL
- Data transformation - Conversion between record types
Business Logic
- Record management - Create, update, delete operations
- Cost calculations - Financial reporting and analysis
- Mileage tracking - Odometer progression validation
Design Benefits
- Code Reuse - Common properties defined once and inherited
- Maintainability - Centralized structure for vehicle records
- Consistency - Uniform data model across record types
- Extensibility - Easy addition of new record types
- Bulk Operations - Unified interface for multi-record editing
- API Consistency - Standardized data exchange format
Implementation Notes
- GenericRecord serves as both a base class and a standalone model
- Not all record types inherit from GenericRecord due to specialized requirements
- The pattern balances common functionality with type-specific needs
- File attachments, tags, and extra fields provide extensibility
- Supply usage tracking enables parts management integration
Document Version: 1.0
Last Updated: August 2025
Related Documentation: Architecture Documentation, Record Architecture