0% found this document useful (0 votes)
12 views6 pages

Customer Management System

Uploaded by

tmp519988
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Customer Management System

Uploaded by

tmp519988
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Customer Management System

Problem Statement:
The XYZ corporation is building up their electronics and clothing outlets in different
parts of the country. In order to manage the customers, offer them discounts, and
provide customers with their best services, they are building a customer
management system. The customer details will be added to the system along with
their references if any. The reference here means someone who is already present in
the system. The benefit of reference is that the points of purchase will be added to
the reference customer which can be redeemed at any time in future.

To manage these details, a customer management system is to be developed. You


have to create the RESTful API as mentioned below for a smooth and hassle-free
management system.

1. Welcome: A welcome home page to check default structure.


2. Add: To save or add customer details to the management system.
3. Get All: To get the list of all the customers in the management system.
4. Delete: This is carried out in two ways:
o Delete with Reference:
Delete the customer by id and their references if opt for deletion
otherwise make all the references to null, which were part of this Id.
o Delete without Reference:
Delete the customer by id and make all the references to null which
were part of this Id.
5. Check Existing: To check if a customer exists or not based on the user’s email
id.

All the mentioned RESTful APIs will be created based on the customer personal
details:

1. Name of the customer


2. Email id of the customer
3. Contact number of the customer
4. Date of Birth of the customer
5. Gender of the customer
6. Active Status - 1 for active and 0 for inactive customer
7. Created/Entry date of the customer
8. Update date of the customer
9. Reference id

API Base URL- /api/customer


Details of the APIs:

 Welcome Home page

URL- http://localhost:9090
Request-get
Response-Welcome to Customer Management System for CRUD operations
status=200

 Add - To save or add customer details to the management system.

Save candidate details


path- /save-customer-details
produces-application/json
request-json Data
consume-application/json
method-Post
response-
StatusCode-201 with update Object Model

Case 1: Add customer’s personal details without referenceId.


RequestBody-
{
"name": "speedhire",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10T00:00:00.000+00:00",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00"
}
Response-
{
"name": "speedhire",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10T00:00:00.000+00:00",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId": null,
"id": 4
}

Case 2: Add customer’s personal details with referenceId


RequestBody-
{
"name": "speedhire",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10T00:00:00.000+00:00",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId":1
}
Response-
{
"name": "speedhire",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10T00:00:00.000+00:00",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId": 1,
"id": 5
}

 All: To get the list of all the customers in the management system.

Get all the saved customers’ list


path-/get-all-customers
Request-No Param required
produces-application/json
method-get
Response-
[
{
"name": "pradeep",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId": null,
"id": 1
},
{
"name": "pradeep",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId": 1,
"id": 2
},
{
"name": "speedhire",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId": 1,
"id": 3
},
{
"name": "speedhire",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId": null,
"id": 4
},
{
"name": "speedhire",
"email": "[email protected]",
"mobile": 9910160356,
"dateOfBirth": "1985-07-10",
"gender": "M",
"activeStatus": "1",
"createDate": "2022-08-27T00:00:00.000+00:00",
"updateDate": "2022-08-27T00:00:00.000+00:00",
"referenceId": 1,
"id": 5
}
]
StatusCode-200 all customer list saved using post api

 Delete: Delete the customer by id and their references if opted for


deletion otherwise make all the references to null which was part of
this Id.

Delete candidate by the id generated and pass deleteRef to remove all


references
path-delete-recordsby-id?id=<id>&deleteRef=<deleteRef>
produces-application/json
request -send id to be deleted & deleteRef flag either true or false
method-put

Case 1: If Reference flag is false, then only passed id will be deleted and their
references will be null.
Case 2: If Reference flag is true, then the passed id will be deleted along with their
references.

 Check Existing: To check if a customer exists or not based on the


user’s email id.

Check whether User exist with given email id or not


path-/check-customer-exist?email =<email>
request -send email to check whether this email exist as a customer in our system or
not.
Note
1. H2 database is already configured into application.properties
2. You have been provided the template Spring Boot application with all files. You
may change existing files or add new files in the template Spring Boot app.
3. Write JPA entity, Repository interfaces, Exception classes, Service & Controller.

You might also like