Way Forward Item Repository
Component Detail
Description
Manages persistence of way-forward follow-up items in Supabase, linked to their parent report. Supports coordinator workflows by providing query and status-update operations for outstanding follow-up tasks.
way-forward-item-repository
Summaries
The Way Forward Item Repository ensures that every commitment made during a report is captured, tracked, and actioned. By persisting follow-up tasks directly linked to their source reports in a reliable cloud database, this component eliminates the common business risk of action items falling through the cracks after field visits or inspections. Coordinators gain immediate visibility into outstanding tasks assigned to them, enabling faster resolution cycles and improved accountability across the organization. This directly reduces operational risk, supports compliance requirements where follow-through must be demonstrable, and builds trust with stakeholders who need confidence that identified issues are being addressed systematically and on time.
This is a low-complexity data repository component targeting both mobile and backend execution contexts, making it straightforward to scope and deliver. Its five well-defined interfaces — create, query by report, query by coordinator, status update, and delete — map cleanly to distinct user workflows and can be developed and tested independently. The component has no declared dependencies on other components, reducing integration risk and allowing parallel development tracks. Testing should cover batch insert integrity, status transition logic, and query correctness under coordinator-scoped filtering.
Deployment considerations include Supabase row-level security policies to ensure coordinators only access their own items. No significant delivery risks are anticipated given the low complexity rating.
Way Forward Item Repository is a data-layer component that wraps Supabase CRUD operations for the `way-forward-item` data model, operating in both mobile (React Native or similar) and backend contexts. The `createItems(reportId, items[])` interface performs a batch insert, linking all items atomically to their parent report — use Supabase's `insert` with an array payload and ensure `reportId` is validated before the call. `getItemsByReport` and `getItemsByCoordinator` are straightforward select queries with foreign-key and ownership filters respectively; apply RLS policies at the database level to back these up. `updateItemStatus` should be implemented with optimistic locking or a `updated_at` timestamp check to prevent race conditions if multiple clients update the same item.
The component has no upstream dependencies, so it can be tested with direct Supabase client mocks.
Responsibilities
- Insert way-forward items batch-linked to a report
- Query outstanding follow-up items for a coordinator
- Update resolution status of individual items
Interfaces
createItems(reportId, items[])
getItemsByReport(reportId)
getItemsByCoordinator(coordinatorId)
updateItemStatus(itemId, status)
deleteItem(itemId)