person_table

This is the user table, where all information on the users are stored.

Model

FieldTypeNullableDefault value

id

int4

name

varchar(250)

password

varchar

roles

varchar

phone_number

varchar

created_at

timestamp

updated_at

timestamp

referrer_data

json

is_worker_referral

bool

False

has_received_default_wa

bool

False

Description of fields

id

This is the primary key

name

Name of the user. It is not a required field. While registering users through WhatsApp Chatbot, we use default name such as "kisaan", "किसान"

password

if a user is using the admin portal, then this is the password for them to login.

roles

This is a text field that can accommodate comma-separated values for roles. User can have one or more roles comma-separated. These roles are used by the Admin portal to allow access to specific models and actions within models.

This roles field need to be put inside separate role & permission handling database tables. Once that is done, the roles field from person table will be deleted.

Currently, there are three roles supported in the admin portal:

  1. superadmin: Those users who can access all features of the Admin portal.

  2. cs_user: employees who uploaded the receipts. All of them except to have left the job and are now continuing as regular users, but they are still marked as cs_user.

  3. user: these are users who can access admin portal for data validation only. Below image shows that these users can access mandi receipts table only, with the option to edit, approve or reject a receipt.

phone_number

It is only unique identifier with user credentials. It is stored with country code of 91.

created_at

The timestamp when is user is first registered.

updated_at

The timestamp at which the data is last updated.

is_worker_referral

Boolean field that captures whether the user was referred by a team member or not. A popup comes after a new user registration where they are asked to put in the worker user's phone number for referral.

This field is outdated as we have removed the functionality and needs to be deleted.

has_received_default_wa

Bolbhav chatbot was sunsetted on 7th Dec 2023. After that day, if a user would write to Bolbhav chatbot number then it would not respond. Hence, we created a onetime default message that would be sent to the user only the first time they write to the Bolbhav chatbot. Basically, all incoming message to the Bolbhav chatbot comes to backend, and it is checked if this field is empty, if yes then the default message is sent to user on WhatsApp and this field is marked as True. If it is already True then no message is sent to the user.

referrer_data

If a user has downloaded the app via a referral link, then this field tells us about the referee. It is an array that carries the data about the referrer_id.

{
    "~channel": "whatsApp", 
    "~referring_link": "https://0vx58.app.link/08xY5W1w1Eb", 
    "+is_first_session": false, 
    "+clicked_branch_link": true, 
    "$canonical_url": "https://app.bolbhav.com", 
    "custom": "data", 
    "~campaign": "Bolbhav referrals", 
    "$canonical_identifier": "208904", 
    "$desktop_url": "https://app.bolbhav.com", 
    "~id": "1257064518614704472", 
    "+click_timestamp": 1700945810, 
    "+match_guaranteed": false, 
    "~feature": "referral", 
    "$og_title": "Bolbhav", 
    "+rn_cached_initial_event": true, 
    "referrer_id": "208904"
}

Last updated