A simple implementation of Virtual Cinema Theater. It is based on Spring Boot and built with Intellij IDEA.
Program which REST service that can show the available seats, sell and refund tickets, and display the statistics of your venue.
Response body:
{
"total_rows":9,
"total_columns":9,
"available_seats":[
{
"row":1,
"column":1,
"price":10
},
{
"row":1,
"column":2,
"price":10
},
{
"row":1,
"column":3,
"price":10
},
........
{
"row":9,
"column":8,
"price":8
},
{
"row":9,
"column":9,
"price":8
}
]
}
Request body:
{
"row": 3,
"column": 4
}
Response body:
{
"token": "e739267a-7031-4eed-a49c-65d8ac11f556",
"ticket": {
"row": 3,
"column": 4,
"price": 10
}
}
Request body:
{
"token": "e739267a-7031-4eed-a49c-65d8ac11f556"
}
Response body:
{
"returned_ticket": {
"row": 1,
"column": 2,
"price": 10
}
}
Request body:
{
"token": "e739267a-7031-4eed-a49c-65d8ac11f556"
}
Response body:
{
"error": "Wrong token!"
}
Request body:
{
"row": 3,
"column": 4
}
Response body:
{
"error": "The ticket has been already purchased!"
}
Request body:
{
"row": 15,
"column": 4
}
Response body:
{
"error": "The number of a row or a column is out of bounds!"
}
Endpoint /stats
will handle POST requests with URL parameters. If the URL parameters contain a password key with a super_secret value, it will return the movie theatre statistics in the following format:
{
"current_income": 0,
"number_of_available_seats": 81,
"number_of_purchased_tickets": 0
}
Response body:
{
"error": "The password is wrong!"
}
Response body:
{
"current_income": 30,
"number_of_available_seats": 78,
"number_of_purchased_tickets": 3
}