A reference repo for the tasks given for the sprint practice. Refer below for class definitions and tasks to be implemented as a Spring-Data-JPA Project.
Note: DO NOT commit to this repo. All stray commits will be rolled back.
class Customer{
id: Long
name: String
account: Account
boughtItems: Set<Items>
}
class Account{
accountID: Long
balance: Double
created: LocalDateTime
}
class Item {
id: String (generate your own)
price: Double
description: String
boughtBy: Customer
addedDate: LocalDateTime
}
interface ICustomerDAO {
Customer add(Customer customer);
Customer findByID(Long customerID);
Customer update(Customer customer);
}
interface IItemDAO {
Item add(Item item);
Item update(Item item);
Item findByID(String itemID);
}
interface ICustomerService {
Customer findByID(Long customerID);
Customer createCustomer(name); //create customer and their account also here
Set<Item> itemsBoughtByCustomer(Long customerID);
Customer addAmount(Long customerId, double amount);
}
interface IItemService {
Item create(Double price, String description);
Item findByID(String itemID);
Item buyItem(String itemID, Long customerID);
}
-
Sprint 1: Setup boot, JPA container managed transaction project.
-
Sprint 2: Create Customer module without items module (skip relation part) using layered architecture. In console UI, print customer add(), find() operation outputs.
-
Sprint 3: Create Items module (skip relation field with Customer part) using layered architecture. In console UI, print items add(), find() operation outputs.
-
Sprint 4: Add relationship between Customer and Item. Improve the part where Item is to be saved with Customer now. Check if relationship is working by printing details of item and it's customer, and customer with all the items he has bought.
-
Sprint 5: Open REST endpoints for customers.
-
Sprint 6: Open REST endpoints for items.
Open REST endpoints for the following operations:
- Get customer details by ID (customer ID, name, account ID, balance).
- Get item details by ID (item ID, price, description, customer ID, customer name).
- Endpoint for customer to buy item.
- Find all items bought by customer.
- Add balance amount to the customer's account; the REST endpoint should accept customer ID and balance in PUT request.
Commit your code to your own repositories.