Database structure for user assets

Hi Guys,

Im a bit stuck on a new project and cant find a good resource to assist here. Right now i am trying to create a user database where users can hold assets. I will make the question as simple as possible.

Each user has 1 bag, each bag can contain multiple fruits.

Fruit can be added or removed incrementally. New fruit will be added to the platform over time.

  1. What would be the process to link all these together
  2. What would be the process to have a unique “bag” created and attached to each user
  3. Updating and removing fruits from the users bag

Any help is greatly appreciated!

Thanks

  1. Database setup, create these data types: User (already there), Bag (if for any reason you want these to be transferrable in the future and not permanently attached to a user), and Fruit.

  2. Create the following fields for each, plus whatever else you watch. The Bag datatype should have a ‘user’ field with the value set to User. The Fruit datatype should have a ‘bag’ field with the value set to Bag.

  3. On user signup, create a new Bag and set the ‘user’ to the Current User.

  4. Whatever methodology you use for creating and deleting fruits in your app, always create the fruit with the ‘bag’ set to the current user’s bag. If each user only has one bag, the easiest way to do this would be Do a search for Bag (inside of the search, 'user' = Current User), :first item.

Thank you brother. This is great!

Quick addition to this. The user will need to hold multiple fruit.

So would how would this be created?

You’d just Create new thing and add as many fruits as you need like shown in Step 4! If it’s not making sense, happy to hop on a quick call and show you - it’s super simple.

Appreciate the help brother, all sorted now :slight_smile: