Ordering Food System with Rails
bundle install
To run this project, you can use Run Button in Replit. But if you want to run in the localhost, you can use
rails s
For Detail API Documentation please check here API Documentation
For unit test I use RSpec and you can run the test with
bundle exec rspec -fd
I use rufus-scheduler to run scheduled task, to cancel order that haven't been paid in 5pm, and here is the code
s.cron '0 17 * * *' do
orders = Order.where(status: :NEW)
puts orders.size.to_s + " orders cancelled"
orders.update_all(status: :CANCELED)
end
You can check more detail in config/initializers/scheduler.rb
I have completed 7 user stories on the problem statement. And all the bonus points that have been mentioned. And I've added API Documentation using Postman and Web Admin.
I use Trestle to make Web Admin You can open in '/admin' path
NOTE : For things that can be done on the Web Admin is rather limited, to do more complex things such as insert order with order detail and others please use the API above.
Library | Description |
---|---|
rufus-scheduler | Scheduler |
Trestle | Web Admin |