This is a small full-stack application which enables the user to view and manage security movements utilising the Django and React frameworks.
home page
edit page
delete prompt
The main goal is for the user to be able to create, view, edit and delete security movements.
A security movement is just a way of describing the buying or selling of shares in a company, for example, if John sells 200 shares in Company XYZ to Mary, they are participating in a "security movement" for 200 Company XYZ shares.
There are 3 different types of security movements:
- Allotment (eg, Company XYZ sells John some shares)
- Redemption (John sells his shares back to Company XYZ)
- Transfer (eg, John sells his Company XYZ shares to Mary)
A security movement always has a quantity (aka numer of units) and a price.
This project was bootstrapped with Create React App for the frontend and django-admin startproject for the backend.
In the frontend
directory, you can run:
npm install
to install required packagesnpm run start
to run the app in the development mode.- Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes. You may also see any lint errors in the console.
Proxying API requests to the django app http://localhost:8000 has been set up in the package.json
to avoid CORS issues as per https://create-react-app.dev/docs/proxying-api-requests-in-development/
In the backend directory, using a python 3.8+ environment run the following commands to set up the project.
pip install -r requirements.txt
to install the python requirementspython manage.py migrate
to run the initial database migrationspython manage.py runserver
to run the development server on http://127.0.0.1:8000/api/v1/movements/
- As the user I should be able to view all the security movements in a table list view
- The table should have a column for each field listed below and a column that contains the edit and delete buttons
- ID -
id
- Security movement type -
security_movement_type
- Buyer -
buyer
- Seller -
seller
- No. of units -
no_of_units
- Price per unit -
price_per_unit
- Actions - Buttons for editing and deleting
- ID -
- The table should have a column for each field listed below and a column that contains the edit and delete buttons
- As the user I should be able to create a new security movement
- The create form should be shown by clicking a button labelled
Create
from the list view security_movement_type
,no_of_units
andprice_per_unit
are all mandatory fieldssecurity_movement_type
can only be one of the following valuesTransfer
Redemption
Allotment
- If the
security_movement_type
isTransfer
then bothbuyer
andseller
fields are mandatory - If the
security_movement_type
isRedemption
then theseller
field is mandatory and thebuyer
field should be hidden and its value empty - If the
security_movement_type
isAllotment
then thebuyer
field is mandatory and theseller
field should be hidden and its value empty no_of_units
must be an integer greater than zeroprice_per_unit
must be an integer greater than zero
- The create form should be shown by clicking a button labelled
- As the user I should be able to edit a security movement
- The edit form should be shown by clicking an edit button from each row of the table in the list view
- The edit form validation logic is the same as the create form validation logic listed above
- As the user I should be able to delete a security movement
- When the user clicks the delete button on a particular security movement they should be prompted if they are sure they want to delete the security movement and be able to confirm or cancel the action