For Worker, Supervisor and Authority login
POST /api/auth/login
Field | Type | Description |
---|---|---|
string | Email of Worker, Supervisor or Authority | |
password | string | Password |
{
"status": "200 | 400",
"message": "Login successful | Login failed",
"auth_token": "token"
}
For Worker, Supervisor and Authority registration
POST /api/auth/register
Field | Type | Description |
---|---|---|
string | Email of Worker, Supervisor or Authority | |
password | string | Password |
name | string | Name of employee |
position | string | Position (Worker, Supervisor or Authority) |
{
"status": "200 | 400",
"message": "Registration successful | Registration failed",
"auth_token": "token"
}
For Worker, Supervisor and Authority registration
POST /api/auth/logout
Field | Type | Description |
---|---|---|
auth_token | string | Worker token |
{
"status": "200 | 400",
"message": "Logout successful | Logout failed"
}
For Worker, Supervisor and Authority registration
POST /api/auth/login/google
Field | Type | Description |
---|---|---|
string | Email of Worker, Supervisor or Authority |
{
"status": "200 | 400",
"message": "Login successful | Login failed",
"auth_token": "token"
}
For Worker, Supervisor and Authority registration
POST /api/auth/register/google
Field | Type | Description |
---|---|---|
string | Email of Worker, Supervisor or Authority | |
name | string | Name of employee |
position | string | Position (Worker, Supervisor or Authority) |
{
"status": "200 | 400",
"message": "Registration successful | Registration failed",
"auth_token": "token"
}
For Worker, Supervisor and Authority registration
POST /api/auth/addemployee
Field | Type | Description |
---|---|---|
supervisor | array of strings | Emails of Supervisor |
worker | array of strings | Emails of Workers |
authority | array of strings | Emails of Authoritys |
position | "authority" OR "supervisor" OR "worker" | Position of Employee |
{
"worker": ["[email protected]", "[email protected]", "[email protected]"],
"supervisor": ["[email protected]", "[email protected]"],
"authority": ["[email protected]"],
"position": "worker"
}
{
"status": "200 | 500",
"message": "Employee emails added successfully! | Error"
}
For Worker, Supervisor and Authority registration
POST /api/auth/forgot-password
Field | Type | Description |
---|---|---|
Emails of Worker, Supervisor or authority |
{
"email": "[email protected]"
}
{
"message": "OTP sent successfully"
}
POST /api/auth/validate-otp
Field | Type | Description |
---|---|---|
string | ||
otp | string | OTP |
{
"email": "[email protected]",
"otp": "131432"
}
{
"message": "OTP validated successfully" | "OTP expired"
}
POST /api/auth/reset-password
Field | Type | Description |
---|---|---|
string | ||
password | string | New Password |
{
"email": "[email protected]",
"password": "new password"
}
{
"message": "Password reset successfully"
}
When a worker logs in, he will be redirected to the Dashboard
. The Dashboard
will show all the sections. The worker can click on a section to see the forms of that section.
GET /api/sections
{
"message": "Sections fetched successfully | Sections fetching failed",
"sections": [
{
"_id": "section_id",
"name": "section_name"
}
]
}
When worker clicks on a section in the Dashboard
, he will be redirected to Forms by Section
page. This page will show all the forms of that section. The worker can create a new form by clicking on form name in the All Forms
section in the Forms by Section
page.
GET /api/sections/:section_id/forms
{
"message": "Forms fetched successfully | Forms fetching failed",
"forms": [
{
"id": "form_id",
"title": "form_name",
"descriptionHindi": "descriptionHindi",
"descriptionEnglish": "descriptionEnglish"
}
]
}