CCI-MOC / flocx-market

2 stars 9 forks source link

Implemented contracts API #32

Closed fvukelic closed 5 years ago

fvukelic commented 5 years ago

Implemented endpoints for contracts. This also covers all the basic tests for the marketplace with an Sqlite database.

codecov-io commented 5 years ago

Codecov Report

Merging #32 into master will decrease coverage by 9%. The diff coverage is 76.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #32      +/-   ##
==========================================
- Coverage   97.18%   88.18%   -9.01%     
==========================================
  Files          35       32       -3     
  Lines         924      948      +24     
==========================================
- Hits          898      836      -62     
- Misses         26      112      +86
Impacted Files Coverage Δ
flocx_market/conf/api.py 100% <ø> (ø) :arrow_up:
flocx_market/tests/unit/db/sqlalchemy/test_api.py 100% <100%> (ø) :arrow_up:
flocx_market/api/app.py 100% <100%> (ø) :arrow_up:
flocx_market/api/bid.py 100% <100%> (+3.33%) :arrow_up:
flocx_market/api/contract.py 33.33% <33.33%> (ø)
flocx_market/db/sqlalchemy/models.py 93.05% <84.37%> (-6.95%) :arrow_down:
flocx_market/db/sqlalchemy/api.py 97.75% <96.29%> (-0.64%) :arrow_down:
flocx_market/objects/__init__.py 100% <0%> (ø) :arrow_up:
flocx_market/tests/unit/api/test_app_bid.py 100% <0%> (ø) :arrow_up:
flocx_market/tests/unit/api/test_app_offer.py 100% <0%> (ø) :arrow_up:
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4052f99...82beefa. Read the comment docs.

tzumainn commented 5 years ago

I'm not entirely sure about the data model, but I think that's more me getting confused than anything else. I still don't think an offer should tie specifically into one contract, because it seems to me that an offer should be able to handle multiple contracts over its lifespan - but I know that's a point of contention.

In any case, I'm fine with this going in as-is, and possibly adjusting the data model later if needed. @larsks what do you think?

tzumainn commented 5 years ago

Ah, we have to add contract_id to offers in a few places:

tzumainn commented 5 years ago

Whoops, you did update objects/offer.py. It possibly has to have 'nullable=True'

fvukelic commented 5 years ago

@tzumainn had to add it to a few places, just now saw that the tests were failing :D they passed now

tzumainn commented 5 years ago

@fvukelic awesome, thanks! Looks good - merging now!