tekuma / curator-portal

Interface for the Curation database
0 stars 0 forks source link

Optimize firebase database for sorting. #79

Closed xstephen95x closed 7 years ago

xstephen95x commented 7 years ago

The curator's review manager calls for data from the 'approved', 'declined' and 'submissions' branch, usually ordered by the "submitted" tag, which is the number of seconds since java epoch. This allows us to sort chronologically.

In the firebase database rules, use the .indexOn rule with the 'submitted' field specified, for better performance.

See : https://firebase.google.com/docs/database/security/indexing-data

xstephen95x commented 7 years ago

Completed. Database rules have been updated:

{
  "rules": {
    "users": {
      ".read" : "auth != null",
      ".write": "auth != null"
    },

    "projects":{
      ".read" : "auth != null",
      ".write": "auth != null"
    },

    "approved":{
      ".read" : "true",
      ".write": "auth != null",
      ".indexOn": "approved"
    },

    "declined":{
      ".read" : "true",
      ".write": "auth != null",
      ".indexOn": "declined"
    },

    "submissions": {
      ".read": "true",
      ".write": "auth != null",
      ".indexOn":["submitted", "status"]
    },

  }
}