Firebase-database:具有数据一致性的事件应用程序的结构

时间:2017-09-06 22:39:38

标签: json firebase-realtime-database

正如我之前的许多人一样,我正在使用Firebase作为数据库构建一个事件应用程序。

看了这个https://www.youtube.com/watch?v=i1n9Kw3AORw后,我认为我当前的数据结构是错误的,所以我想改变它。

我希望能够跟踪用户访问过的事件,他们的回复,签到并帮助更新视频中的用户信息。

{
    "events": {
        "event1": {
            "title": "Event 1",
            "venue": {
                "venue1": true
            },
            "guests": {
                "user1": true,
                "user2": true
            }
        },
        "event2": {}
    },
    "locationHistory": {
        "location1": {
            "user1": true,
            "user2": true
        },
        "location2": {
            "user3": true
        }
    },
    "userCheckIns": {
        "event1": {
            "user1": true
        }
    },
    "userResponses": { // not sure about these responses
        "event1": {
            "user1": true,
            "user2": false,
            "user3": "maybe"
        },
        "event2": {}
    },
    "eventGuests": {
        "event1": {
            "user1": {
                "name": "user name 1"
            },
            "user2": {
                "name": "user name 2"
            }
        },
        "event2": {}
    },
    "userEvents": {
        "user1": {
            "event1": true
        },
        "user2": {
            "event1": true
        }
    },
    "venues": {
        "venue1": {
            "name": "Venue name",
            "location": "location1"
        },
        "users": {
            "user1": {
                "name": "user name 1",
                "events": {
                    "event1": true
                }
            },
            "user2": {
                "name": "user name 2",
                "events": {
                    "event1": true
                }
            }
        }
    }
}

0 个答案:

没有答案