- /Project
- /db
- conn.js
- /middlewares
- producer_middlewares
- recycler_middlewares
- /routes
- app_routes
- producer_routes
- recycler_routes
- /static
- /css
- dashboard.css
- index.css
- login.css
- /images
- create_order_icon.png
- /js
- producer_dashboard.js
- recycler_dashboard.js
- login.js
- register.js
- /css
- /templates
- /partials
- header.hbs
- footer.hbs
- /views
- contact.hbs
- index.hbs
- login.hbs
- producer_dashboard.hbs
- recycler_dashboard.hbs
- register.hbs
- /partials
- index.js
- package-lock.json
- package.json
- README.md
- /db
-
App Routes
-
Producer Routes
-
Recycler Routes
-
- This route uses a GET request to display the static 'Home Page'
-
- The '/login' route uses a GET request to display the static 'Login Page'
-
- The '/register' route uses a GET request to display the static 'Registration Page'
-
- The '/contact' get route uses a GET request to display the static 'Contact Us Page'
-
- The '/contact' post route uses a POST request to send an email to the company.
-
- The '/producer/register' route handles the POST request from the 'Register Page'
- It has a middleware isAuth which checks if the user is already logged in.
- If the user is already logged in it redirects the Producer to their dashboard.
- Else it proceeds further.
- It then updates the databases using the register middleware.
- Upon successful registration, it redirects the Producer to the dashboard.
- Else it refreshes the 'Registration Page'.
-
- The '/producer/login' route handles the POST request from the 'Login Page'
- It has a middleware isAuth which checks if the user is already logged in.
- If the user is already logged in it redirects the Producer to their dashboard.
- Else it proceeds further
- Then it checks the entry in the database using the login middleware.
- Upon successful login, it redirects the user to the dashboard of the Producer.
- Else it refreshes the 'Login Page'.
-
- The '/producer/dashboard' route displays the dashboard of the Producer.
- It has a middleware isAuth which checks if the user is logged in or not.
- If the user is already logged it proceeds further.
- Else it redirects the Producer to the 'Login Page'.
- It displays all the accepted and pending requests.
-
- This request is posted after the Producer clicks on 'Create Order' button present on the dashboard.
- Displays an interface to create an order.
- It has a createOrder middleware which updates the databases.
- Then it refreshes the dashboard page also displaying the order and order status.
-
/producer/order/execute/:id [POST]
- This request is posted after the Producer clicks on 'Execute Order' button present on the dashboard.
- The order with order id = id is executed from both the ends.
- It has a executeOrder middleware which updates the databases.
- Then it refreshes the dashboard page.
-
- Delete the session.
- Clear the cookies.
- Redirect to the 'Login Page'.
-
- The '/recycler/register' route handles the POST request from the 'Register Page'
- It has a middleware isAuth which checks if the user is already logged in.
- If the user is already logged in it redirects the Recycler to their dashboard.
- Else it proceeds further.
- It then updates the databases using the register middleware.
- Upon successful registration, it redirects the Recycler to the dashboard.
- Else it refreshes the 'Registration Page'.
-
- The '/recycler/login' route handles the POST request from the 'Login Page'
- It has a middleware isAuth which checks if the user is already logged in.
- If the user is already logged in it redirects the Recycler to their dashboard.
- Else it proceeds further
- Then it checks the entry in the database using the login middleware.
- Upon successful login, it redirects the user to the dashboard of the Recycler.
- Else it refreshes the 'Login Page'.
-
- The '/recycler/dashboard' route displays the dashboard of the Recycler.
- It has a middleware isAuth which checks if the user is logged in or not.
- If the user is already logged it proceeds further.
- Else it redirects the Recycler to the 'Login Page'.
- It displays all the accepted and pending requests.
-
- This request facilitates the Recycler to accept the order corresponding to order_id=id.
- It has a middlware acceptOrder which updates the databases.
- Then it refreshes the dashboard page.
-
- This request facilitates the Recycler to initialize the execution of order corresponding to order_id=id.
- It has a middlware executeOrder which updates the databases.
- Then it refreshes the dashboard page.
-
- This request facilitates the Recycler to reject the order corresponding to order_id=id.
- It has a middlware rejectOrder which updates the databases.
- Then it refreshes the dashboard page.
-
- Delete the session.
- Clear the cookies.
- Redirect to the 'Login Page'.
-
Producer Middlewares
-
- It takes all the information from the input fields of the 'Registration Page'.
- Inserts all the information about Producer into the db1.Producers table.
- Then it inserts the information about the location into the db1.addresses table
- Upon successful insertions it stores the following session variables :-
- req.session.username = Producer's Name
- req.session.id = Company ID
- req.session.north = North Coordinates
- req.session.east = East Coordinates
- req.session.entity = "producer"
- req.session.isAuth = true
- And proceeds further
-
- It takes all the information from the input fields of the 'Login Page'.
- Checks all the information about Producer into the db1.Producers table.
- Upon successful checking the databases it stores the following session variables :-
- req.session.username = Producer's Name
- req.session.id = Company ID
- req.session.north = North Coordinates
- req.session.east = East Coordinates
- req.session.entity = "producer"
- req.session.isAuth = true
- And proceeds further
-
- It checks the req.session.isAuth variable to check the user is already logged in.
-
- IMP First it checks if there are any available recyclers who recycle that particular waste.
- Then it checks which recycler is the nearest (within some radius).
- If no recyclers are present which satisfy the above conditions then it doesn't create any order.
- Else it creates an order with order_status = number of available recyclers whoc satisfy the conditions.
- Updates the order status (created/not) in the Producer's dashboard.
-
- This option is visible at the pending verification section.
- The recycler has to initiate the execution process by clicking on the execute button.
- The status of order with order_id = id is set as executed by the producer.
- The order is then set as completely executed.
-
-
Recycler Middlewares
-
- It takes all the information from the input fields of the 'Registration Page'.
- Inserts all the information about Recycler into the db1.Recyclers table.
- Then it inserts the information about the location into the db1.addresses table
- Upon successful insertions it stores the following session variables :-
- req.session.username = Recycler's Name
- req.session.id = Company ID
- req.session.waste_type = Waste Type
- req.session.entity = "recycler"
- req.session.isAuth = true
- And proceeds further
-
- It takes all the information from the input fields of the 'Login Page'.
- Checks all the information about Producer into the db1.Producers table.
- Upon successful checking the databases it stores the following session variables :-
- req.session.username = Recycler's Name
- req.session.id = Company ID
- req.session.waste_type = Waste Type
- req.session.entity = "recycler"
- req.session.isAuth = true
- And proceeds further
-
- It checks the req.session.isAuth variable to check the user is already logged in.
-
- It takes all the order_id from the url itself using req.params.
- It updates the order_status in the orders table as 111.
- It also updates the recycler_id of the same entry.
-
- The recycler has to initiate the execution process by clicking on the execute button.
- The status of order with order_id = id is set as executed by the recycler.
- This makes the order display in the pending verfication section of the producer.
- The order is then set as executed by the recycler.
-
- The recycler can reject an order by clicking on Reject button.
- The status of order with order_id = id is set as rejected by the corresponding recycler.
- This order is never show to that recycler again.
-
-
MySQL
-
Producers Table
- Schema
Field Type Null Key Default Extra company_id int NO PRI NULL auto_increment producer_name char(30) YES NULL producer_email varchar(30) YES NULL producer_contact_number varchar(13) YES NULL waste_type int YES NULL password char(60) YES NULL -
Recyclers Table
- Schema
Field Type Null Key Default Extra company_id int NO PRI NULL auto_increment recycler_name char(30) YES NULL recycler_email varchar(30) YES NULL recycler_contact_number varchar(13) YES NULL waste_type int YES NULL password char(60) YES NULL -
Orders Table
- Schema
Field Type Null Key Default Extra order_id int NO PRI NULL auto_increment recycler_id int YES MUL NULL producer_id int YES MUL NULL waste_type int YES NULL waste_quantity varchar(20) YES NULL pickup_date datetime YES NULL order_status int YES NULL north_coordinate float YES NULL east_coordinate float YES NULL -
Addresses Table
- Schema
Field Type Null Key Default Extra company_id int NO PRI NULL building_number varchar(20) YES NULL building_name varchar(20) YES NULL street_landmark varchar(20) YES NULL city varchar(20) YES NULL district varchar(20) YES NULL pincode int YES NULL north_coordinate float YES NULL east_coordinate float YES NULL
-
-
MongoDB
-
Rejected Orders Collection
- Model
Field Type _id ObjectId order_id int building_name int array
-