theIYD / help_flare_api

The API for Help Flare

Home Page:https://help-flare.web.app

Repository from Github https://github.comtheIYD/help_flare_apiRepository from Github https://github.comtheIYD/help_flare_api

Help Flare API

Help Flare

About

During the 2020 COVID-19 pandemic lockdown in India, good Samaritans and NGOs stepped up to help under-privileged localities with basic needs like food, water, sanitation, etc.

To help their efforts, I along with @burhanuday and @SBhanushali created an app that used Geo-fencing technology to highlight communities that were in need.

Routes

POST /helper
Query Params: none
FormData:
    - group_name
    - representative
    - phone
    - password
    - locality (object of lat,lng and place)
    - social_service (optional: Should be stringified array)

Registeration of social service groups/NGOs
POST /helper/verify
Query Params: none
FormData:
    - otp

Verify OTP
POST /login
Query Params: none
FormData:
    - phone
    - password

Sign in of social service groups/NGOs
POST /report_help
Query Params: none
FormData:
    - area_coordinates https://ibb.co/SsVvZYt
    - reported_by (name)
    - phone
    - place (short version of area_coordinates)
    - helpType (description of help needed, should be a stringified array)

Note: The `area_coordinates` property contains the lat lng of every point of the polygon. Make sure all the coordinates are of `Double` type

Report a help
Get helps in real time

  1. Initialize socket on the client
let socket = io("https://covid-project-api.herokuapp.com/");
  1. On getting the location of the device from the browser, emit an event to get new helps
socket.emit("new_help", { lat: pos.lat, lng: pos.lng });
  1. After submission of a new help, again emit an event for getting new helps
socket.emit("new_help", { lat: pos.lat, lng: pos.lng });
  1. Listen for new helps to be displayed onto the Google map
socket.on("helps", (data) => {
  console.log(data);
  // => Report objects are received
});

POST /help
Query Params:
    - helpId

Authorization: Bearer <token>
FormData: none

Assign the help to the logged in helper
POST /help/cancel
Query Params:
    - helpId

Authorization: Bearer <token>
FormData: none

Cancel the claim
POST /help/verify
Query Params:
    - helpId

Authorization: Bearer <token>
FormData:
    - photo (clicked by the camera)

Verify delivery of help
GET /profile
Query Params: none
Authorization: Bearer <token>
FormData: none

Profile of the helper

About

The API for Help Flare

https://help-flare.web.app


Languages

Language:JavaScript 100.0%