Skip to content

Object schemas

Matthew Henry edited this page Mar 9, 2020 · 1 revision

Object/Storage schema

Voter/User

Each user object/document should contain the following schema, on a new vote being flushed to the DB the given user will be updated to add a new vote entry in the votes array.

{
  "id": 0,
  "name": "name",
  "area": "D",
  "desk": 17,
  "votes": [
    { 
      "opinion": -1,
      "time": "33:25:19T29:2:2020"
    }
  ]
}

Sensor

Each Sensor object/document should contain the following attributes. On a new sensor reading being flushed to the DB the given sensor will be updated to add a new temperature entry in the temperatures array.

  {
    "id": 0,
    "area": "A",
    "temperatures": [
      {
        "temp": 22,
        "time": "33:25:19T29:2:2020",
      }
    ]
   }

Alerts

Each Alert sent should be stored as below. Alerts should be updated in the DB if they are considered "complete", such that the active attribute should become false. Each Alert is distinct such that on a new alert being sent a new alert object should be created.

  {
    "type": 1,
    "time": "33:25:19T29:2:2020",
    "active": true,
    "content": [
       {
         "sensorID": 0,
         "area": "D",
         "temperature": 21,
         "change": 2,
       }
    ]
  }
Clone this wiki locally