Custom Entity for User

NodeBB Development
  • Hi I have an website to show list of businesses for User.
    I wanna replace this list in Profile page in part of user post list.
    can you guys help me whether we have any example or instruction to do that

  • Take a look at how we store users. We increment a global user id each time a new user is created and store the user data in an object with the name user:<userId> and we store the userId in a sorted set. You need to do something similar for businesses.

    Everytime a new business is created assign it a unique id and store it at business:<businessId> and then also store it for the user at uid:<uid>:businesses.

    It would look something like below in nodebb code. This is obviously pseudocode.

    incr businessId in database
    setObject businness:bussinessId businessData
    sortedSetAdd uid:<uid>:businesses Date.now() businessId
    

    Now you can retrieve a users business with the getSortedSetRange commands using the key uid:<uid>:businesses.


Suggested Topics