Firebase Data Model for iOS Poker Game
Firebase is my tool of choice for auth, storage and db. I am currently working on a hobby. Firebase is a wonderful tool that makes a lot more sense to me. But, I have a question about how I should structure the data model that will work with my UI. Although I think I have the answer, I'd like to get your feedback.
I currently have two collections: Users and Tables. (This is the poker table). The UI will contain a page called "Recent Tables" that lists all the tables the user has played, using a query based their UID. Each Table will have some top-level info such as table name, game type, date, etc. You can view details about a table, such as the names of players, their winnings, and how many hands were played. The user can also access each Hand to view its history and a list with Actions for each round.
I initially tried to add players to each table as an array of objects, but it wasn't a good way to query. Instead I created a sub-collection for Players and Hands. The Players collection will include documents with information on each player using their UID as the document title.
Hands will include a little more information, as well as more sub-collections. It's composed of Rounds. Actions are also included in Rounds.
Is this a safe route? Can I query this information later? Rounds can be stored as an array or objects that I can then parse on the client's side. What about a Hand collection that I can keep at the root? Only store an array "handIDs", not the entire Table document.
Any suggestions are greatly appreciated. model selection for poker handicapping
Komentar
Posting Komentar