https://github.com/pgorecki/python-ddd-old
Python DDD example
https://github.com/pgorecki/python-ddd-old
Last synced: over 1 year ago
JSON representation
Python DDD example
- Host: GitHub
- URL: https://github.com/pgorecki/python-ddd-old
- Owner: pgorecki
- License: mit
- Created: 2018-11-16T11:05:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-07T08:32:20.000Z (over 7 years ago)
- Last Synced: 2025-01-15T00:41:01.921Z (over 1 year ago)
- Language: Python
- Size: 74.2 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
AUCTION APPLICATION
The goal is to implement an automatic bidding system, described here: https://www.ebay.co.uk/pages/help/buy/bidding-overview.html
User stories:
* As a seller I can list a new item for sale. The item has the following fields: text, description, starting price
* As a seller, I'm allowed to list up to 3 items at the same time
* As a user I can view all the items for sale. For each item I will see: text, description, current price, minimum bidding price, a winner, all participants, action end date
* As a bidder, when placing a bid, I enter the maximum amount I am willing to pay for the item. The seller and other bidders don't know my maximum bid
* As a bidder, when placing a bid, my bid must be higher than the actual price
* Auction Store will automatically calculate the current price of an item based on the bids that were made
* When auction ends, auction store will notify the seller by email. The email will contain the name of the winner and the sell price.
* When auction ends, all losing participants will recieve an email with the information that they lost an auction.
* When auction ends, the winning participant will reciewve an email with information the user has won and the price for an item.
```
pipenv install
pipenv shell
```
To run tests
```
pytest
```
To run tests in watch mode
```
ptw
```
To run the app as Falcon server
```
FRAMEWORK=falcon gunicorn --reload main
```
To run the app as Flask server
```
FRAMEWORK=flask gunicorn --reload main
```
Project structure:
```
context-1
domain
entities
value_objects
aggregates
services
repositories
factories?
interfaces
events
application
services
infrastructure
??
tests??
context-2
context-3
di_setup
main - main entrypoint to the app
```
Domain artifacts
* entities - mutable, identifiable, unaware of persistance
* value objects - immutable, self-contained
* aggregates - any transaction should modify only one aggegate at a time, 70-80% usually contain olny one entity, consistency boundary, hosts methods which will modify the aggregate
* events - significant state transition, something which domain experts care about
* factories - for entity construction, ubiquotous language verbs, hide construction details (Python function)
* repositories - store aggregates, abstraction over persistence mehanism
* context maps - mappings between concepts between bounded contexts
TODO:
* event bus? for domain
References:
* https://skillsmatter.com/skillscasts/5025-domain-driven-design-with-python(python-ddd)