We are trying to design use case where privilege user can create business (privilege use is business owner). Each Business can have multiple users. For addressing this requirement we are thinking to create three services UserAPI, BusinessAPI and SubscriptionAPI. UserAPI responsible for user creation, deletion, updating and find likewise business and subscription api will do similar operation.
- /api/v1/users/
- /api/v1/business /
- /api/v1/subscription/
For the scenario where we want to create new user for business we are thinking of SubscriptionAPI to be used
Steps as follow:
- Is business exist “Business API client” will be used to check.
- Is user already exist for given mobile number “user API client” will be used to check.
- If above to condition passed, “user API client” will be called for user creation.
- Above step will provide user id
- New record in subscription table Subscription_id, business_id, user_id
Request
- POST /api/v1/subscription/business/{id}
- Request Body UserVO
UserVO is repeated in SubscriptionAPI – Is this correct?
Also please share view on described service designing, what improvement can be done.