Data Management
Our database is organized as:
users/
team
admin
teams/
name
logo
games/
active
date
location
opponent
time
stats/
stat
players/
name
number
position
image
stats
opponents/
logo
name
We used Firebase for our authentication, and database using Firestore. When users create accounts they we use FirebaseAuth to authenticate and create their accounts. When a user account is created, a user account is created in the database with a team and admin field. The team’s of the user accounts contain the team name, its logo, and a collection of games, players, and opponents. Games contains whether it is active, the date, location, opponent, time, and a collection of stats. Players has the name, number, position, image, and their stats such as goals scored and yellow cards. Lastly the opponent collection only stores the logo and name of the opponent, which is used to display the versus page.
We decided to go with this approach, because each of the users have their individual teams that they follow. In addition, the way firestore organizes data, allows us to query the individual properties of each of the collections, without returning the subcollections. This allows us to make minimal network calls to get what we want when we need it.
By using firestore, we were able to able allow for offline persistence, which allows for offline CRUD.