Hey ya'll,
An area I'm struggling with is how to determine making the call to either create a new API or modify an existing API. While it is relatively simple to create new APIs, the list of APIs just continues to grow.
I'll paint a scenario for example sake.
- I've decided to have two user types - it will use the same user table but there will be a boolean for determining if the user is a standard user or not.
- When creating company (table), the users that are NOT standard can be linked to a company through a relationship (company user)
- Updating (POST) a company record to add a user should only be possible IF the user is 'Yes' (a company user)
In the standard CRUD that is created when adding the company table and relationship field, I don't see an obvious function for checking that the user has 'true' for the boolean before allowing the user to be added to the record.
As I play with it I'm leaning towards (if possible) to allow the POST (edit) API to modify this single field (if necessary, such that the front-end is attempting it) but how can I allow the EDIT of the entire record but ONLY allow this one field to be edited based on the boolean being true?
AKA: 'Allow the user ID to be added to this record IF the boolean is true, otherwise do not…but still allow all the other fields to be modified as intended)?
With that said, it seems the Function Stack could be very large when considering many of the conditions across the entire ecosystem.
TL;DR: is there a set of considerations to take when deciding if you should add another API or use the Function Stack for an existing? If so, where does one learn?