jeudi 8 février 2018

What is the best design pattern for filtering results by a relation?

Here is the example of my model.

Example Model

As you can see, almost every entity is related to Customer entity.

A User can only see related entities to the customer whom he/she representing. But there are also other users which can be assistant to other users.

In every UI we need to filter the results (such as Transportation, Offer, Package, Order etc.) according to the customer and user relationship.

By which I mean, every user can only see his/her own customer's results or results of another user whom this user is assigned as an assistant.

There are too many entities which are related to the Customer entity itself.

So I was wondering, if there is pattern which can be applied in this scenario ? Rather then explicitly impelementing the same logic in every service ?

Aucun commentaire:

Enregistrer un commentaire