person_table
This is the user table, where all information on the users are stored.
Model
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
fcm_token
mobile_number
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:
superadmin: Those users who can access all features of the Admin portal.
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.
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.
The constraint for this table is that a unique phone_number cannot repeat. This was put in place to avoid multiple entries of the same phone_number if a user repeatdely clicks on an action button.
mobile_number
This is a user's phone number stored without the country code 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.
fcm_data
Upon login each users is provided an fcm_token (registeration token) that expires after 6 months. More details to be added.
Last updated