The customer-service-app is an application that allows users logs complaints or request for support.
- Key Application features
-
Functional requirements
- Creation of Support requests
- Fetching support requests
- Updating support requests
- Closing support requests logged
- Download CSV file of closed support requests for the last month
-
Comment
- Users can comment on a support request
- Nodejs
- Typescript
- Express
- Mongodb
- Jest
- You can get the details of the libraries used in the package.json file in the root directory of this project
-
Check that NodeJs is installed on your machine, if not installed follow this link to download and install nodejs:
-
Clone the repo and cd into it:
#!/bin/bash git clone https://github.com/dbytecoderc/test-app.git
-
Install dependencies using the command bellow:
#!/bin/bash yarn install
-
Make a copy of the .env.sample file in the app folder and rename it to .env and update the variables accordingly, it important that you copy the email and password details in that file just the way it is, you would need it to test admin functionalities and make sure the db urls are set to make sure the tests run:
#!/bin/bash PORT=3000 MONGODB_URI="mongodb://127.0.0.1/fliqpay" MONGO_URI_TEST="mongodb://127.0.0.1/fliqpay-test" SECRET_KEY="secretKey" ADMIN_PASSWORD="Admin0007" NON_ADMIN_PASSWORD="User0007" HASHED_ADMIN_PASSWORD='$2a$10$4IIoa9h4th7aPsMhWP7/Xu97SdwcUjImhyDHDsSK1wssiaIr0M.hm' HASHED_NON_ADMIN_PASSWORD='$2a$10$WSwcXM1dIaygWLaSQMxAD.cNBDZmykPNJOWOkjwpiFiPr8CrT68ha'
NOTE: It is important that the MONGO_URI_TEST
is set because the integration tests depend on it to run
- Run the application with the command
#!/bin/bash
yarn start:dev
- Data is seeded into the application as soon as you fire up the server, without needing to create a user you can login and create a json web token which is to be attached to the header in this format
#!/bin/bash
Bearer 'sample token'
- Use these details to login an admin user
#!/bin/bash
{
"email": "[email protected]",
"password": "Admin0007"
}
- Use these details to login a non-admin user
#!/bin/bash
{
"email": "[email protected]",
"password": "User0007"
}
Make sure the environment variable for the test database MONGO_URI_TEST
is set for this to work
#!/bin/bash
yarn test
NOTE: All the seed data are baked into the testing process, you won't need to run any script to seed data for tests, and as soon as the application relevant data is seeded into the application to ease manual testing
-
Use the link below in the thumbnail to download a postman collection for the endpoints
-
Alternatively you can use this link to view the api documentation in your browser.
-
After visiting the link you can click on the dropdowns of each request to view preset examples of request edge-cases covered.