Small money-transferring application API
Remember to docker login before trying any Docker related operation!
If you have never used a Docker based environment before, your first step would be likely to execute the command docker swarm init
. This will allow your physical computer to act as the manager node of an orquested swarm.
Only then you will be able to execute the main script. Make sure your environmental variables are correct inside the deployment_script.sh file, and then execute it. It will create all the necessary and deploy the API server on the 8000 port.
After that, you will have the application ready to recept any requests!
-
api/login: Providing username and password in a POST, it will give return a valid token.
-
api/logout: It will logout any user refered, if SessionAuthentication was being used.
-
api/users: A GET will get us informations about our current user. A POST with the adequate parameters and a non already registered email will create a new user. A PATCH will modify our current user as desired.
-
api/accounts: A GET will get us informations about our current account. An empty post from a user without an Account assigned will create an assign one.
-
api/accounts/: A GET will let us know about the balance of the user with the PK indicated.
-
api/transfers: A GET will get us the transaction history that involves our current user. A POST with an amount, a receiver UserProfile ID and an optional concept will create us a Transfer record, and execute the balance changes operations in a transactional way. It does some checks, like that of the amount sent will not leave the sender's account on negative numbers, that the amount sent is not negative, and that the receiver UserProfile does indeed exists in the system.