Tanishq Clone
Practice Problems
Assignment Questions
Assignment Questions
Problem Statement
Relevel found a mine full of gold. Now they want to process and sell the gold they get from there. You
have to build a clone of Tanishq clones where Relevel can add their products, edit them, delete them.
Users can retrieve the product and also an authentication mechanism with JWT must be there. Also,
users can see their profiles.
Your task is to go through the Problem Statement, Requirements and create a Tanishq clone for Relevel.
Follow the standard naming conventions and comment on the code well, so that it is easily
understandable. We are looking for a basic working prototype so make your assumptions accordingly
and pace yourself.
Pre-requisites
The candidate should make sure GIT, NodeJS and MongoDB are already installed on their system
before starting the development.
User Stories
Problem 1 (Estimated Time to complete ~2 Hours)
Story-1 (Define data model)
Create a clear data model for User with roles like admin or customer, Product with image, catalog. name
and price should be added.Create mongoDB schema, for example, should be included in your code
base
Add Appropriate validations and reference keys
Spend some time creating some "seed data" that covers all of the use cases you want to show.
Story-2 (Register the user)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way)
Register new Users.
- Create an API endpoint “/register”
- Add appropriate request body to register new users.
- Validate the request. For example if the request has a valid email ID, the password is strong.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Assignment Questions
Story-3 (Authenticate Functionality)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way):
The task is to create an API endpoint '/authenticate' for the authentication of the user created in the
above register API
The API request should take the input of userId & password
Authenticate the values
Display status & response code in the response
In case of incorrect credentials API response should throw 401 Unauthorized Exception
The successful request should return 200 response codes.
Then create an API endpoint “/logout” to safely logout the user.
Problem 2 (Estimated Time to complete ~1.5 Hours)
Story-3 (See profile the user)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way)
Get details of User.
- Create an API endpoint “/profile”
- Send all the details related to the user.
- Validate the request. For example if the request has a valid email ID, the password is strong.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Story-4 (Update the product)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way)
Update the product
- Create an API endpoint '/editproduct'
- Only Authenticated user with JWT token can edit the product
- Validate the request.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Problem 1 (Estimated Time to complete ~1.5 Hours)
Story-5 (Delete the product)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way):
Assignment Questions
Delete the product.
- Create an API endpoint '/deleteproduct/:productId'
- Only Authenticated user with JWT token can delete the product
- Validate the request.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Story-6 (Manage the product)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way)
Get all the product
- Create an API endpoint '/manageproduct'
- Only Authenticated user with JWT token can get all the product
- Validate the request.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Tanishq Clone
Practice Problems
Assignment Solutions
Assignment Solutions
Solution
https://github.com/Gtgstg/Tanishq
User Stories
Problem 1 (Estimated Time to complete ~2 Hours)
Story-1 (Define data model)
Create a clear data model for User with roles like admin or customer, Product with image, catalog.
name and price should be added.Create mongoDB schema, for example, should be included in your
code base
Add Appropriate validations and reference keys
Spend some time creating some "seed data" that covers all of the use cases you want to show.
Story-2 (Register the user)
Your APIs should provide the following functionality to downstream consumers of the API (in a
RESTful way)
Register new Users.
- Create an API endpoint “/register”
- Add appropriate request body to register new users.
- Validate the request. For example if the request has a valid email ID, the password is strong.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Story-3 (Authenticate Functionality)
Your APIs should provide the following functionality to downstream consumers of the API (in a
RESTful way):
The task is to create an API endpoint '/authenticate' for the authentication of the user created in the
above register API
The API request should take the input of userId & password
Authenticate the values
Display status & response code in the response
In case of incorrect credentials API response should throw 401 Unauthorized Exception
The successful request should return 200 response codes.
Then create an API endpoint “/logout” to safely logout the user.
Story-3 (See profile the user)
Your APIs should provide the following functionality to downstream consumers of the API (in a
RESTful way):
Assignment Solutions
Get details of User.
- Create an API endpoint “/profile”
- Send all the details related to the user.
- Validate the request. For example if the request has a valid email ID, the password is strong.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Story-4 (Update the product)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way)
Update the product.
- Create an API endpoint '/editproduct'
- Only Authenticated user with JWT token can edit the product
- Validate the request.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Problem 1 (Estimated Time to complete ~1.5 Hours)
Story-5 (Delete the product)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way)
Delete the product.
- Create an API endpoint '/deleteproduct/:productId'
- Only Authenticated user with JWT token can delete the product
- Validate the request.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.
Story-6 (Manage the product)
Your APIs should provide the following functionality to downstream consumers of the API (in a RESTful
way)
Get all the product
- Create an API endpoint '/manageproduct'
- Only Authenticated user with JWT token can get all the product
- Validate the request.
- Store information at the backend in proper tables.
- For success, return proper response codes.
- For failure, return proper response codes.
- Use an appropriate HTTP method out of GET, POST, PUT,PATCH,DELETE, etc.