ravithemore / FLEX-MONEY-TASK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yoga-academy

This project is a part of the assignment given by FlexMoney for internship. The overall application is build using Reactjs & Spring Boot.

Database Design

Only one table is used in this entire able. It contains all the fields related to the member's details. The autogenerated field id is the primary key here. The sample table is as shown below :

id city contactno current_batch date_of_change dob doj email gender first_name last_name next_batch paid_for_month
1 Pune 9309566652 5-6PM 2022-12-11 2003-11-14 2022-12-10 digambar@gmail.com Male Digambar Tupurwadi 7-8AM DECEMBER
2 Pune 9309566653 8-9AM null 1988-11-5 2022-13-10 virat@gmail.com Male Virat Kohli null null

Most of the fields that are used here are easy to understand. But there are few fields who are new & they are:

  1. current_batch : Specifies the batch timings followed by the member in the current month
  2. next_batch : Gives the batch timings which the member wants to follow from next month onwards because he/she can't change the batch timings & follow it in the same month.
  3. date_of_change : It gives the date on which the member changed the batch timings for the next month. It is required in order to update the batch timings as well as to not let the member follow different timings in the same month itself.
  4. paid_for_month : Specifies the recent month for which the member has paid the fees.

APIs

The endpoint prefix common for all the current APIs is http://localhost:8080/api/v1. The APIs used in the app are as follows:

1. Register new member - /register

This API takes all the details & validates it . Also it checks if any user is already registered with the same contactno or email. If yes then it will throw MemberAlreadyRegisteredException and if provided details are insufficient then it will throw InsufficientDetailsException. It also checks whether the age of the candidate is between 18-65,if not then it will throw AgeBeyondRangeException. If all these checks are passed then it make a new entry in the database. The api returns the newly created member object.

2. Pay the fees - /makepayment/{id}

This API simply takes the member id from the path variable & changes the paid_for_month field to current month. In case if the payment for the current month is already done, then it will throw PaymentDoneAlreadyException.

3. Change the Batch timings - /shiftbatch

As specified in the requirements, the member can follow only one batch timing in the same month. And in case if he/she wants to change it, then they can change it anytime but follow it from next month onwards. Thus this API changes the batch timings as per requested for that particular member and updates the date_of_change field which helps to avoid the member from having different timings in the same month.

4. Get all members - /getallmembers

This API returns all the registered members for the yoga-academy.

5. Get member with ID - /getmember/{id}

This API returns the member registered with the given ID. If no registered member is found with the given ID, then it will throw MemberNotFoundException.

About


Languages

Language:JavaScript 46.7%Language:Java 46.5%Language:HTML 4.4%Language:CSS 2.4%