Data Layer low complexity shared
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Dart model classes and serialization logic for all proxy and bulk registration domain objects. Includes ProxyActivityRecord, ProxyActivityDraft, BulkRegistrationRequest, BulkRegistrationDefaults, DuplicateConflict, and BulkParticipant.

Feature: Proxy & Bulk Activity Registration

proxy-activity-models

Summaries

Consistent, well-defined data structures are what allow the proxy registration system to communicate reliably between the mobile app, the backend, and the Supabase database. The Proxy Activity Data Models component establishes the shared vocabulary for all proxy and bulk registration data — defining exactly what fields an activity record must carry, how bulk requests are structured, and how duplicate conflict information is represented. When these models are clearly defined and consistently used, integration errors between system layers are eliminated, and new features or reporting requirements can be added without restructuring existing data flows. This reduces integration rework costs and accelerates future feature delivery.

As a shared component with no dependencies, the Proxy Activity Data Models should be the first deliverable in the proxy registration feature — all other components (repository, services, BLoC) depend on these model definitions being stable. Low complexity means one to two days of implementation. However, any breaking change to model field names or serialization logic after dependent components are built will require cascading updates.

Establish a model review checkpoint before other components begin implementation. Key validation: confirm that ProxyActivityRecord includes registered_by and attributed_to as non-nullable fields, that BulkRegistrationRequest correctly represents the shared-defaults structure, and that DuplicateConflict carries enough metadata for the UI to render a meaningful conflict resolution prompt.

These are plain Dart model classes following the fromJson/toJson pattern for Supabase PostgREST compatibility. ProxyActivityRecord must define registered_by and attributed_to as non-nullable String fields mapping to the database columns of the same name. BulkRegistrationRequest.fromForm is a factory constructor that takes a ProxyActivityDraft (shared defaults: date, activityTypeId, locationId, duration) and a List of mentor IDs, producing a list of ProxyActivityRecord instances with attribution fields pre-populated — this logic keeps bulk construction out of the BLoC and repository. DuplicateConflict.fromJson must handle the case where the conflicting record's submitter has been deleted (null user reference).

BulkParticipant.withConflictStatus is a convenience constructor for the BLoC to tag each participant with their conflict result after batch duplicate checking. Mark all model classes as @immutable and use copyWith for state updates in the BLoC.

Responsibilities

  • Define ProxyActivityRecord with registered_by and attributed_to fields
  • Define BulkRegistrationRequest with participant list and shared defaults
  • Provide fromJson/toJson serialization for Supabase communication
  • Define DuplicateConflict model with conflicting record metadata

Interfaces

ProxyActivityRecord.fromJson(Map json)
ProxyActivityRecord.toJson()
BulkRegistrationRequest.fromForm(ProxyActivityDraft draft, List<String> mentorIds)
DuplicateConflict.fromJson(Map json)
BulkParticipant.withConflictStatus(String mentorId, bool hasConflict)