【发布时间】:2017-03-14 11:02:11
【问题描述】:
我是 Firebase 的新手,正在使用 NoSQL 数据库结构。我正在努力实现 Weight Lifting Tracker iOS 应用程序的最终目标。
该应用程序将容纳不同的用户,每个用户都会记录自己的锻炼情况,然后应该能够查看他们进行的锻炼的历史记录以及他们举起的重量,以便监控进度。
数据库将保存一个预先定义的练习列表,并能够添加独特的练习,以便它仅适用于该用户以及预定义的列表。
用户将能够定义一个例程,该例程是通过存储名称、创建日期、该锻炼中的锻炼以及锻炼之间休息的默认计时器来创建的。
然后用户将执行一个锻炼程序,他们将在其中实际选择上面创建的程序并跟踪他们举起的重量和组数,例如
Bench Press:
Set 1: 80kg x 8 reps
Set 2: 80kg x 8 reps
Set 3: 80kg x 6 reps
...
但是,用户可能并不总是在开始锻炼之前创建例程,因此他们将从预定义的锻炼列表中选择锻炼。
我的 NoSQL 数据库有以下结构,想知道我所做的是否正确,这是我第一次尝试为该问题设计模型,因此欢迎任何建议来帮助改进和可能解释,这样我就可以离开并改进整体设计:
{
"users": {
"user unique identifier": {
"name": "User Full Name",
"email": "User Email",
"profileImageUrl": "Profile Image Url",
"routines": {
"routine unique identifier": true
},
"workout routine":{
"workout routine unique identifier": true
}
}
},
"exercises": {
"exercise unique identifier": {
"exercise_name": "exercise name",
"body_part": "body part",
"routines": {
"routine unique identifier": true
}
}
},
"routines": {
"routine unique identifier": {
"routine_name": "routine name",
"routine_create_date": "routine created date",
"exercises":{
"exercise unique identifier": true
},
"default timer": "timer duration"
}
},
"workout routine": {
"workout routine unique identifier": {
"date": "workout routine start date",
"start_time": "workout routine start time",
"end_time": "workout routine end time",
"duration": "start_time - end_time",
"end_date": "workout routine end date",
"routine unique identifier": {
"exercise unique identifier": {
"exercise name": "exercise name",
"set n weight": "weight lifted in set n"
"set n reps": "Reps performed for set n",
}
}
}
}
}
【问题讨论】:
标签: ios swift firebase firebase-realtime-database