meumobi / AMS.Report

1 stars 1 forks source link

Define a Data Structure Model on Firebase #4

Closed danielindiano closed 5 years ago

danielindiano commented 7 years ago

Define wich data structure we'll use to store the reports on firebase.

We can use:

Simple data on /reports

screenshot from 2017-03-23 15-24-00

Insert a new level for date /reports/

screenshot from 2017-03-23 15-23-06

Insert a new level for provider /reports/

screenshot from 2017-03-23 15-26-21

Another suggestion?

vdias38 commented 7 years ago

Because we can’t query on multiple fields we should structure our json tree as /reports/:site

ams_report_ _realtime_database_ _firebase_console

Queries can only order by one key at a time

source: https://firebase.google.com/docs/database/admin/retrieve-data

It should allow to call site on URL and filter results by start_date and end_date

    if (this.site) {
      query.orderByChild = 'date';
      query.startAt = "2017-03-02";
      query.endAt = "2017-03-04";
    }

    this.reports = db.list('/reports/' + this.site.title, {query: query});