Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
1f8c3d7
Setting up GitHub Classroom Feedback
github-classroom[bot] Oct 4, 2021
e46756a
Inital project commit
Thomas-Wood Nov 16, 2021
5b9f1a3
Merge pull request #2 from BUCOMPAdvancedDevelopment/master
Thomas-Wood Nov 16, 2021
c499184
feat: Base Flask app with auth functions
Thomas-Wood Nov 16, 2021
88b6069
refactor: Tweak code to work for local development
Thomas-Wood Nov 16, 2021
95a05df
Merge pull request #3 from BUCOMPAdvancedDevelopment/master
Thomas-Wood Nov 16, 2021
b9c934b
feat: Added navbar and placeholder pages and text
Thomas-Wood Nov 16, 2021
c804dd5
feat: Basic bootstrap product grid created
Thomas-Wood Nov 18, 2021
3797a7d
refactor: Rearrange folder set up for unittests. And update readme
Thomas-Wood Nov 18, 2021
cfb6bd2
fix: Correct html block links
Thomas-Wood Nov 18, 2021
be648cf
feat: Added unit tests for main Flask app routing
Thomas-Wood Nov 18, 2021
98ba88c
feat: Make login nav button stick to right
Thomas-Wood Nov 22, 2021
119a608
feat: Create sample Products DB data
Thomas-Wood Nov 22, 2021
b65b79e
Docs: Typos and expanded readme
Thomas-Wood Nov 22, 2021
063500f
docs: Added cloud functions source
Thomas-Wood Nov 22, 2021
0d5c881
docs: Added database sample products data
Thomas-Wood Nov 22, 2021
d9127b1
feat: Link product page to show details provided by API (MongoDB)
Thomas-Wood Nov 22, 2021
a7d1f24
feat: Add sample images for products
Thomas-Wood Nov 28, 2021
7c958aa
feat: Link images in Google Cloud Storage to webpage dynamically
Thomas-Wood Nov 28, 2021
dc0642b
fix: Correct Alt image description
Thomas-Wood Nov 28, 2021
b93a2a2
fix: Remove print statement
Thomas-Wood Nov 28, 2021
cf54922
feat: Add admin page to create new product details using Google Funct…
Thomas-Wood Nov 29, 2021
2ffc1e7
chore: Update Products content
Thomas-Wood Nov 30, 2021
2c3a57b
refactor: Separate tool functions out of main.py
Thomas-Wood Nov 30, 2021
f033ceb
feat: Add admin table editting format and read box
Thomas-Wood Nov 30, 2021
ce1a04d
feat: Add update functionality for product details
Thomas-Wood Nov 30, 2021
5390653
feat: Add delete product functionality
Thomas-Wood Nov 30, 2021
21b96e8
feat: Update read product function name and url
Thomas-Wood Nov 30, 2021
5e69e3d
feat: Create Cloud function to get all image ids
Thomas-Wood Nov 30, 2021
36cf090
fix: Missed content
Thomas-Wood Nov 30, 2021
5ef10a0
feat: Add read cloud storage image ids and template for rest of CRUD …
Thomas-Wood Nov 30, 2021
f273417
refactor: Update new product form to use bootstrap styling
Thomas-Wood Dec 7, 2021
df5b4a8
feat: Add upload image functionality
Thomas-Wood Dec 7, 2021
2d61258
fix: Remove redundant code
Thomas-Wood Dec 7, 2021
67c573b
docs: Update comments and formatting
Thomas-Wood Dec 8, 2021
df7d82e
feat: Add update product functionality
Thomas-Wood Dec 8, 2021
69bc5e3
fix: Update the image ID to be unique for each issue, fixing the cach…
Thomas-Wood Dec 9, 2021
587b4fe
refactor: Refactor delete page for admins to use bootstrap tables
Thomas-Wood Dec 9, 2021
16f509a
fix: Correct delete button submittion type
Thomas-Wood Dec 9, 2021
fde46cf
chore: Remove TODOs and old parsed data
Thomas-Wood Dec 9, 2021
aa9ed6c
feat: Old images now get deleted when an object is deleted or updated
Thomas-Wood Dec 9, 2021
1d21c8b
fix: Correct tag list handling
Thomas-Wood Dec 9, 2021
d3b54f3
feat: Add user accounts and permissions checking
Thomas-Wood Dec 9, 2021
121073c
fix: Add userId into database
Thomas-Wood Dec 9, 2021
a7b3bdf
fix: Add missing auth check
Thomas-Wood Dec 9, 2021
f25574c
fix: Correct misnamed arg
Thomas-Wood Dec 9, 2021
260b9d6
fix: Correct access method for admin credentials
Thomas-Wood Dec 9, 2021
07d02aa
chore: Update TODOs
Thomas-Wood Dec 9, 2021
24299b6
feat: Add basket page
Thomas-Wood Dec 10, 2021
99fd84d
feat: Add ajax to add to basket button
Thomas-Wood Dec 10, 2021
c1ee04b
feat: Add add to basket functionality
Thomas-Wood Dec 10, 2021
2f4fc39
fix: Remove old print, correct user_data access method and hide qty w…
Thomas-Wood Dec 10, 2021
70a9fa9
fix: Correct access method of items in basket
Thomas-Wood Dec 10, 2021
055d7d1
fix: Correct spelling and access method
Thomas-Wood Dec 10, 2021
3afb2a0
fix: Correct data type multiplication
Thomas-Wood Dec 10, 2021
47cc071
fix: Remove repeated index
Thomas-Wood Dec 10, 2021
58e564c
fix: Correct data type error
Thomas-Wood Dec 10, 2021
80b1b70
refactor: Make currency have 2 decimal places
Thomas-Wood Dec 10, 2021
24747f6
feat: Add delete button to products in basket
Thomas-Wood Dec 10, 2021
2c2a159
fix: Correct url
Thomas-Wood Dec 10, 2021
c4e6069
fix: Correct type in cloud function
Thomas-Wood Dec 10, 2021
5c7c9d3
style: Change button style to info
Thomas-Wood Dec 11, 2021
18ec969
feat: Add create order html page and routing
Thomas-Wood Dec 12, 2021
cea5da1
fix: Fix button link, and set up order details handling
Thomas-Wood Dec 12, 2021
afcd404
fix: Correct radio button functionality
Thomas-Wood Dec 12, 2021
88682fa
fix: Correct timedelta calculation
Thomas-Wood Dec 12, 2021
7272400
fix: Correct loop index for basket deleting
Thomas-Wood Dec 12, 2021
a621651
refactor: Store date as string instead of datetime object
Thomas-Wood Dec 12, 2021
807ea2e
feat: Add order creation and database saving via gcloud function
Thomas-Wood Dec 12, 2021
84ced09
fix: Tweak param parsing and cloud function to work
Thomas-Wood Dec 12, 2021
6c11b21
feat: Create order viewing page
Thomas-Wood Dec 12, 2021
c44b08e
feat: Add route logic for order viewing
Thomas-Wood Dec 12, 2021
069d639
fix: Add missing button
Thomas-Wood Dec 12, 2021
28a2961
feat: Create cloud function to get summaried user data
Thomas-Wood Dec 13, 2021
96c0b48
feat: Add view user details page and edit button
Thomas-Wood Dec 13, 2021
ff4b9fb
feat: Create edit user html page and route
Thomas-Wood Dec 13, 2021
64ef3d8
fix: Correct url call
Thomas-Wood Dec 13, 2021
1bfd4f3
fix: Correct date indexes and select list location
Thomas-Wood Dec 13, 2021
93b2d2c
fix: Correct from access method
Thomas-Wood Dec 13, 2021
82e5dd7
feat: Add update user logic and google cloud function
Thomas-Wood Dec 13, 2021
5023998
fix: Parse list correctly
Thomas-Wood Dec 13, 2021
244d673
feat: Add delete user button and cloud logic
Thomas-Wood Dec 13, 2021
90a164e
feat: Add message page and tidy text displays
Thomas-Wood Dec 13, 2021
77c89c6
fix: Correct login page hidding login button
Thomas-Wood Dec 13, 2021
9045ca3
refactor: Remove duplicated code and move google function calls into …
Thomas-Wood Dec 13, 2021
2e212e5
fix: Add missing module name
Thomas-Wood Dec 13, 2021
242cfe1
fix: Add missing variable definitions
Thomas-Wood Dec 13, 2021
fc9cd35
docs: Added docs strings to all functions
Thomas-Wood Dec 13, 2021
4d9fcb0
feat: Add edit buttons for orders and user details
Thomas-Wood Dec 14, 2021
65d58ef
fix: Correct variable name
Thomas-Wood Dec 14, 2021
d7da525
docs: Add troubleshooting tips on import errors during unittest runs
Thomas-Wood Dec 14, 2021
c8703df
refactor: Remove redundant folder
Thomas-Wood Dec 14, 2021
e6ec05f
typo: Typo in about page text
Thomas-Wood Dec 14, 2021
3f3e85f
refactor: Remove duplicated message
Thomas-Wood Dec 14, 2021
8eda3b6
test: Add mocks for user data and tests for basket
Thomas-Wood Dec 14, 2021
9ad6540
test: Added tests for basket
Thomas-Wood Dec 14, 2021
2f54fcb
test: Added test for remove from basket
Thomas-Wood Dec 14, 2021
ac14aeb
test: Add tests for order page
Thomas-Wood Dec 14, 2021
f991c6f
test: Add tests for create order form page
Thomas-Wood Dec 14, 2021
8bfc33e
test: Added tests for order submission
Thomas-Wood Dec 14, 2021
1cf3c87
fix: Correct check for admin permissions
Thomas-Wood Dec 14, 2021
9ee8af2
test: Add tests for update product form page
Thomas-Wood Dec 14, 2021
b8eca39
refactor: Remove redundant title
Thomas-Wood Dec 14, 2021
7f26208
test: Add tests for admin page
Thomas-Wood Dec 14, 2021
f5dc792
test: Add tests for edit user form page
Thomas-Wood Dec 14, 2021
685b4f0
test: Add tests for delete user
Thomas-Wood Dec 14, 2021
838ba43
test: Add tests for update user submitted
Thomas-Wood Dec 14, 2021
5eb7e1f
test: Add tests for view and update personal details
Thomas-Wood Dec 14, 2021
1f08071
test: Add tests for update personal details submission
Thomas-Wood Dec 14, 2021
887e569
test: Add tests for new product creation
Thomas-Wood Dec 14, 2021
178b11c
test: Add tests for update product submitted
Thomas-Wood Dec 14, 2021
01dd851
test: Add tests for delete products
Thomas-Wood Dec 14, 2021
9a8f1b6
chore: Update Products.json sample file and Readme
Thomas-Wood Dec 14, 2021
7af0e99
docs: Added example user data collection
Thomas-Wood Dec 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
app/__pycache__
tests/__pycache__
50 changes: 50 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Project description

This project is a prototype furniture website which makes extensive use of cloud functionalities such as:

- Google Cloud Functions
- Firebase (For authentication)
- MongoDB (For most data storage)
- Google Cloud Store (For image data)

# Project layout

## app

The app folder contains the main Flask application that servers the web pages.

## cloudFunctions

This folder contains the source code for functions stored and used in Google Cloud Functions.

## databaseDetails

This folder contains information on the set up of the databases including starting sample data. Images have been left out in the interest of file size. All images stored in Google Cloud Storage are jpegs so you can access any image by going to:
'https://storage.googleapis.com/synthetic-cargo-products/619bb55c11dd33ac12d5aa0f.jpg'
The id can be swapped out for any id in Products.json -> imageId

## tests

This folder contains all the unit tests for this project. It makes use of the [unittest](https://docs.python.org/3/library/unittest.html) framework for Python.

# Tests

Each file tests a single other file. The test file is the name of the file being tested prefixed by "test\_". For example: main.py is tested in the test_main.py file.

Mocks have been used to fake the functionality of some function calls. Ideally everything outside of the file under test would be mocked but due to time constraints, only some key areas have been mocked including the Auth calls to Firebase and any write operations to the databases.

# Useful commands

To start the server (Ctrl + c to shutdown)

`python app/main.py`

To run the tests (from the root directory)

`python -m unittest discover -s tests`

# Troubleshooting import errors

Imports in a file under test don't always work well in Python, you may need to add the absolute path of the app folder into your Python set up folder:
Add a .pth file with the absolute path in it to here C:\Python39\Lib\site-packages
This helps unittest to discover the packages. The imports will work correctly as normal without this when starting the flask app.
1 change: 1 addition & 0 deletions app/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime: python39
Loading