Report Template Repository
Component Detail
Data Layer
low complexity
mobile
0
Dependencies
2
Dependents
0
Entities
0
Integrations
Description
Persists report template configurations in the local SQLite database to enable offline form completion. Manages cache invalidation and synchronization with the remote template definition when connectivity is restored. Stores the full template schema including field definitions, labels, and visibility rules per organization.
report-template-repository
Responsibilities
- Cache active report template locally for offline form rendering
- Retrieve cached template by organization ID from local database
- Invalidate and refresh cached templates on successful remote fetch
- Persist completed home visit report drafts locally before sync
- Track template version to detect stale cache entries
Interfaces
saveTemplate(organizationId, template: ReportTemplate): Future<void>
getTemplate(organizationId): Future<ReportTemplate?>
deleteTemplate(organizationId): Future<void>
isTemplateCached(organizationId): Future<bool>
getTemplateVersion(organizationId): Future<String?>
saveReportDraft(activityId, draftData): Future<void>
getReportDraft(activityId): Future<ReportDraft?>
deleteReportDraft(activityId): Future<void>
getAllCachedTemplates(): Future<List<ReportTemplate>>
Relationships
Dependents (2)
Components that depend on this component