Design a backend system for a new enterprise application that Flipkart is launching, FlipFit.
Flipkart is partnering up with gyms across Bangalore to enter into the fitness space. For the Beta launch the requirements are as follows:
There are multiple centers in Bangalore. We can expand to multiple cities across and beyond India.
Each center has n slots of an hour each. For eg the Bellandur center has only 6 slots - 3 in the morning of an hour each from 6 am to 9 am and similarly 3 in the evening from 6 pm to 9 pm. All the centers might/might not be open 7 days a week.
Each slot at a center can have m possible workout variations - Weights, Cardio, Yoga, Swimming etc. There could be newer workouts added at center/slot level in the future.
The number of seats in each workout at each time-slot for a given center is fixed.
If a person does not get the desired slot for a given workout type, suggest upto 3 slots for the same workout type, in same or nearby centers based on a rankingType (time/distance)
A Person can book a maximum of 3 slots in a day for any center.
Once the seats get filled up, add people to a waiting list of fixed size. Also prompt a message waitlisted candidates that he/she has been promoted
It should be easy to change the underlying data storage mechanism as data scale increases without changing various parts of the application
User can perform the following operations:
Register onto the platform
View the workouts availability/unavailability for a particular day at a center
Book a workout for a user if seats are available in that time slot at that center
View his/her plan basis day as input
Cancel his/her workout
Test cases:
Following functionality will be tested via tests during evaluation :
Addition of center with appropriate details like city,location,lat,long
Addition of new workout Types in a particular center
Addition/Deletion of slots given a center,workoutType, startTime, number of seats & waiting list queue size
Details of workouts available at the center
registering user
get all available slots across all workoutTypes for a center on a day
Book a slot for a user given a slot, workout & day
viewUserBooking(userId,date)
cancel slot for a user given a slot & centerNamecancelSlot,Notify appropriate users (one who is canceling, one present waiting list movement)
recommendSlot(centerName,slotTime,workoutType, user, rankingType)
Guidelines:
Time: 120 mins.
Write modular, clean and demo-able code (Test cases or runtime execution).
A driver program/main class/test case is needed to test out the code by the evaluator with multiple test cases. But do not spend too much time in the input parsing. Keep it as simple as possible.
Please handle concurrency wherever applicable.
Evaluation criteria: Demoable & functionally correct code, Code readability, Proper Entity modeling, Modularity & Extensibility, Separation of concerns, Abstractions, Exception Handling, Code comments. Use design patterns wherever applicable
You are not allowed to use any external databases like MySQL. Use only in-memory data structures.
No need to create any UX or any HTTP API. It should be a standalone application.


