我试图为我的第一个NOSQL数据库(firestore)建模,以反映民主组织(例如当事方)关于思想的决定。
因此,如果您可以回顾我的NOSQL概念并给我有关如何改进它的提示,我将非常感谢。如果您喜欢这个想法,如果您想支持该项目,请查看Git-Repo:https://github.com/donnerstagnacht/leftlife
所以,我考虑了一个具有以下属性的民主思想模型:
// attributes of the idea
ideaID: string;
location: string;
image: string;
video: string;
text: string;
hashtags?: Object[];
date?: string;
用户现在可以执行以下操作:
- 喜欢这个想法
- 分享想法
- 添加评论
- 添加建议
- 群体可以支持一个想法
用户和应用程序还将定期执行以下操作:
- 用户搜索iDAYANS(searchComponent)
- 用户搜索IDEAHASHTAGS(searchComponent)
- 用户在时间跨度(搜索COMPONENT)
- 应用程序要求某个事件的所有想法(EventComponent)
- 应用要求某个人的所有想法(ProfileComponent)
- 应用要求某个群体的所有想法(groupComponent)
- 应用要求大多数喜欢的想法
- 应用要求与最支持的群体提出想法
要完全渲染创意视图,我必须检索有关:
- 作者
- 评论
- 提案
- 事件
- 喜欢
- 支持组
在我看来,我想创建6个集合:
- 想法收集
- 用户集合
- 评论集合
- 提案收集
- 活动集合
- 集团集合
...进行以下查询以呈现IdeaComponent的视图
// the idea has an author
// query idea collection to retrieve
userID: string;
userName: string;
userImage: string;
// user can add comments
// query comment collection to retrieve
commentID: string;
commentText: string;
commentAuthorName: string; // userName
commentAuthorID: string; // userID
commentAuthorImage: string; // userImage
// user can add proposals how to change the idea
// query proposal collection to retrieve
proposalID: string;
proposalText: string;
proposalAuthorName: string; // userName
proposalAuthorID: string; // userID
proposalAuthorImage: string; // userImage
// user discuss the idea at real life events
// query event collection to retrieve
eventID: string;
eventAuthorName: string;
eventAuthorID: string;
eventAuthorImage: string;
// user can like the idea
// query user collection to retrieve
userID: string;
userName: string;
userImage: string;
// groups can support the idea
// query groups collection to retrieve
groupID: string;
groupName: string;
groupImage: string;
有两种模拟数据的方法:
直接来自Firestore
检查文档:https://firebase.google.com/docs/firestore/data-model
2来自您的代码
即:我删除了IDEAID,因为它将自动生成。
export interface IdeaModel {
location: string;
image: string;
video: string;
text: string;
hashtags?: Array<string>;
date?: Date;
}