parkingLot/v1 {
request: GET
argument: {
carType,
isHandicapped,
}
returnBody: {
numberOfFreeSpaces
}
return statuses: Ok()
SystemFailure()
}
parkingLot/v1/park {
request: POST,
requestBody: {
carType,
isHandicapped,
carNumberPlate
}
return statuses: Ok(parked)
NoSpace
SystemFailure()
}
Because the special status like handicapped almost never gets changed or some other stautes added + the sizes of the cars are not chaning I poropse the following schema for in memory DB:
ParkingLot: +int totalCapacity
ParkingLot: +int totalAvailableSpace
ParkingLot: +CarSpace normalAvailableSpace
ParkingLot: +CarSpace handicappedAvailableSpace
CarSpace : +int freeSmall
CarSpace : +int freeMedium
CarSpace : +int freeLarge
The parking lot db has no indices, because it's a pure counter db
The user schema which will reside in an sql DB will look like this:
User : +int RecordID PK
User : +String PlateNumber KEY
User: +bool isHandicapped
User: +int CarSize
User: +DateTime arrivalTime
User: +DateTime exitTime
User: +Char+Int lotNumber
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?