Skip to content

Commit 73e44a9

Browse files
committed
Final.
1 parent ac2e9f4 commit 73e44a9

File tree

5 files changed

+81
-4
lines changed

5 files changed

+81
-4
lines changed

Tests/run.ps1

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@
1010
# python main.py --type level2 --with-authentication --authentication-url http://127.0.0.1:5000 --customer-url http://127.0.0.1:5002 --courier-url http://127.0.0.1:5003
1111
# python main.py --type level3 --with-authentication --authentication-url http://127.0.0.1:5000 --owner-url http://127.0.0.1:5001 --customer-url http://127.0.0.1:5002 --courier-url http://127.0.0.1:5003
1212
python main.py --type all --authentication-url http://127.0.0.1:5000 --jwt-secret JWT_SECRET_DEV_KEY --roles-field roles --owner-role owner --customer-role customer --courier-role courier --with-authentication --owner-url http://127.0.0.1:5001 --customer-url http://127.0.0.1:5002 --courier-url http://127.0.0.1:5003
13-
# docker-compose -f deployment.yaml up -d
14-
# docker-compose -f deployment.yaml down -v
13+
14+
docker-compose -f deployment.yaml up -d
15+
docker-compose -f deployment.yaml down -v
16+
17+
# baza server http://localhost:8080/
18+
# Server: storeDb:3306
19+
# Username: root
20+
# Password: root
1521

1622
# TESTS WITH BLOCKCHAIN
1723

deployment.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ services:
1919
- authVolume:/var/lib/mysql
2020

2121
authDbMigration:
22+
build:
23+
context: .
24+
dockerfile: authDbMigration.dockerfile
2225
image: authdbmigration
2326
environment:
2427
- DATABASE_URL=authDb
@@ -30,6 +33,9 @@ services:
3033
- authNet
3134

3235
auth:
36+
build:
37+
context: .
38+
dockerfile: auth.dockerfile
3339
image: auth
3440
environment:
3541
- DATABASE_URL=authDb
@@ -57,6 +63,9 @@ services:
5763
- storeVolume:/var/lib/mysql
5864

5965
storeDbMigration:
66+
build:
67+
context: .
68+
dockerfile: storeDbMigration.dockerfile
6069
image: storedbmigration
6170
environment:
6271
- DATABASE_URL=storeDb
@@ -67,6 +76,9 @@ services:
6776
- storeNet
6877

6978
customer:
79+
build:
80+
context: .
81+
dockerfile: customer.dockerfile
7082
image: customer
7183
environment:
7284
- DATABASE_URL=storeDb
@@ -78,6 +90,9 @@ services:
7890
- storeNet
7991

8092
courier:
93+
build:
94+
context: .
95+
dockerfile: courier.dockerfile
8196
image: courier
8297
environment:
8398
- DATABASE_URL=storeDb
@@ -88,7 +103,24 @@ services:
88103
networks:
89104
- storeNet
90105

106+
money:
107+
build:
108+
context: .
109+
dockerfile: money.dockerfile
110+
image: money
111+
environment:
112+
- DATABASE_URL=storeDb
113+
depends_on:
114+
- storeDbMigration
115+
ports:
116+
- "5004:5004"
117+
networks:
118+
- storeNet
119+
91120
owner:
121+
build:
122+
context: .
123+
dockerfile: owner.dockerfile
92124
image: owner
93125
environment:
94126
- DATABASE_URL=storeDb

money.dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:3
2+
3+
RUN mkdir -p /opt/src/shop
4+
WORKDIR /opt/src/shop
5+
6+
COPY shop/models.py ./models.py
7+
COPY shop/configuration.py ./configuration.py
8+
COPY shop/decoraterRole.py ./decoraterRole.py
9+
COPY shop/appMoney.py ./appMoney.py
10+
COPY shop/requirements.txt ./requirements.txt
11+
12+
RUN pip install -r ./requirements.txt
13+
14+
ENV PYTHONPATH="/opt/src/shop"
15+
16+
ENTRYPOINT ["python", "./appMoney.py"]

shop/appMoney.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
3+
from flask import Flask, Response, request
4+
from flask_jwt_extended import JWTManager, get_jwt_identity
5+
from sqlalchemy import and_, func, desc, select, alias, join
6+
7+
from configuration import Configuration
8+
from decoraterRole import roleCheck
9+
from models import database, Order, OrderStatus, Status, ProductOrder, ProductCategory, Category, Product
10+
11+
app = Flask(__name__)
12+
app.config.from_object(Configuration)
13+
jwt = JWTManager(app)
14+
15+
16+
@app.route("/money", methods=["GET"])
17+
def getMoney():
18+
return Response(json.dumps({}))
19+
20+
21+
if __name__ == "__main__":
22+
database.init_app(app)
23+
app.run(debug=True, host="0.0.0.0", port=5004)

shop/decoraterRole.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from functools import wraps
2-
from flask_jwt_extended import verify_jwt_in_request, get_jwt;
3-
from flask import jsonify;
2+
from flask_jwt_extended import verify_jwt_in_request, get_jwt
3+
from flask import jsonify
44

55

66
def roleCheck(role):

0 commit comments

Comments
 (0)