Skip to content

Data Models

RutvikTak edited this page Feb 25, 2022 · 18 revisions

Chat

type ChatMessage struct {
    Message         string
    PhotoURL        string
    SendDate        Time.time
    Type            string
    UID             string
    User            string
}

Notification sent from either Firebase/Pusher

x? = can be null

{
   notification:{

   String?  title,
   String?  body,
   String?  image, // update image parameter as per platform to display image in notifications tray

   },
   data:{

   String?  "image" //this image field is used within app,
   String?  "interest": //interest name,
     // if it's a Chase notification then pass the chaseId
   String?  "chaseId"://chaseId

   }
}

Notification Document schema stored for each User in this single notifications collection when any Notification is sent

{
    String interest,// interest name
    String? id,// notification doc id 
    String uid, // user unique id
    String? title,
    String? body,
    String? image,
    TimeStamp? createdAt,
    // Schema for this `data` will be same as the data schema sent in notification from firebase/pusher except the image and interest
    // can be dropped here as we already pass them above.
    Map<String, dynamic>? data,
      
}

Notifications

type Notification struct {
	Name		string
	Desc            string
	ImageURL	string
	URL		string
}

Chase Model

type Tags struct {
	Name		[]string
}

type Networks struct {
	Name		string
	URL         string
	Tier		int
	Logo		string
	Other		string
}

type Wheels struct {
	W1  string
	W2  string
	W3  string
	W4  string
}

type Sentiment struct {
	Magnitude	float64		`firestore:"magnitude"`
	Score		float64		`firestore:"score"`
}

type Chase struct {
	ID          string    	""
	Name        string    	`firestore:"Name"`
	Desc        string    	`firestore:"Desc"`
	Live        bool      	`firestore:"Live"`
	Networks	[]Networks	`firestore:"Networks"`
	Wheels      Wheels      `firestore:"Wheels"`
	Votes       int       	`firestore:"Votes"`
	CreatedAt   time.Time 	`firestore:"CreatedAt"`
	EndedAt     time.Time 	`firestore:"EndedAt"`
	ImageURL    string      `firestore:"ImageURL"`
	Reddit		string		`firestore:"Reddit"`
	Sentiment	Sentiment
	Tags		Tags
}

Push Tokens

type PushTokens struct {
	Token		string		`json:"token"`
	CreatedAt	time.Time	`json:"created_at"`
	TokenType	string		`json:"type"`
}

User Model

type User struct {
	UID 		string			`firestore:"uid"`
	LastUpdated	time.Time		`firestore:"lastupdated"`
	PhotoURL	string			`firestore:"photourl"`
	UserName	string			`firestore:"username"`
	Tokens		[]PushTokens	`firestore:"tokens"`
}
Clone this wiki locally