Skip to content

fix: Relapse Firebase Integration Objects #10

@JustinhSE

Description

@JustinhSE

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

  • Update the logRelapse function in src/utils/firebase.ts to assign each document to a specific user ID and create a new doc if the userID isn’t found.
  • Within each user's document, implement a mapping structure for storing relapse events.
  • Ensure each relapse entry includes the fields: timestamp, triggers, and notes.
  • Test the updated implementation thoroughly to ensure correctness and data integrity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions