Skip to content

sample state

Pasan Dharmasena edited this page Jan 9, 2022 · 18 revisions

Sample State

{
    "entities": {
        "user": {
            "id": 13,
            "host_status": 1,
            "tea_times_hosting": [1], //references tea_times table
            "first_name": "Pasan",
            "last_name": "Dharmasena",
            "bio": "I like to host things",
            "reviews": [1,2] //references reviews table
            "profile_img": "https://somehostingsite.com/",
            //is this information needed?
        },
        "teatimes": {
            "1": {
                "id": 14,
                "host_id": 13,
                "start_time": "2021-11-25T12:00:00",
                "end_time": "2021-11-25T14:00:00",
                "location": "somewhere in staten island",      
                "description": "stuff to do",
                "city_id": 1,
                "attending_users": [3,12,20]  //references users table
            },
            "2": {
                "id": 6,
                "host_id": 5,
                "start_time": "2021-11-25T12:00:00",
                "end_time": "2021-11-25T14:00:00",
                "location": "near prospect park",
                "description": "stuff to do",
                "city_id": 1,          
                "attending_users": [5,13] 
            },
            "3": {
                "id": 20,
                "host_id": 20,
                "start_time": "2021-11-25T12:00:00",
                "end_time": "2021-11-25T14:00:00",
                "location": "santa monica pier",
                "description": "stuff to do",
                "city_id": 2,        
                "attending_users": [2] 
            }
        },
        "cities": {
            "1": {
                "id": 1,
                "name": "New York City"
            },
            "2": {
                "id": 2,
                "name": "Los Angeles"
            }
        },
        "attendance": { 
            "1": {
                "id": 1,
                "teatime_id": 2,
                "user_id": 7,
                "status": 1
            },
            "2": {
                "id": 2,
                "teatime_id": 2,
                "user_id": 9,
                "status": 1
            },
            "3": {
                "id": 3,
                "teatime_id": 1,
                "user_id": 13,
                "status": 1
            }
        },
        "reviews":{ 
            "1": {
                "id": 1,
                "user_id": 13,
                "host_id": 4,
                "rating": 4,
                "review": "this host was good"
            },
            "2": {
                "id": 2,
                "user_id": 13,
                "host_id": 7,
                "rating": 1,
                "review": "this host was bad"
            }
        }
    },
    "ui": {
        "loading": true/false
    },
    "errors": {
        "login": [
            "Incorrect username/password combination"
        ],
        "teatimeForm": [
            "All fields must be filled"
        ]
    },
    "session": {
        "currentUserId": 13
    }
}
Clone this wiki locally