Skip to content

DJ48/CRM_APP

Repository files navigation

CRM_APP

Description

CRM application that can be leveraged to accept the customer complaints and provide the complete life cycle management of the issues raised by the customers.

Features:-

  1. Customer
    -> Should be able to register
    -> Should be able to login himself for registering/viewing complains
    -> Should be able to raise an issue
    -> Should be able to check the latest status of the issues raised by him
    -> Should be able to modify the issue raised
    -> Should be able to check the complete history of the issues raised
    -> Should be able to close my ticket myself
  2. Engineer
    -> Should be able to accept an issue
    -> Should be able to update an issue
    -> Should be able to close an issue
    -> Should be able to see the complete list of issues assigned to him
    -> Should be able to search for an issue
    -> Should be able to filter the issues assigned to him based on the creation date
  3. Admin
    -> Should be able to see all the customer's non-PII details
    -> Should be able to see all the Engineers
    -> Should be able to see all the tickets details
    -> Should be able to see all the active tickets
    -> Should be able to filter the tickets based on status | date, etc
    -> Should be able to re-assign a ticket to another Engineer
    -> Should be able to add a new Engineer
    -> Should be able to remove a new Engineer

Tech Stacks

1. Language and the server: Javascript & Node.js
2. Framework: Express
3. Database and ODM: MongoDb & Mongoose

Getting Started

Installation & Setup

  1. Install Node.js and MongoDB
  2. Clone this repository and install the dependencies.
      git clone https://github.com/DJ48/CRM_APP.git
      cd CRM_APP
      npm install
    
  3. Now, within the CRM_APP directory. Start the server.
      node server.js
    

Executing program

  1. Download Insomnia or Postman for web api testing.
  2. I am gonna explain each api and their input json.
    • SignUp Api :-
      i) Customer :- The user will pass name, userId, email, password for customer registration.

        URL: http://127.0.0.1:8081/crm/api/v1/auth/signup
        Method: POST
      
        Input JSON:-
        {
        	"name" : "Deepak",
        	"userId" : "DJ",
        	"email" : "dj@gmail.com",
        	"password" : "Welcome1"
        }
      

      ii) Engineer :- The user will have to pass an extra field (i.e. userType) for engineer registration.

        URL: http://127.0.0.1:8081/crm/api/v1/auth/signup
        Method: POST
      
        Input JSON:-
        {
        	"name" : "Rahul",
        	"userId" : "RJ",
        	"email" : "rj@gmail.com",
        	"password" : "Welcome12",
        	"userType" : "ENGINEER"
        }
      
    • SignIn Api :- The user will pass userId and password for logging in. It will return an access token that you have to use in authorization for other Api. Engineers can only login when they got approved by Admin user.

      URL: http://127.0.0.1:8081/crm/api/v1/auth/signin
      Method :- POST
      
      Input JSON:-
      {
          	"userId":"DJ",
      	"password":"Welcome1"
      }
      
      Output JSON:-
      {
      	"name": "Deepak",
      	"userId": "DJ",
      	"email": "dj@gmail.com",
      	"userType": "CUSTOMER",
      	"userStatus": "APPROVED",
      	"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkRKIiwiaWF0IjoxNjUzOTc3NzkyLCJleHAiOjE2NTM5NzgzOTJ9.dOpvxLN9vp189F_uvRTM4jsICABMSurKJsO8oEKwkO0"
      }
      

      Note:- Save the access token that you got as an output after login. It will be used in calling other APIs.

    • Create Ticket Api :- The user will pass email and secret code as input and this api will display the user password.

      URL: http://127.0.0.1:8081/crm/api/v1/tickets
      Method: POST
      
      Input JSON:-
      {
      	"title" : "My first Ticket",
      	"description" : "My balance is not updated.",
      	"ticketPriority" : 1
      }
      
      Output JSON:-
      {
          	{
      		"title": "My first Ticket",
      		"description": "My balance is not updated.",
      		"ticketPriority": 1,
      		"status": "OPEN",
      		"reporter": "DJ",
      		"assignee": "RJ",
      		"id": "6295c018f0cd0c3f89dac720",
      		"createdAt": "2022-05-31T07:13:28.297Z",
      		"updatedAt": "2022-05-31T07:13:28.298Z"
      	}
      }
      
    • Fetch All Tickets Api :- The user will pass access token as header and this api will display all the tickets raised by the authenticated user. User can also filter the tickets based on the status.

      URL:- http://127.0.0.1:8081/crm/api/v1/tickets  or (with filter) http://127.0.0.1:8081/crm/api/v1/tickets?status=OPEN
      Method: GET
      
      Input Header:
          type:- x-access-token
          value:- eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkRKIiwiaWF0IjoxNjUzOTg3MTg2LCJleHAiOjE2NTM5ODc3ODZ9.F-HHbseNsvvmu0fpX_DqiBQ6h7wrSvAOfT_1cxyVrtw
          Note:- This value was generated during login.
      
      Output JSON:-
      {
          	{
      		"title": "My first Ticket",
      		"description": "My balance is not updated.",
      		"ticketPriority": 1,
      		"status": "OPEN",
      		"reporter": "DJ",
      		"assignee": "RJ",
      		"id": "6295c018f0cd0c3f89dac720",
      		"createdAt": "2022-05-31T07:13:28.297Z",
      		"updatedAt": "2022-05-31T07:13:28.298Z"
      	}
      }
      
    • Update Ticket Api :- The user will pass ticket_id as request parameter and the body with the fields that they want to update.

      URL: http://127.0.0.1:8081/crm/api/v1/tickets/6295c018f0cd0c3f89dac720
      Method: PUT
      
      Input JSON:
      {
      	"title" : "Trying to update the ticket",
      	"description" : "My balance is not updated.",
      	"ticketPriority" : 2,
      	"status" : "CLOSED"
      }
      
      Output JSON:-
      {
      	"title": "Trying to update the ticket",
      	"description": "My balance is not updated.",
      	"ticketPriority": 2,
      	"status": "CLOSED",
      	"reporter": "DJ",
      	"assignee": "RJ",
      	"id": "6295c018f0cd0c3f89dac720",
      	"createdAt": "2022-05-31T07:13:28.297Z",
      	"updatedAt": "2022-05-31T07:13:28.298Z"
      }
      
    • Fetch All Users Api :- Only ADMIN is allowed to call this api. Admin can filter the result based on name, userType, userStatus and combination of these.

      URL: http://127.0.0.1:8081/crm/api/v1/users
      Method: GET
      
      Input Header:
          type:- x-access-token
          value:- eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjQ0NzcyMDAwLCJleHAiOjE2NDU2MzYwMDB9.h89IJaB-Mpk_ozJtkHHc98sLLKjcaatxwRaqiXKOVbk
          Note:- This value was generated during login.
      
      Output JSON:-
      [
      	{
      		"name": "Deepak",
      		"userId": "DJ",
      		"email": "dj@gmail.com",
      		"userType": "CUSTOMER",
      		"userStatus": "APPROVED"
      	},
      	{
      		"name": "Vish",
      		"userId": "admin",
      		"email": "kankvish7777@gmail.com",
      		"userType": "ADMIN",
      		"userStatus": "APPROVED"
      	},
      	{
      		"name": "Rahul",
      		"userId": "RJ",
      		"email": "rj@gmail.com",
      		"userType": "ENGINEER",
      		"userStatus": "APPROVED"
      	}
      ]
      
    • Fetch User by ID Api :- The user will pass the userId as request parameter and find the details of the user.

      URL: http://127.0.0.1:8081/crm/api/v1/users/DJ
      Method: GET
      
      Input Header:
          type:- x-access-token
          value:- eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjQ0NzcyMDAwLCJleHAiOjE2NDU2MzYwMDB9.h89IJaB-Mpk_ozJtkHHc98sLLKjcaatxwRaqiXKOVbk
          Note:- This value was generated during login.
      
      Output JSON:-
      [
      	{
      		"name": "Deepak",
      		"userId": "DJ",
      		"email": "dj@gmail.com",
      		"userType": "CUSTOMER",
      		"userStatus": "APPROVED"
      	}
      ]
      
    • Update User Api :- Only ADMIN is allowed to call this api. Admin can approve/remove an engineer.

      URL: http://127.0.0.1:8081/crm/api/v1/users/RJ
      Method: PUT
      
      Input Header:
          type:- x-access-token
          value:- eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjQ0NzcyMDAwLCJleHAiOjE2NDU2MzYwMDB9.h89IJaB-Mpk_ozJtkHHc98sLLKjcaatxwRaqiXKOVbk
          Note:- This value was generated during login.
      
      Output JSON:-
      {
      	"message": "User record succesfully updated"
      }
      

Author

Deepak Jaiswal

Read & Rate my Article on Linked List

Version History

  • v1
    • Initial Release

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published