Service Layer medium complexity mobile
1
Dependencies
2
Dependents
3
Entities
0
Integrations

Description

Business logic service handling contact record updates via PATCH to the REST API. Manages field-level change detection, optimistic update state, rollback logic, and role-based edit permissions. Validates that the current user has permission to edit the contact based on their role and assignment relationship.

Feature: Contact Detail & Edit

contact-update-service

Responsibilities

  • Send PATCH requests to REST API with only changed fields
  • Track optimistic update state and revert on failure
  • Enforce role-based edit permissions (peer mentor edits own contacts, coordinator edits team contacts)
  • Coordinate field-level validation before submission
  • Handle conflict resolution when contact was modified by another user

Interfaces

updateContact(String contactId, Map<String, dynamic> changes)
getContact(String contactId)
validateContactChanges(Map<String, dynamic> changes)
checkEditPermission(String contactId, String userId)
detectChangedFields(Contact original, Map<String, dynamic> formData)
handleConflict(Contact serverVersion, Contact localVersion)
revertOptimisticUpdate(String contactId)

Relationships

Dependencies (1)

Components this component depends on

Dependents (2)

Components that depend on this component

Related Data Entities (3)

Data entities managed by this component