Thursday, 16 May 2019

Understanding how strapi relations works

I'm new to strapi and in general with back end development and I'm trying to understand how a very small things should work.

I have a User model, a Profile model and a Fare model.

A User can have a Profile so I created a relation has and belongs to one. A Profile can have a Fare and I created the same relation between Profile and Fare.

What I noticed here is:

When in the client I land to the profile section I do save it with all it properties like: name, surname, address, etc... and everything is going fine by adding the user id to it.

The point here is that in the same profile section I also have fares inputs and what I would like to do is to save fares by saving the profile and not adding a special save button just for the fares...

Is it something possible to do or am I doing something wrong in here?

I'm separating fares by profile to be able to better find, organise and work with fares without querying for profiles every time but having profile records by id ro something...

Can someone explain clearly the best approach and what should I do to achieve it correctly? Thanks



from Understanding how strapi relations works

No comments:

Post a Comment