rails user:create_admin # first is to create admin
rails user:create -- --email ... --name ... --password ... # next one user
rails credit:send -- --user <User.id or User.email> --amount 1500.3 # send money from admin account (rich one)
rails credit:send -- --user [email protected] --amount 1500.3 --force # directly w/o transaction logging
- I'm using Postgres on AWS RDS -- feel free to use it (but it's not super powerful)
- My Auth0 API limits is 1k tokens (but it's only using for manual user creation from rake task)
- My Auth0 users limit is 7k 🤷
- Common pipeline of request be like: controller -> interactor -> service(s) ->(optional) query(ies)
- Each client can have only one account
- Limit-offset pagination for transactions and clients list -- but sometimes it's not relevant (depends on the business case)
- In real money processing is good practice to split real number on two naturals (by decimal point) to avoid rounding
- Didn't made a lot of reactivity on UI (you need to reload page to update transactions history)
- Made a transfer in sync way
- Each client makes (on average) 5-10 transactions per day -- it's not a stock exchange :D
- Deadlocks on transactions is possible, and not very often (see 1.)
- For test purposes I'm using AWS RDS Postgres (you can use it too, I didn't hide credentials. It was done purposely for the test task)
- For authenticating I'm using Auth0. Two reasons for this: you don't need to store sensitive data and I find these tools very useful either on the MVP stage and on the scale
- Instead of the "Transactions" table is better to use something write-optimized (NoSQL like Cassandra)
- Make money transfers in an async way. In that way, we need:
- Create an additional transaction state, like 'processing'
- Make the Frontend to be able to show 'processing' transactions and receive some updates (via websocket for example)
- Queue, processor workers, etc.
- Handle possible hard issue: outage between transaction commit and writing to transactions log DB (logging on very beginning of request)
- constraints, indexes, not nulls
- specs
- ui
- rake for user creation (+ admin)
- rake for user credit
Test Case Development - Ruby on Rails.pdf