Skip to content

Database schema

Vishal Singh edited this page May 24, 2020 · 1 revision

Firebase Database will have following collections

users: Collection of User groups: Collection of Group globalChat: Collection of ChatMessage

User model:

fields

1) `userId: String` (unique user id automatically given to every user to link to user id in auth),
2) `name : String`,
3) `kerberosEmailID : String`,
4) `password : String` (Need to see how Firebase handles all this),
5) `mobileNumber: String`,
(make sure mobileNumber.startsWith("+91") and mobileNumber.length = 12),
6) `hostel: String`, give drop down for all the hostels,
7) `sex: int` (sex = 0 Female, sex = 1 Male) (Ig enum would also be possible),
8) `totalRides: int`,
9) `cancelledRides: int`,
10) `actualRating: int, max value = 5` (Rating shown to other users is diff)

collections

  1. tokens tokens will contain documents named tokenId and each tokenID document contains
{
createdAt: DateTime,
platform: android/ios,
token: String
}

these tokens are used to send notification to user, token is specific to a phone. I user can have multiple tokens in case he later logins into the app on another phone

requestDetail model: (or /Filter/Search)

(used while filtering matched against different groups, currentTime = joiningTime if he joins group) note: suggest a better name for this model, groups contains of List of this model

1) user: userId // Text Field derived from the user logged in,
2) destination: Destination,
3) startTime: DateTime,
4) endTime: DateTime,
5) threshold: Time (Need to hold duration here),
6) finalDestination: String (destination after reaching the terminal),
7) maxPoolers: Int field(2-6),
8) joiningTime: DateTime

Group model: (For cabs):

1) owner: UserModel
2) users: List<requestDetail>,
3) destination: Destination,
4) startTime: DateTime,
5) endTime: DateTime,
// startTime = max(startTime of all users) endTime = min(endTime of all users)
6) threashold: Time,
7) maxPoolers: int Field(2-6),
8) chatMessages: List<ChatMessage>

Destination model:

1) destinationName: String,
2) destinationLatLng: LatLng

ChatMessage model:

1) userId: String,
2) userName: String,
3) dateTime: DateTime,
4) message: String