5.4. Build auth module

In this section, we will build the auth module.

Pre-setup

Before going further, we need to set up a few things:

  1. Create the auth folder.
  2. Inside the auth folder, create constants, data_model, functions, helpers, and ports.
  3. Inside the constants folder, create files roles.py, teams.py, and __init__.py.

Now, open roles.py and add the following code:

ROLES = {
    "EMPLOYEE": {"NAME": "employee", "SCORE": 1},
    "ADMIN": {"NAME": "admin", "SCORE": 99},
}

Open teams.py and add the following code:

TEAMS = {"MARKETING": {"NAME": "marketing"}, "SALES": {"NAME": "sales"}}

5.4.1

Add the following code in __init__.py:

from .roles import *
from .teams import *

With this code, the import errors for ROLES and TEAMS in modules/pcustomer-management/ports are resolved.

5.4.2

Now that the pre-setup is complete, we can proceed to build this module step by step, just like we did for the potential customer management module.

Content

  1. Build Data Model
  2. Build Helpers
  3. Build Functions
  4. Build Ports