Skip to content
Don Park edited this page Jun 8, 2015 · 21 revisions

User

  • string username
  • string email
  • string name
  • has_many devices

v1

{
    "_id": "2af33a50926ec2e509887b33e6071073",
    "_rev": "6-84e8218b032cf32818d77f45fc5b1205",
    "username": "donpdonp",
    "email": "don.park@gmail.com",
    "password": "$2a$10$DIJn8kaRBpiGogLRyE1IJ.5/UTgo14Og6MjtfSObmYGb3XtCmzhBK",
    "oauth_token": "abc12345",
    "friends": [
        "frontpage",
        "zenlinux"
    ],
    "updated_at": "2014-01-17T18:31:25Z",
    "created_at": "2012-10-18T03:44:26Z",
    "type": "user"
}

v2 table 'users'

{

    "access": {
        "public": true
    } ,
    "devices": [
        "device-121f83ff-11d0-4e88-a8c8-63c853889b7c" ,
        "browser" ,
        "181687b2-8b6a-4224-ba8a-bf3ff848412a"
    ] ,
    "email": "don.park@gmail.com" ,
    "friends": [
        "99754564-e864-4039-82b7-31d24e54d763" ,
        "2986965e-7e1e-4e2f-8382-9c7d90d91dab" ,
        "5a39a38b-9342-4518-aa86-b2a80ccfccca"
    ] ,
    "id": "7984bfd3-b37d-4017-a6b7-z1855d625075" ,
    "username": "donpdonp"

}

v2 access update (not implemented yet)

{
    "access": {
        "location.read": [ "123abc-abc123", "public" ],
        "location.write": [ ],
        "user.read": [ ],
        "user.write": [ ]
    }
}

user authentication

v2

authentication table - kept in redis.

A token request starts with a pre-existing state where the user record only exists in redis. this keeps the server load low by not touching the database when a user puts in a new email address and no user document is created until first use. You can see this in key#107/value#108.

After first use a user document is created for the email address with a unique id. the redis table contains a key that is valid only for the user/device pair. there is a special device id called 'browser' to avoid the problems of assigning a unique device id to each browser instance.

127.0.0.1:6379> hgetall session_keys
107) "browser_key-9953a818-6c33-48c0-ad05-3af26bk12890"
108) "{\"device_id\":\"browser\",\"email\":\"don.park+donp@gmail.com\"}"
109) "haSt00hAWpmTytSkRegAYIApqeWz2E2mXWibZVH5AAi="
110) "{\"user_id\":\"7984bfd3-b37d-4017-a6b7-z1855d625075\",\"device_id\":\"device-72924d0f-67f0-2545-90ec-d2004d9d019a\"}"

Device

  • string device_id
  • string name
  • string makemodel
  • has_one user

Not implemented yet

Location

  • has_one device
  • has_one user

v1

{
    "_id": "ffff953d-e71b-479e-8aee-3b7d3b35ff22",
    "_rev": "1-060d409d2f0fc9bd8b2e5aa0856d94ba",
    "type": "location",

    "provider": "gps",
    "position": {
        "accuracy": 19,
        "altitude": 10,
        "longitude": -122.64414168,
        "latitude": 45.51321667
    },
    "ac_power": true,
    "battery_level": 81,
    "velocity": 0,
    "date": "2014-04-26T04:25:13Z",
    "heading": 0,

    "username": "donpdonp"
}

v2

{
    "id": "39660d0f-e051-4ecf-87cc-308fc8150e09" ,
    "class": "com.icecondor.eaglet.db.activity.GpsLocation" ,
    "type": "location" ,

    "provider": "gps" ,
    "accuracy": 39 ,
    "latitude": 45.53604764 ,
    "longitude": -122.68711229 ,
    "date": "2014-10-17T16:39:23.971Z" ,

    "user_id": "7984bfd3-b37d-4017-a6b7-e6855d625075" ,
    "device_id": "device-121f83ff-11d0-4e88-a8c8-63c803889b7c" ,
}

Heartbeat

{

    "battery": {
        "percentage": 0
    } ,
    "class": "com.icecondor.eaglet.db.activity.HeartBeat" ,
    "date": "2014-10-07T22:34:39.070Z" ,
    "device_id": "device-121f83ff-11d0-4e88-aac8-63c803889b7c" ,
    "id": "0012ef6f-5ef6-4e96-bafe-faa3e9cd4480" ,
    "type": "heartbeat" ,
    "user_id": "7984bfd3-b37d-4017-a6b7-z1855d625075"

}

Status Report

{

    "client_count": 1 ,
    "date": "2014-10-17T17:40:33.382Z" ,
    "freemem": 91529216 ,
    "id": "0042d88b-abc9-4e70-82d9-12928ecb572f" ,
    "msg_rate": 0 ,
    "server": "icecondor-ae" ,
    "type": "status_report" ,
    "version": "2-2d75e6f"

}

Fence

Group

has_many devices

Clone this wiki locally