Skip to content

readyassist-in/APIs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

APIs Documentation

If you want to get clear Idea of this API docuemntation please refer to this link for the wireframe

Status Code

S.No Reason Status Code
1. All Okay 200
2. Created 201
3. No Content 204
4. Not Modified 304
5. Bad Request 400
6. Unauthorized Access 401
7. Forbidden 403
8. Content Not Found 404
9. Internal Server Error 500

Prerequisite

So what are the basic requirements before using these API's are given below:

  1. You have the Environment in your laptope of any Scripting Language like Node JS (mostly preffered), Python(can go with flask and Django), .Net and many more.
  2. You have to install any database here whether it is an SQL(MongoDB), No SQL(mySql, Orcale Server) or GraphQL.
  3. Database can also be hosted on the Online Platforms also like GCP, AWS, Microsoft Azure, M-Lab, MongoDB Atlas.
  4. Now to test the API's there is a need of the API development environment, and flexibly integrates with the software development cycle like Postman.
  1. For Node Js Click me
  2. For MongoDB Click me
  3. For Python Flask
  4. For GCP Click me
  5. For Heroku Cick Me
  6. For Postman Click me(For API Environmnet)

Routes For API

So for now we are in designing phase So we consider our base URL for the API's as

https://localhost:3000/

and It will be cover with the Role based Access control with the help of express js and we also shown below in the Authentication

Authentication

I used express-session to manage sessions to authenticate. We have isUserLoggedIn, isUserLoggedOut middleware function which checks if the user is authenticated or not. The session token is stored in the database using connect-mongo package and is deleted when the user logout

async function isUserLoggedIn (req, res, next) {
try {
  if (!(req.session && req.session.user)) {
    return res.status(401).send({
      error: "Unauthorized Access!"
    });
  }else {
    const user = await User.findOne({ _id : req.session.user._id })
    if(user) {
      next();
    } else {
      req.session.user = null;
      return res.status(401).send({
        error: "Unauthorized Access!"
      });
    }
  }
} catch(e) {
  res.status(400).send({
    error: e
  })
}
}


// Function to check whether the user is logged out
function isUserLoggedOut (req, res, next) {
if (req.session && req.session.user) {
  return res.status(200).send({
    message: "User already Logged In!"
  });
}
next();
}

module.exports = {
isUserLoggedIn,
isUserLoggedOut
}

Technician Routes

S.No. Route Method Parameters Description
1. /mech/login POST
  • ID
  • Password
  • 3 Images
For Login into the System
2. /customer/:id GET
  • Name
  • Location
  • Contact Number (Scrap Number)
Getting all the details of customers
3. /mech/:id GET
  • ID
  • Password
  • Account Details
  • Photo_of_the Mechanic
All the details So can see his dashboard
4. /customer/:id PUT
  • Customer ID
  • Password
  • Work_Completed
  • Purchasing
  • Purchasing_Part_Name(array)*
  • Purchasinf_Cost(array)*
For updating the customers Schema's after finishing the Work.
*this is not mandatory parameters to pass into the API's

Finance Routes

S.No. Route Method Parameters Description
1. /client/register POST
  • Client ID
  • Password
  • Work With them
  • Messages(array)*
  • Dates_of_meeting(array)*
  • Notes(Object)*
Creating a new Client.
2. /client/:id PUT/GET
  • Client ID
  • Password
  • Work With them
  • Messages(array)*
  • Dates_of_meeting(array)*
  • Notes(Object)*
Fixing the meeting and chat also.Apart from this Finance can also Set notes to a particular Client.
3. /mech/:id PUT/GET
  • ID
  • Password
  • Account Details
  • Photo_of_the Mechanic
So that finance team can update the Accounts of the Technician.
4. /dataAnyaltics GET
  • Data[in Array or json]
This will directly come from the database so that any FrontEnd Framework like React Js and Angular JS can be used to make the Graphs
5. /client/:id PATCH
  • Different Link which is shown in the wireframe
For getting more details and set additional features to the Client.

HR Routes

S.No. Route Method Parameters Description
1. /mech/:id GET
  • Name
  • technician Status
To check the Attendance of techanician
2. /emp/:id GET
  • Name
  • Employee Status
To check the Attendance of Employees and also the othr features from this only(ex:birthday).
3. /hr/message/:id POST
  • Message content
  • To whom check through Id in the database
Messaging feature between different departments.
4. /hr/:id GET
  • query
  • date-time
  • status(solved or not)
getting diffeent query and solved them.

*this is not mandatory parameters to pass into the API's

Fleet Routes

S.No. Route Method Parameters Description
1. /mech/:id GET
  • ID
  • Password
  • Account Details
  • Photo_of_the Mechanic
  • Status of the Mechanic
Getting the status of the Technician.
2. /fleet/:hotspot GET
  • Hostspot
  • No_of_technician_active
  • customer_active
  • message(array)*
Getting all the maps details from the API.
3. /fleet/message/:id POST/PUT
  • Message content
  • To whom check through Id in the database
Messaging feature between different departments and getting hostory also.

Deployment

This api can be hosted on platform like heroku, aws, and others. MongoDB Atlas or Matlab can be used for remote database. For instance, the application can be deployed on Heroku by creating and registering an account. Following, create a new app and choose a deployment method (terminal or github) and follow the instruction there. Remote database can be created using Mongodb Atlas or Matlab. For Mongodb Atlas, you need to just to create your account and make a new cluster and link the cluster to your application through a URL. Following the given steps, you would have a remote application up and running.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published