GabDesilets / beer-me

0 stars 0 forks source link

Business related entities #8

Closed magignac closed 8 years ago

magignac commented 9 years ago

We need entities to store business related data. Minimally, we nee data for the business itself, business account(s), access requests.

There are multiple options and questions to answer to find the best possible schema for those entities. First, we need to better define an access request. Does it refer to a user, a business or both? If it is related to both, how do we identify that two requests refer to the same business? There could be typos in the name.

If we separate business and accounts, we gain the ability to have multiple accounts for the same business. It also causes the problem of having to link accounts to businesses.

The simplest, but most limited option, is to put everything in one entity. The business requires an access, which creates the "un-activated" business. An administrator activates the business, which sends an email to the address specified so a password can be chosen.

The main drawbacks of this method would be the limitation of one user account per business and some unicity problems with the business name.

The most flexible method would be to threat each part of data as a separate entity. The business sends an access request. An administrator accepts the requests which create the business entity and a first account associated with that business. Then the confirmation email is sent. Later, features could be added so that the generated account could be used to create additional accounts.

This method has some advantages. First, the unicity requirements on some of the fields of the business can be neglected for the access requests. It also permits the creation of multiple accounts for a business. Finally, it gives the opportunity to store additional data on the access request like the request date and its status (accepted, refused).

Some feedback is welcome

magignac commented 9 years ago

One more thing. Can an account be related to two businesses?

GabDesilets commented 8 years ago
Q: Does it refer to a user, a business or both ?

A: Request are bind to the business itself not a user.
But once a request is accepted we should create a cie account, 
because it won't have any user. Remember ? one account by cie. 
No user management.
Q: how do we identify that two requests refer to the same business ?

A: Well if one cie or request already exist with the name 
if the name contain type we should check the
address and phone number we just informe the user.
Q: If we separate business and accounts, 
we gain the ability to have multiple accounts for the same business.
It also causes the problem of having to link accounts to businesses.

A: See last answer.
Q: Can an account be related to two businesses?

A: No.
GabDesilets commented 8 years ago

tis doesn't need more comments