且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Firebase创建公共/私人用户配置文件?

更新时间:2022-05-24 22:11:29

记住-用户将只有您在应用程序中定义的访问级别。

Remember - users will have only the level of access that you define in your app.

您可以在配置文件设置中包含一个字段公开/私有,当您检索配置文件列表时,仅过滤公开

You can have a field within the profile setting for public / private, and when you retrieve the list of profiles, filter for public only

您可以通过多种方式来实现此目的,但这是一个示例,结构化数据

There are many ways you could implement this, but here's an example of how you might structure your data

,那么您只需要以便将所有公开个人资料返回给用户

and then you just need to return all public profiles to your users

使用这种方法,您需要确保在移动记录时在私人和公共记录之间移动记录。另外,您也可以将它们全部放在一棵树中,并具有可见性的附加索引,然后根据该字段进行查询

With this approach you would need to make sure you move records between private and public when you move them. Alternatively, you could have them all in one tree with an addition index on visibiity, and query based on that field