Overview
The current implementation of the logRelapse function in src/utils/firebase.ts needs updating to improve how relapse data is stored. Currently, relapse data isn't structured optimally. We want to restructure the data storage to ensure each user has their own dedicated document, and each relapse event is clearly mapped within that user's document.
The new structure should follow this pattern:
- Each Firestore document corresponds to a unique user.
- Within each document, relapse events are stored as a mapping.
- Each relapse entry should contain the following fields:
{
timestamp: Timestamp.now(),
triggers: triggers,
notes: notes || ''
}
Todos