Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Firebase Realtime DB & fetch real data for home & detail screen. #29

Open
pocha opened this issue Jan 31, 2024 · 1 comment
Open
Assignees
Milestone

Comments

@pocha
Copy link
Contributor

pocha commented Jan 31, 2024

Realtime DB data structure here

For our case, the data need to be like

users: {
  <id>: {
      tags: {tag_id1, tag_id2 ..}
   }
}

tags: {
  <tag_id>: {
     name: _string_
     owner: _user_id_
     shared_with: { user_id1, user_id2},
     expenses: {expense_id1, expense_id2}
  }
}

expenses: {
   <expense_id>: {
       timestamp: _number_,
       from: user_id,
       to: user_id,
       amount: _number_,
       tags: {tag_id1, tag_id2}
   }
}

Populate some data manually in Realtime DB for a user including tag + expenses & show the data in home & detail screen

For reading data from the Firebase DB, use onValue() rather using get() as explained here

@pocha pocha added this to the v1.0 milestone Jan 31, 2024
@pocha
Copy link
Contributor Author

pocha commented Feb 20, 2024

  • Home page init should

    • listen on user tags
      • onChildAdded to add new expenses on the UI
      • onChildRemoved to remove the tag from the UI
      • for each tag - listen on filtered expenses for the month & add them to create the current month aggregated sum & show on the UI
  • Detail page init should

    • listen on the expenses under the tag
      • onChildAdded to add the new expense in the Expenses UI. Also update the monthly sum for the month for the UI
      • onChildRemoved to remove the expense from the UI & reduce the monthly sum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants