Structuring a user types in scrapi

Hi everyone,
How do I structured my user content type to accommodate for 3 types of users. I.e. COMPANIES, CUSTOMERS and EMPLOYEES.
NOTE:- The COMPANIES user category has a relationship with both the CUSTOMERS and the EMPLOYEES. And each CUSTOMER and an EMPLOYEE user must be attributed to a COMPANY user.

In this case I would recommend 3 new models:

  • Companies
  • Customers
  • Employees

Each of these would have a relation to the users model from the users-permissions, this would allow for different fields for each but still maintaining a single users model. Management of the relations could be done via the model lifecycles or some custom logic. (you will probably need to have some policies as well for security)

Beyond that we don’t have any sample code for this use case.

1 Like