I am making a Django API for Movie Ticket Booking System. The model for a ticket has got 5 fields namely
- Name of the User
- Phone Number of the User
- Date
- Time
- Status (Discussed in detail below)
The operations supported by the API are,
- GET -> get all the ticket details
- GET/ID -> get the ticket details for the specified ID
- POST -> Book a new ticket
- PUT -> Update date and time of a ticket
- DELETE/ID -> Delete a ticket with the specified ID
I have completed all the above specified functions. But Now I want to do something like,
Mark a ticket as expired if there is a diff of 2 hours between the ticket timing and current time.
AND
Delete expired tickets automatically
I cannot find any useful resources to do the above specified tasks and am unable to think of a professional way to do so. Can anyone please explain the best approach to solve the above problems.
NOTE: The API will not be going LIVE. It will only run on my local machine.