I am trying to figure out the best way to structure the data for my app. I want it so users have a list of trips and then can go to a detail view for expenses (fuel, hotel, food, misc).
The number of trips for a user will be a lot and this is just an example there will be about 20 items on the details page. I feel like I am overthinking it but not sure if having it read all 20 items of every trip in the list just to display 2 items for each trip is a good idea.
Not sure if it will make a difference but I am using Xcode 12.4
Would it be best to have the trip summary and then a subcollection of details?
users:
- UID: "randomly_generated"
- firstName: "James"
- email: "a@email.com"
trips:
- startDate: "2/5/2022"
- destination: "Orlando, FL"
- userID: "Users UID"
- details: []
- food: "150"
- hotel: "400"
- fuel: "250"
- misc: "75"
or should I just have it all under trips?
users:
- UID: "randomly_generated"
- firstName: "James"
- email: "a@email.com"
trips:
- startDate: "2/5/2022"
- destination: "Orlando, FL"
- userID: "Users UID"
- food: "150"
- hotel: "400"
- fuel: "250"
- misc: "75"