Nominal BtoC business case : from specification to relational DB schema

My BtoC business – Functional specification

To build my ideal technical stack, I choose to handle a simple use case of a BtoC business without any special case.

Let’s start with the following step of hypothesis :

  • My application allow a company to publish product
  • My application should have at least 1 administrator (not implement yet in the following schema)
  • User can signon, signin to my application
  • A user can be part of a company as an administrator or as an employee
  • A user can belongs to many employee
  • A user can don’t belongs to any company
  • A company can have several users
  • A company should have at least an administrator (by default the company creator)
  • A company administrator can set users as an administrator or as an employee of its company and he can remove roles related to its company to any other users
  • User can publish product belonging to a company
  • Users can subscribe to any products

It is kind of classic relationship between companies and their clients. I don’t integrate e-commerce behavior in this specification to don’t add complexity and replace it to a simple user subscription to a product.

My BtoC Business – database schema

Here is the database schema build with the tools Draw.io which is very smart furthermore if you are used to use the Google Suite

The models Users and Tokens should evolved when we will implement a OAuth2 Authentication.

And furthermore, during the life of the project, the schema will be enhanced.