Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
2089170
Create Hello world endpoint
Lakorthus Jun 20, 2023
1571f0a
tested and updated readme instructions for running app
piratejas Jun 20, 2023
ea1d499
test: test_hello_world controller function.
Lakorthus Jun 20, 2023
0af031b
test: routes on hello_world
Lakorthus Jun 20, 2023
b0d5802
Merge pull request #2 from methods/feat_hello_world
Lakorthus Jun 20, 2023
63c02ba
feat: added and manually tested post route for bid
piratejas Jun 21, 2023
ac87d4e
feat: saving data in memory and separating logic
Lakorthus Jun 22, 2023
d1f230c
wip: add phase info to success/failed
piratejas Jun 22, 2023
53d3913
feat: field validation, set status enum
piratejas Jun 22, 2023
3d0dc1c
test: add post bid route tests
piratejas Jun 22, 2023
7641b4b
Merge pull request #3 from methods/feat/create-new-bid
piratejas Jun 22, 2023
2d6d8cf
fix: renamed files and folders for readability
piratejas Jun 23, 2023
65901b1
Merge pull request #4 from methods/fix/filenames-improvement
piratejas Jun 23, 2023
027cc43
fix: changed set_status
piratejas Jun 23, 2023
817cd3d
wip: swagger spec config
piratejas Jun 23, 2023
cc3763c
docs: Update contribution guidelines to incl. release and tagging
nshumoogum Jun 23, 2023
34c1a45
fix: installed flask_swagger_ui; created swagger_config.yml
piratejas Jun 26, 2023
44145f6
chore: flask-ui added to the requirements
Lakorthus Jun 27, 2023
4a35b21
Merge branch 'feat/swagger-spec' into fix/set-status-enum
Lakorthus Jun 27, 2023
03520b5
Merge pull request #7 from methods/fix/set-status-enum
Lakorthus Jun 27, 2023
2d2d28f
fix: swagger config structure
piratejas Jun 27, 2023
5f10e67
refactor: swagger config components and refs
piratejas Jun 27, 2023
cd2bc74
feat: completed swagger spec for post bid endpoint
piratejas Jun 28, 2023
0e0677e
Merge pull request #8 from methods/feat/swagger-spec
piratejas Jun 28, 2023
9249e09
refactor: success and failed phase info
piratejas Jun 28, 2023
6d1fdbc
refactor: added helper function and logic for feedback
piratejas Jun 28, 2023
3ac5bd2
Merge pull request #9 from methods/refactor/post-bid-endpoint
piratejas Jun 29, 2023
8d7aaac
refactor: added marshmallow schemas; renamed classes and fixed import…
piratejas Jun 29, 2023
1b48bc2
refactor: handling ValidationError with marshmallow and outputting cu…
piratejas Jun 30, 2023
ed395ce
refactor: added test request bodies to check validation
piratejas Jun 30, 2023
a430451
refactor: removed unused imports
piratejas Jun 30, 2023
22e3002
refactor: moved class declarations to models folder; updated swagger …
piratejas Jul 3, 2023
29ac930
refactor: updated readme with swagger instructions
piratejas Jul 3, 2023
1e147e5
Merge pull request #10 from methods/refactor/implementing-marshmallow
piratejas Jul 3, 2023
042e4f2
feat: connect to mongodb instance; refactored post
piratejas Jul 3, 2023
b099087
Update README.md
piratejas Jul 3, 2023
3de2be9
Update README.md
piratejas Jul 3, 2023
efc5e00
refactor: added information to readme; changed db name to bidsAPI
piratejas Jul 3, 2023
15c2663
refactor: updated swagger _id fields
piratejas Jul 4, 2023
927bbb9
wip: tests for post route mocking db response
piratejas Jul 4, 2023
3a6bd89
Merge pull request #11 from methods/feat/mongodb-connection
piratejas Jul 4, 2023
4b3df65
feat: added swagger spec for get_all_bids endpoint
piratejas Jul 4, 2023
ebe66dd
feat: swagger spec created for get bid/id
Lakorthus Jul 4, 2023
81b1635
Merge pull request #12 from methods/feat/swagger_spec-get_bid/{id}
piratejas Jul 4, 2023
3c74327
feat: incorporated julio changes to swag
piratejas Jul 4, 2023
1a56618
Merge pull request #13 from methods/feat/get-all-bids-swagger
piratejas Jul 4, 2023
6d2e3f8
feat: phase schema validation and enum added
Lakorthus Jul 4, 2023
f43b88b
fix: validation for the phase schema
Lakorthus Jul 5, 2023
70f9c77
Merge pull request #14 from methods/feat/phase-enum
Lakorthus Jul 5, 2023
cca05b2
feat: get all bids from MongoDB
Lakorthus Jul 5, 2023
f0cca03
fix: format return bids
Lakorthus Jul 5, 2023
61a0331
feat: added get by id and handling error responses
piratejas Jul 5, 2023
f4a0bf4
refactor: removed unused imports and added comments
piratejas Jul 5, 2023
31a5ad7
test: get all bids and check connection failure
Lakorthus Jul 5, 2023
b5daebf
test: post bid test
Lakorthus Jul 6, 2023
12a47d5
test: error if you are not able to retrive bids
Lakorthus Jul 6, 2023
a43e8ca
test: test suite for get_bid_by_id
piratejas Jul 6, 2023
a532235
test: added validation error test
piratejas Jul 6, 2023
8d88c70
Merge pull request #15 from methods/feat/get-bid-by-id
piratejas Jul 6, 2023
4f1c3e7
Merge branch 'develop' into feat/get_all
Lakorthus Jul 6, 2023
918d4e9
Merge pull request #16 from methods/feat/get_all
Lakorthus Jul 6, 2023
3b2c8d4
fix: debugged valid_bid_id_schema
piratejas Jul 11, 2023
eab3874
test: bid model and schema validation
piratejas Jul 11, 2023
e15ee6d
refactor: removed unused import
piratejas Jul 11, 2023
078695d
feat: Route for delete added Swag spec and test
Lakorthus Jul 11, 2023
90269e5
Merge pull request #17 from methods/feat/delete-route
Lakorthus Jul 11, 2023
87c5c2c
Update all_fields.http
piratejas Jul 11, 2023
d5f9a18
Merge pull request #18 from methods/test/bid-request-schema-validation
piratejas Jul 11, 2023
cc8904f
test: delete by id validation error
Lakorthus Jul 12, 2023
1bac2b9
Merge pull request #19 from methods/feat/delete_bid
Lakorthus Jul 12, 2023
06adef2
feat: added query to get_all to filter by status not equals to deleted
piratejas Jul 12, 2023
49ad68a
refactor: testing without magicMock
Lakorthus Jul 13, 2023
b5add45
fix: updated soft delete method from PUT to DELETE
piratejas Jul 13, 2023
1a7ba79
feat: added swag spec and endpoint for update bid route; changed bid …
piratejas Jul 13, 2023
c841aeb
refactor: updated examples in swagger spec
piratejas Jul 13, 2023
6ceb406
Merge pull request #20 from methods/feat/filtering-out-deleted
piratejas Jul 17, 2023
222f5a2
Merge pull request #21 from methods/refactor/test-magicMock
Lakorthus Jul 17, 2023
700d658
Merge branch 'develop' into feat/update-bid-by-id
piratejas Jul 17, 2023
8b26e55
Merge pull request #22 from methods/feat/update-bid-by-id
piratejas Jul 17, 2023
b3b574b
test: update bid by id tests; refactored to add helper functions for …
piratejas Jul 17, 2023
6f2f6a2
refactor: removed unused imports
piratejas Jul 17, 2023
f9ae9e9
refactor: cleaned up controller
piratejas Jul 18, 2023
1238a99
refactor: changed find and replace to update one; wip: adding last_up…
piratejas Jul 18, 2023
1c986c2
test: updating tests after refactor
piratejas Jul 18, 2023
dcd3f6a
test: updated tests after refactoring
piratejas Jul 18, 2023
386a13b
Merge pull request #23 from methods/test/update-bid-by-id
piratejas Jul 18, 2023
a9f169c
feat: Makefile
Lakorthus Jul 18, 2023
f573dcb
refactor: README and req.txt updated with Makefile
Lakorthus Jul 18, 2023
99d5a63
feat: vulnerability check using safety
Lakorthus Jul 18, 2023
8859be2
refactor: added custom error message to path param validation
piratejas Jul 19, 2023
8329de6
feat: commit script Makefile
Lakorthus Jul 19, 2023
b6f3e0e
feat: commit message to gitignore
Lakorthus Jul 19, 2023
738434a
refactor: makefile check
Lakorthus Jul 19, 2023
d642f7a
test: testing commit msg
Lakorthus Jul 19, 2023
eea3c3b
test: test commit msg
Lakorthus Jul 19, 2023
9a4b05c
test:
Lakorthus Jul 19, 2023
b648ac0
Merge pull request #25 from methods/feat/gmakefile
Lakorthus Jul 19, 2023
cc28971
refactor: updated swagger to include additional error responses
piratejas Jul 19, 2023
b7a95d4
Merge pull request #26 from methods/refactor/error-handling
piratejas Jul 19, 2023
631ca74
refactor: updated makefile and refactored commit target
piratejas Jul 19, 2023
177f574
fix: set upstream for new branch
piratejas Jul 19, 2023
f86fdad
refactor: removed unnecessary mocking in post_bid tests
piratejas Jul 19, 2023
161e8b7
refactor: changed variable name in helpers for clarity
piratejas Jul 19, 2023
9182179
refactor: removed unused imports
piratejas Jul 20, 2023
6452173
feat: created prepend host function and test
piratejas Jul 20, 2023
714be0c
Merge pull request #28 from methods/feat/makefile-update
piratejas Jul 20, 2023
ef35c17
feat: lint and format features added to makefile
Lakorthus Jul 20, 2023
fd04b55
feat: added prepend host to controller methods
piratejas Jul 20, 2023
97b4b25
refactor: formatted with black
piratejas Jul 20, 2023
e1e3317
Merge pull request #29 from methods/feat/makefile-lint-format
Lakorthus Jul 20, 2023
48a52ce
Merge branch 'develop' into feat/append-host
piratejas Jul 20, 2023
031df6e
Merge pull request #30 from methods/feat/append-host
piratejas Jul 20, 2023
a77ac56
feat: added test coverage report; updated gmake help
piratejas Jul 20, 2023
65316f0
feat: added script to populate and delete bids
Lakorthus Jul 20, 2023
9e28822
feat: added update bid status endpoint; updated swagger; handled erro…
piratejas Jul 20, 2023
89101e5
test: changed file name to test_helpers
piratejas Jul 20, 2023
11ef07f
test: increased test coverage; added commands to makefile
piratejas Jul 20, 2023
51fc35c
test: added more tests
piratejas Jul 20, 2023
bca764a
refactor: makefile setup
Lakorthus Jul 21, 2023
d9e7b23
Merge pull request #31 from methods/feat/add-script-populate-delete
Lakorthus Jul 21, 2023
fbb4584
Merge branch 'develop' into feat/update-status
piratejas Jul 21, 2023
84ad494
Merge pull request #32 from methods/feat/update-status
piratejas Jul 21, 2023
64f7135
docs: separated test_requirements and added make target; updated readme
piratejas Jul 21, 2023
19e3bb3
test: moved phase validation tests into test_BidRequestSchema; refact…
piratejas Jul 21, 2023
e4a4e0e
Merge pull request #33 from methods/docs/update-readme
piratejas Jul 21, 2023
57a4349
refactor: separated logic for post_bid_schema and update_bid_schema; …
piratejas Jul 21, 2023
4f67fdc
refactor: changed date input format to ensure same output, updated sw…
piratejas Jul 21, 2023
2b3fe8c
test: updated tests for date format change
piratejas Jul 21, 2023
8b071e1
refactor: added todo plan to incorporate validation of unique phases …
piratejas Jul 21, 2023
ee1ea76
refactor: unique phase validation works on put; put and post use same…
piratejas Jul 24, 2023
264d079
Merge pull request #34 from methods/refactor/bid-schema
piratejas Jul 24, 2023
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

Expand Down Expand Up @@ -127,6 +126,9 @@ venv/
ENV/
env.bak/
venv.bak/
commit_message.txt
./commit_message.txt


# Spyder project settings
.spyderproject
Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
80 changes: 76 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,82 @@
Contributing guidelines
=======================
# Contributing guidelines

### Git workflow
## Git workflow

* Use git-flow - create a feature branch from `develop`, e.g. `feature/new-feature`
* Use git-flow - create a feature branch from `develop`, e.g. `feat/new-feature`
* Pull requests must contain a succinct, clear summary of what the user need is driving this feature change
* Ensure your branch contains logical atomic commits before sending a pull request
* You may rebase your branch after feedback if it's to include relevant updates from the develop branch. It is preferable to rebase here then a merge commit as a clean and straight history on develop with discrete merge commits for features is preferred
* To find out more about contributing click [here](https://contributing.md/)

## Branching
* Branches should be named in the following format:
```textbox
<type>/<description>
```
where `type` is one of the following:
```textbox
* fix: for a bug fix
* feat: for a new feature
* docs: for documentation changes
* style: for changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* refactor: for refactoring production code
* test: for adding tests
* chore: for updating build tasks, package manager configs, etc
* build: for changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
```
and `description` is a short description of the feature or fix being made
* e.g. `feat/new-feature` or `fix/bug-fix`
* Branches should be created from the `develop` branch
* Branches should be merged back into the `develop` branch

## Commit messages

Please use the following format for commit messages:

```textbox
* fix: for a bug fix
* feat: for a new feature
* docs: for documentation changes
* style: for changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* refactor: for refactoring production code
* test: for adding tests
* chore: for updating build tasks, package manager configs, etc
* build: for changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
```

## Pull requests

* Pull requests should be made to the `develop` branch
* Pull requests should be made from a feature branch, not `develop`
* Pull requests should be made with a succinct, clear summary of what the user need is driving this feature change
* An automated template will be provided to help with this process, please fill it out as best you can

## Release branches and Tagging

* Once a single or set of changes has been made that can be released, we create a release branch off develop
* Releases should be as small as possible so that it is easier to fix issues and rollback code in production environment without losing many features at once
* Release branches should be of the following structure:

```sh
release/0.1.0
```

* The release name should abide by [semantic versioning (semver)](https://semver.org/)
* Once release branch has been created, a pull request should be made against the `main` branch
* Once approved, the release branch can be merged locally :warning: **WARNING - Do not push to remote** :warning:
* Tag the release and push to remote - [see tagging](#tagging)

## Tagging

* Tag latest commit on branch, this should be the local merge commit
* Check latest local commit, run: `git show HEAD`
* Create tag, run: `tag -s <tag> -m <message>`
* where `tag` is the semver value (should be taken from the release branch name) and `<message>` is a general, short and concise message of the change
* Push release merge and tag to remote, run: `git push --follow-tags`
* Once pushed, go to the Github releases page for the repository in question, which can be found by clicking on the <> Code tab and clicking on Releases on the right hand side:
* Select Tags
* Click on the v0.1.0 tag that you just created
* Choose Create release from tag
* Copy the release name and make human-friendly (capitalise, remove /) to create a release title (e.g. release/0.1.0 -> Release 0.1.0)
* Add relevant release notes, this can be expanded from initial message created against the tag. Advised to use bullet points to list out changes
* Hit Publish release
96 changes: 96 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.ONESHELL:

.DEFAULT_GOAL := run
TOPICS := fix - feat - docs - style - refactor - test - chore - build


PYTHON = ./.venv/bin/python3
PIP = ./.venv/bin/pip


.PHONY: run test clean check help commit swagger format branch lint setup bids dbclean

help:
@echo "gmake help - display this help"
@echo "gmake bids - create sample data"
@echo "gmake branch - create a new branch"
@echo "gmake build - create and activate virtual environment"
@echo "gmake check - check for security vulnerabilities"
@echo "gmake clean - remove all generated files"
@echo "gmake commit - commit changes to git"
@echo "gmake dbclean - clean up the application database"
@echo "gmake format - format the code"
@echo "gmake lint - run linters"
@echo "gmake run - run the application"
@echo "gmake swagger - open swagger documentation"
@echo "gmake setup - setup the application database"
@echo "gmake test - run the tests"

bids:
@echo "Creating sample data..."
@find . -name "create_sample_data.py" -exec python3 {} \;

branch:
@echo "Available branch types:"
@echo "$(TOPICS)"
@read -p "Enter the branch type: " type; \
read -p "Enter the branch description (kebab-case): " description; \
git checkout -b $${type}/$${description}; \
git push --set-upstream origin $${type}/$${description}

build: venv/bin/activate
. ./.venv/bin/activate

check:
$(PIP) install safety
$(PIP) freeze | $(PYTHON) -m safety check --stdin

clean:
@echo "Cleaning up..."
@find . -name "__pycache__" -type d -exec rm -rf {} +
@find . -name ".pytest_cache" -exec rm -rf {} +
@find . -name ".venv" -exec rm -rf {} +

commit: format
@echo "Available topics:"
@echo "$(TOPICS)"
@read -p "Enter the topic for the commit: " topic; \
read -p "Enter the commit message: " message; \
git add .; \
git commit -m "$${topic}: $${message}"; \
git push

dbclean:
@echo "Cleaning up database..."
@find . -name "delete_db.py" -exec python3 {} \;

format:
$(PIP) install black
$(PYTHON) -m black .

lint:
$(PIP) install flake8 pylint
$(PYTHON) -m flake8
$(PYTHON) -m pylint **/*.py

run: build
$(PYTHON) app.py

setup: build dbclean bids
@echo "Setting up the application database..."

swag:
open http://localhost:8080/api/docs/#/

test: test_setup
coverage run -m pytest -vv
@echo "TEST COVERAGE REPORT"
coverage report -m --omit="tests/*,dbconfig/*"

test_setup: test_requirements.txt
$(PIP) install -r test_requirements.txt

venv/bin/activate: requirements.txt
python3 -m venv .venv
$(PIP) install -r requirements.txt

Loading