Appendix A: n8n Node Type Reference
This appendix maps every n8n node type used in the Almafrica workflow diagrams to the concrete components in the codebase. Each node type is listed with the Almafrica classes that implement the corresponding pattern, organized by layer (Backend, Mobile, Web).
Table of Contents
- Webhook Trigger
- Schedule Trigger
- Manual Trigger
- HTTP Request
- Function
- IF (Conditional)
- Switch (Multi-Branch)
- Set (Transform)
- Merge (Parallel Coordination)
- Wait (Delay / Backoff)
- Loop (Iterative)
- Error Trigger
- Database Read/Write
- S3 (DigitalOcean Spaces)
- SignalR (Real-Time Hub)
- SMS (Africa's Talking)
- Push Notification (FCM)
- Code (Complex Inline Logic)
- NoOp (Skip / Passthrough)
1. Webhook Trigger
Represents an incoming HTTP request that starts a workflow. Maps to every API controller endpoint.
Backend -- API Controllers
All controllers live under backend/Almafrica.API/Controllers/.
| Controller | Primary Endpoints |
|---|---|
AuthController | Login, register, refresh token, logout, my-permissions-by-role |
AgentsController | CRUD agents, assign farmers, performance |
AnalyticsController | Dashboard stats, reports, aggregations |
BaseConfigurationController | Master configuration CRUD |
BulkOperationsController | Bulk import farmers/clients via Excel |
CampaignsController | Campaign CRUD, publish, close, runs |
ClientsController | Client CRUD, approval workflow, deactivation |
CollectionPointsController | Collection point CRUD |
CropBatchesController | Batch creation, assessment, allocation |
CropsController | Crop type CRUD |
DeviceController | Device registration, heartbeat |
FarmersController | Farmer CRUD, approval workflow, profile |
FarmerVisitsController | Field visit CRUD |
IpWhitelistController | IP whitelist management |
LocationsController | Province/territory/village lookup |
LoginHistoryController | Login history audit |
MasterDataController | Master data sync endpoint (delta) |
MobileSurveyController | Mobile survey form submission |
MultipartUploadController | Chunked file upload (init, part, complete) |
OrdersController | Order CRUD, status transitions, allocation |
OtpController | OTP generation and verification |
PasswordPoliciesController | Password policy CRUD |
PermissionsController | Permission matrix CRUD |
PermissionTemplatesController | Permission template CRUD |
ProductionsController | Production cycle CRUD |
ProfileController | User profile, avatar upload |
QualityAssessmentsController | Quality assessment CRUD, checklist |
RolesController | Role CRUD |
SessionsController | Session list, terminate, activity |
StockController | Stock query, adjustments |
StockOutsController | Stock out recording |
SurveyMasterDataController | Survey-specific master data |
SurveyResponsesController | Survey response CRUD, export |
SystemConfigurationsController | System-wide settings |
TransfersController | Transfer CRUD, approve, dispatch, receive |
TwoFactorController | 2FA enable/disable, verify |
UploadController | Simple file upload |
UserGroupsController | User group CRUD |
UserRolesController | User-role assignment |
UsersManagementController | User CRUD, activate/deactivate |
VersionController | API version check |
WarehouseStaffController | Warehouse operator assignment |
2. Schedule Trigger
Represents a timer or cron that fires a workflow on a recurring schedule.
Backend
| Component | Schedule Pattern | Purpose |
|---|---|---|
ExpiryAlertBackgroundService | Periodic (hosted service) | Checks crop batches nearing best-before date, sends notifications |
Mobile
| Component | Schedule Pattern | Purpose |
|---|---|---|
OfflineQueueProcessor | Periodic timer | Drains offline sync queue, retries failed uploads |
BackgroundSyncService | Periodic / on-connectivity | Triggers full or delta sync when device regains network |
SyncCoordinator | Login + periodic | Orchestrates ordered sync of all entity types |
LoginSyncService | On login | Runs initial data pull immediately after authentication |
3. Manual Trigger
Represents a user-initiated action that starts a workflow (button tap, form submit).
Mobile -- User-Initiated Actions
| Component | Trigger | Purpose |
|---|---|---|
FarmerDraftService | "Save" / "Submit" button | Creates or updates a farmer draft offline |
ClientDraftService | "Save" / "Submit" button | Creates or updates a client draft offline |
ClientFormDraftService | "Save" button | Saves client form draft state |
ClientCropDemandDraftService | "Save demand" | Saves client crop demand draft |
ProductionCycleDraftService | "Save cycle" | Saves production cycle draft |
OrderService | "Place order" / "Update status" | Creates order or advances status |
UploadService | "Upload photo" | Initiates photo upload from camera/gallery |
ChunkedUploadService | Large file submit | Starts chunked upload flow |
SyncManager.fullSync() | "Sync now" button | Triggers full manual sync |
AssessmentPhotoService | Camera capture | Takes and queues assessment photo |
SurveyFormProvider | "Submit survey" | Submits survey response offline |
4. HTTP Request
Represents an outbound HTTP call to an external API or the Almafrica backend.
Mobile -- Remote Datasources
All remote datasources live under mobile/mon_jardin/lib/data/datasources/remote/.
| Datasource | Target API | Purpose |
|---|---|---|
MasterDataRemoteDatasource | GET /api/masterdata/* | Pulls delta master data (provinces, crops, configs) |
CropRemoteDatasource | GET /api/crops/* | Fetches crop types and categories |
CampaignRemoteDatasource | GET/POST /api/campaigns/* | Fetches campaigns, submits survey responses |
AssessmentRemoteDatasource | GET/POST /api/quality-assessments/* | Fetches QA questions, submits assessments |
DeviceRemoteDatasource | POST /api/device/* | Registers device, heartbeat |
StockLossRemoteDatasource | POST /api/stock/* | Submits stock loss records |
StockTransferRemoteDatasource | POST /api/transfers/* | Submits stock transfers |
ClientMasterDataRemoteDatasource | GET /api/masterdata/client/* | Pulls client-specific master data |
Mobile -- Services Making HTTP Calls
| Service | Calls | Purpose |
|---|---|---|
ApiClient | All endpoints | Centralized HTTP client with auth headers, retry |
JwtAuthService | POST /api/auth/login | Login, refresh, per-role permission fetch |
ProfileService | GET/PUT /api/profile | Fetch and update user profile |
FarmerService | GET/POST /api/farmers | Sync farmers to/from backend |
ClientService | GET/POST /api/clients | Sync clients to/from backend |
OrderService | GET/POST /api/orders | Sync orders to/from backend |
HarvestService | POST /api/productions/*/harvests | Submit harvests |
ProductionCycleService | GET/POST /api/productions | Sync production cycles |
CenterStockService | GET /api/stock/* | Fetch center stock data |
WarehouseStaffService | GET /api/warehouse-staff | Fetch warehouse staff assignments |
ClientDocumentService | POST /api/clients/*/documents | Upload client documents |
ClientCropDemandService | GET/POST /api/clients/*/demands | Sync crop demands |
Mobile -- Sync Services (HTTP Push/Pull)
| Sync Service | Direction | Purpose |
|---|---|---|
FarmersSyncService | Pull | Delta-sync farmers from backend |
ClientsSyncService | Pull | Delta-sync clients from backend |
OrderSyncService | Push + Pull | Sync orders bidirectionally |
ProductionCycleSyncService | Push + Pull | Sync production cycles |
StockSyncService | Pull | Pull stock data for warehouse view |
StockLossSyncService | Push | Push offline stock losses |
StockTransferSyncService | Push | Push offline stock transfers |
CropDemandsSyncService | Push + Pull | Sync client crop demands |
SurveyResponseSyncService | Push | Push offline survey responses |
SurveyFileSyncService | Push | Push queued survey file attachments |
CampaignPullSyncService | Pull | Pull campaign definitions |
MasterDataSyncService | Pull | Delta-sync all master data tables |
AssessmentQuestionsSyncService | Pull | Sync QA checklist questions |
5. Function
Represents a processing step that transforms data or applies business logic.
Backend -- Application & Infrastructure Services
| Service | Layer | Purpose |
|---|---|---|
AuthService | Infrastructure | Login, JWT generation, permission resolution |
FarmerService | Infrastructure | Farmer CRUD, search, filtering |
FarmerValidationService | Infrastructure | Farmer field validation rules |
FarmerBulkService | Infrastructure | Bulk farmer import from Excel |
FarmerCropOfferService | Infrastructure | Farmer crop offer CRUD |
FarmerApprovalService | Infrastructure | Farmer approval/rejection workflow |
FarmerAgentService | Infrastructure | Agent-farmer assignment logic |
FarmerCollectionPointService | Infrastructure | Farmer-collection point assignment |
FarmerVisitService | Infrastructure | Field visit CRUD |
ClientService | Infrastructure | Client CRUD, search, filtering |
ClientApprovalService | Infrastructure | Client approval/rejection workflow |
ClientCropDemandService | Infrastructure | Client crop demand CRUD |
ClientBulkImportService | Infrastructure | Bulk client import from Excel |
OrderService | Infrastructure | Order lifecycle (create, confirm, process, deliver, cancel) |
CropBatchService | Infrastructure | Batch creation, assessment marking, allocation |
CropService | Infrastructure | Crop type CRUD |
StockService | Infrastructure | Stock queries, aggregation |
StockMovementRecorder | Infrastructure | Records atomic stock movements |
StockAdjustmentService | Infrastructure | Manual stock adjustments |
StockOutService | Infrastructure | Stock out deductions |
StockLossService | Infrastructure | Stock loss recording and approval |
TransferService | Infrastructure | Transfer workflow (approve, dispatch, complete, cancel) |
QualityAssessmentService | Infrastructure | QA CRUD, scoring |
QualityAssessmentQuestionService | Infrastructure | QA checklist question management |
ProductionService | Infrastructure | Production cycle CRUD |
CampaignService | Infrastructure | Campaign CRUD, publish, close |
MobileCampaignService | Infrastructure | Mobile-optimized campaign data |
QuestionnaireService | Infrastructure | Questionnaire version management |
SurveyResponseService | Infrastructure | Survey response storage and validation |
SurveyExportService | Infrastructure | Survey data export |
SurveyMasterDataService | Infrastructure | Survey-specific master data |
CollectionPointService | Infrastructure | Collection point CRUD |
ConfigurationService | Infrastructure | System configuration management |
MasterDataService | Infrastructure | Master data delta sync logic |
AnalyticsService | Infrastructure | Dashboard analytics aggregation |
MediaUploadService | Infrastructure | Media file upload processing |
MultipartUploadService | Infrastructure | Chunked upload orchestration |
OtpService | Infrastructure | OTP generation, sending, verification |
TwoFactorService | Infrastructure | TOTP setup and verification |
SessionManagementService | Infrastructure | Session create, list, terminate |
LoginHistoryService | Infrastructure | Login history tracking |
IpWhitelistService | Infrastructure | IP whitelist enforcement |
PasswordPolicyService | Infrastructure | Password policy enforcement |
PermissionTemplateService | Infrastructure | Permission template CRUD |
RoleManagementService | Infrastructure | Role CRUD, role-permission assignment |
RoleAuditService | Infrastructure | Role change audit trail |
UserGroupService | Infrastructure | User group CRUD |
WarehouseStaffService | Infrastructure | Warehouse staff assignment |
BulkUserOperationsService | Infrastructure | Bulk user import/export |
AgentService | Infrastructure | Agent CRUD, provisioning |
AgentProfileProvisioningService | Infrastructure | Auto-creates Agent profile on user creation |
CurrentUserService | Infrastructure | Resolves current authenticated user context |
ExcelService | Infrastructure | Excel file generation and parsing |
ExcelExportService | Infrastructure | Export data to Excel format |
ExcelTemplateService | Infrastructure | Generate Excel import templates |
ConfigurableExcelParser | Infrastructure | Configurable Excel column mapping |
Mobile -- Business Logic Services
| Service | Purpose |
|---|---|
ValidationService | Client-side form validation |
SyncConflictService | Detects and resolves sync conflicts |
EnhancedConflictService | Advanced conflict resolution strategies |
ConflictResolver | Strategy pattern for merge conflicts |
PendingUpdatesService | Tracks pending offline updates |
AgentStatusService | Resolves agent online/offline status |
AgentContext | Holds current agent identity context |
CropManagementService | Local crop data management |
DraftFileService | Manages file references for draft entities |
ConnectivityService | Network connectivity monitoring |
UnifiedSyncStatusService | Aggregated sync status for all entity types |
SyncAnalyticsService | Tracks sync performance metrics |
SyncHistoryService | Logs sync operations for debugging |
ClientMasterDataResolver | Resolves master data IDs to display names |
6. IF (Conditional)
Represents a binary decision (true/false routing).
Backend
| Pattern | Location | Condition |
|---|---|---|
| Approval guard | Order.Confirm() | Status != Pending -> reject |
| Assessment guard | CropBatch.MarkAsAssessed() | acceptedQuantity > initialQuantity -> error |
| Transfer state check | Transfer.CanBeApproved() | Status == Pending && HasItems() |
| Transfer dispatch check | Transfer.CanBeDispatched() | Status == Approved |
| Self-approval block | StockLossRecord.Approve() | approverUserId == RecordedByUserId -> reject |
| Offline auth check | OfflineAuthService | hasValidOfflineToken -> allow / deny |
| Delta sync check | SyncMetadataService | hasLastSyncTime -> delta / full |
| Network connectivity | ConnectivityService | isOnline -> remote call / local fallback |
Mobile
| Pattern | Location | Condition |
|---|---|---|
| Draft vs submit | FarmerDraftService | isDraft -> save locally / push to queue |
| Online check | SyncManager | isConnected -> sync / defer |
| Queue empty | OfflineQueueProcessor | queue.isEmpty -> idle / process next |
| Conflict detection | ConflictResolver | localVersion != remoteVersion -> merge / overwrite |
| Chunked upload resume | ChunkedUploadService | hasPartialUpload -> resume / start fresh |
7. Switch (Multi-Branch)
Represents a multi-way branch based on a value (enum, string).
Backend
| Pattern | Switch Value | Branches |
|---|---|---|
| Order status machine | OrderStatus | Pending, Confirmed, InProgress, OutForDelivery, Delivered, Cancelled |
| Batch status machine | BatchStatus | PendingAssessment, Assessed, PartiallyAllocated, FullyAllocated |
| Transfer status machine | TransferStatus | Pending, Approved, InTransit, Completed, Cancelled |
| StockMovement type | StockMovementType | StockIn, Sale, Transfer, Disposal, Loss, Adjustment |
| Campaign status | CampaignStatus | Draft, Published, Closed |
| Production status | ProductionStatus | Planned, Active, Harvesting, Completed, Cancelled |
| Investigation status | InvestigationStatus | Open, InProgress, Resolved, Closed |
| Approval status | ApprovalStatus | PendingApproval, Approved, Rejected |
| QA question type | QuestionType | Numeric, Boolean, SelectOptions, Date |
Mobile
| Pattern | Switch Value | Branches |
|---|---|---|
| Sync entity type | SyncEntityType | farmer, client, order, orderPayment, orderStatusTransition, production, harvest, stockLoss, stockTransfer, cropDemand, surveyResponse |
| Sync direction | Pull / Push | Delta-pull from server / push local changes |
8. Set (Transform)
Represents data transformation -- mapping one shape to another (DTO mapping, model conversion).
Backend
| Pattern | Source -> Target | Location |
|---|---|---|
| Entity -> DTO | Farmer -> FarmerDto | Service layer mapping |
| Entity -> DTO | Client -> ClientDto | Service layer mapping |
| Entity -> DTO | Order -> OrderDto | Service layer mapping |
| Entity -> DTO | CropBatch -> CropBatchDto | Service layer mapping |
| Entity -> DTO | QualityAssessment -> QADto | Service layer mapping |
| Entity -> DTO | Campaign -> CampaignDto | Service layer mapping |
| Create command -> Entity | CreateFarmerRequest -> Farmer.Create() | Factory methods |
| Create command -> Entity | CreateOrderRequest -> Order.Create() | Factory methods |
| Excel row -> Entity | Excel parsed row -> Farmer / Client | FarmerBulkService / ClientBulkImportService |
Mobile
| Pattern | Source -> Target | Location |
|---|---|---|
| JSON -> Model | API JSON -> Dart model | Remote datasource fromJson() |
| Model -> SQLite row | Dart model -> Map<String, dynamic> | Local datasource toMap() |
| SQLite row -> Model | Map<String, dynamic> -> Dart model | Local datasource fromMap() |
| Draft -> API payload | Draft model -> JSON request body | Draft services |
| Sync response -> local | API delta response -> local DB upsert | Sync services |
9. Merge (Parallel Coordination)
Represents joining multiple parallel branches back together.
Backend
| Pattern | Parallel Branches | Join Point |
|---|---|---|
| Order allocation | Multiple batch allocations | OrderService -- aggregates allocated quantities |
| Bulk import | Parallel row processing | FarmerBulkService -- collects results and errors |
| Analytics aggregation | Multiple metric queries | AnalyticsService -- merges stats into dashboard DTO |
| Transfer completion | Per-item received quantities | TransferService -- joins items with discrepancy check |
Mobile
| Pattern | Parallel Branches | Join Point |
|---|---|---|
| Login sync | Master data + farmers + clients + orders | LoginSyncService -- all must complete |
| Full sync | 10+ entity type syncs | SyncCoordinator -- sequential with progress |
| Offline queue drain | Parallel retries per entity | OfflineQueueProcessor -- collects results |
| Chunked upload | Parallel part uploads | ChunkedUploadService -- all parts then complete |
10. Wait (Delay / Backoff)
Represents intentional delays, retries with backoff, or scheduled waits.
Mobile
| Component | Strategy | Purpose |
|---|---|---|
ExponentialBackoffService | Exponential backoff with jitter | Retry failed API calls |
RetryExecutorService | Configurable retry policy | Execute retryable operations |
RetryPolicy | Max retries, delay, backoff factor | Defines retry parameters |
OfflineQueueProcessor | Timer interval | Periodically checks and drains queue |
BackgroundSyncService | Debounce on connectivity change | Waits for stable connection before sync |
Backend
| Component | Strategy | Purpose |
|---|---|---|
ExpiryAlertBackgroundService | Hosted service timer | Periodic batch expiry scan |
11. Loop (Iterative)
Represents processing a collection of items one at a time or in batches.
Backend
| Pattern | Collection | Loop Body |
|---|---|---|
| Bulk farmer import | Excel rows | Validate + create each farmer |
| Bulk client import | Excel rows | Validate + create each client |
| Order allocation | Available batches | Allocate from each batch until fulfilled |
| Transfer items processing | TransferItem list | Record stock movement per item |
| Stock loss items processing | StockLossItem list | Reduce stock per batch |
| Survey export | Survey responses | Transform each response to export row |
| Master data sync | Entity types | Pull each master data table |
Mobile
| Pattern | Collection | Loop Body |
|---|---|---|
| Offline queue processing | Pending queue items | Process each queued operation |
| Master data sync | ~26 master data tables | Pull and upsert each table |
| Chunked upload parts | File chunks | Upload each part with retry |
| Delta sync pages | Paginated API response | Fetch and upsert each page |
| Entity sync | Entity type list | Sync each entity type in order |
12. Error Trigger
Represents exception handling, error recovery, and fault logging.
Backend
| Pattern | Location | Handling |
|---|---|---|
ValidationException | Domain entities | Thrown on invalid state transitions |
InvalidOperationException | Domain methods | Thrown on business rule violations |
| Global exception middleware | API pipeline | Catches unhandled exceptions, returns 4xx/5xx |
AuditLogService | Cross-cutting | Logs security-sensitive operations |
Mobile
| Pattern | Location | Handling |
|---|---|---|
| Sync error handling | All sync services | Logs error, marks entity for retry |
SyncConflictService | Conflict detection | Creates sync_conflicts table entry |
SyncAnalyticsService | All sync operations | Records success/failure metrics |
SyncNotificationService | User-facing | Shows error toast/snackbar |
| Queue retry tracking | SyncQueueService | Increments retry count, marks permanent failure |
EnhancedConflictService | Advanced conflicts | Applies resolution strategies, logs outcome |
13. Database Read/Write
Represents reading from or writing to a database.
Backend -- PostgreSQL (via Entity Framework Core)
| Repository / DbContext | Tables | Operations |
|---|---|---|
ApplicationDbContext | All domain entities | Full CRUD via EF Core |
ASP.NET Identity | AspNetUsers, AspNetRoles, AspNetUserRoles | User/role management |
| Domain entity tables | Farmers, Clients, Orders, OrderItems, CropBatches, StockMovements, Transfers, QualityAssessments, etc. | Business data CRUD |
| Configuration tables | ~35 config entity tables with translations | Master data storage |
Mobile -- SQLite (via sqflite)
| Component | Tables | Operations |
|---|---|---|
DatabaseHelper | All local tables | Schema creation, migrations |
| Farmer local datasource | local_farmers, farmer_crops | Offline farmer storage |
| Client local datasource | local_clients, local_client_crop_demands | Offline client storage |
| Order local datasource | local_orders, local_order_items | Offline order storage |
| Production local datasource | local_production_cycles, local_production_inputs, local_production_harvests | Offline production data |
| Campaign local datasource | campaigns_cache, survey_responses, survey_master_data_cache, survey_file_queue | Offline survey data |
| Stock local datasource | stock_losses, stock_transfers, center_stock_cache, stock_batch_cache, stock_aggregation_cache, stock_cache_metadata | Offline stock data |
| Master data tables | provinces, territories, villages, crop_categories, crop_types, seed_sources, fertilizer_types, pesticide_types, and ~20 more | Cached reference data |
| Sync infrastructure | sync_queue, sync_metadata, sync_conflicts, sync_analytics, sync_history, api_response_cache | Sync state tracking |
| Chunked uploads | chunked_uploads, chunked_upload_parts | Upload resume state |
| Farmer visits | local_farmer_visits | Offline visit data |
| Client documents | client_documents | Offline document metadata |
14. S3 (DigitalOcean Spaces)
Represents object storage operations (file upload, download, signed URLs).
Backend
| Component | Operations | Purpose |
|---|---|---|
DigitalOceanSpacesService | PutObject, GetPresignedUrl, DeleteObject | File storage for photos, documents, exports |
MediaUploadService | Upload with content-type detection | Profile photos, assessment photos, crop photos |
MultipartUploadService | InitiateMultipartUpload, UploadPart, CompleteMultipartUpload | Large file chunked upload |
ExcelExportService | PutObject | Export Excel files to Spaces for download |
Mobile
| Component | Operations | Purpose |
|---|---|---|
UploadService | HTTP PUT to presigned URL | Photo uploads |
ChunkedUploadService | Multi-part upload via API | Large file uploads with resume |
AssessmentPhotoService | Queue + upload | Assessment photo pipeline |
DraftFileService | Local file reference management | Track files pending upload |
SurveyFileSyncService | Push queued files | Upload survey attachments |
15. SignalR (Real-Time Hub)
Represents real-time bidirectional communication.
Backend
| Component | Hub Route | Purpose |
|---|---|---|
PermissionHub | /hubs/permissions | Real-time permission revocation and updates |
Mobile
| Component | Connection | Purpose |
|---|---|---|
PermissionSyncService | SignalR client to /hubs/permissions | Listens for permission revocation events, refreshes per-role permissions |
16. SMS (Africa's Talking)
Represents outbound SMS sending.
Backend
| Component | Provider | Purpose |
|---|---|---|
OtpService | Africa's Talking (configured in appsettings.json) | Sends OTP codes via SMS for phone verification |
17. Push Notification (FCM)
Represents mobile push notifications via Firebase Cloud Messaging.
Backend
| Component | Status | Purpose |
|---|---|---|
PushNotificationService | Stub / partial implementation | Sends push notifications to registered mobile devices |
ExpiryAlertBackgroundService | Uses notification service | Batch expiry alerts |
Mobile
| Component | Purpose |
|---|---|
DeviceRemoteDatasource | Registers FCM token with backend |
18. Code (Complex Inline Logic)
Represents complex procedural logic that does not fit a simple function or IF node.
Backend
| Pattern | Location | Logic |
|---|---|---|
| Order allocation algorithm | OrderService / CropBatchService | FIFO allocation across multiple batches |
| Batch number generation | CropBatch.SetBatchNumber() | Year + sequence number formatting |
| Quality scoring | QualityAssessmentService | Multi-criteria QA scoring per crop category |
| Transfer discrepancy | TransferService.Complete() | Expected vs received quantity comparison and investigation creation |
| Profile completeness | Farmer.GetProfileCompletenessPercent() | 30-field weighted completeness calculation |
| Delta sync logic | MasterDataService | Determines changed records since last sync timestamp |
| Bulk import parsing | ConfigurableExcelParser | Dynamic column mapping from Excel to entities |
Mobile
| Pattern | Location | Logic |
|---|---|---|
| Offline queue processing | OfflineQueueProcessor | Priority-based drain with retry and dead-letter |
| Conflict resolution | ConflictResolver | Field-level merge with last-writer-wins fallback |
| Sync coordination | SyncCoordinator | Ordered entity sync with dependency resolution |
| Pull scope resolution | PullScopeResolver | Determines which data to pull based on user role |
| Exponential backoff | ExponentialBackoffService | Calculates delay with jitter |
| Database migration chain | DatabaseHelper | Sequential migration from v1 through v33+ |
19. NoOp (Skip / Passthrough)
Represents a no-operation path -- when a condition is false and no action is needed.
Backend
| Pattern | Location | Skip Condition |
|---|---|---|
| Delta sync empty | MasterDataService | No changes since last sync -> return empty |
| Approval self-check | Order/Transfer/Loss approval | Already in target state -> no-op |
| Soft delete already deleted | Various entities | IsDeleted == true -> skip |
| Duplicate queue item | Sync processing | Already processed -> skip |
Mobile
| Pattern | Location | Skip Condition |
|---|---|---|
| Queue empty | OfflineQueueProcessor | No pending items -> idle |
| No connectivity | SyncManager | Offline -> defer sync |
| No delta changes | Sync services | lastSyncTime unchanged -> skip pull |
| Already synced | SyncMetadataService | Entity up-to-date -> skip |
| Single dashboard | ActiveRoleManager | Only 1 dashboard -> skip hub, go direct |
Quick Reference Matrix
| n8n Node | Backend Count | Mobile Count | Primary Pattern |
|---|---|---|---|
| Webhook Trigger | 42 controllers | -- | REST API endpoints |
| Schedule Trigger | 1 | 4 | Background timers |
| Manual Trigger | -- | 11+ | User actions |
| HTTP Request | -- | 8 datasources, 25+ services | API calls |
| Function | 50+ services | 15+ services | Business logic |
| IF | 8+ patterns | 5+ patterns | Guard clauses |
| Switch | 9 state machines | 2 | Enum routing |
| Set | Entity <-> DTO | JSON <-> Model <-> SQLite | Data mapping |
| Merge | 4 patterns | 4 patterns | Parallel join |
| Wait | 1 | 5 | Retry/backoff |
| Loop | 7 patterns | 5 patterns | Collection iteration |
| Error Trigger | 4 patterns | 6 patterns | Exception handling |
| Database R/W | PostgreSQL + EF Core | SQLite + sqflite | Data persistence |
| S3 | 4 services | 5 services | File storage |
| SignalR | 1 hub | 1 client | Real-time events |
| SMS | 1 service | -- | OTP delivery |
| Push Notification | 1 stub | 1 registration | Mobile alerts |
| Code | 7 patterns | 6 patterns | Complex logic |
| NoOp | 4 patterns | 5 patterns | Skip paths |