Skip to content

Commit

Permalink
migrated polls
Browse files Browse the repository at this point in the history
  • Loading branch information
epomatti committed May 28, 2022
1 parent 0348621 commit 4f8bc77
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 155 deletions.
1 change: 1 addition & 0 deletions microservices/poll/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cerberus = "*"
azure-keyvault-secrets = "*"
azure-identity = "*"
msal = "*"
epomatti-aksmrc-core = "*"

[dev-packages]
autopep8 = "*"
Expand Down
61 changes: 35 additions & 26 deletions microservices/poll/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 3 additions & 14 deletions microservices/poll/src/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import request, Flask

from src.validators import validate_schema
from epomatti_aksmrc_core import validators
from src.schemas import pool_schema, increment_schema
from src import repository

Expand All @@ -17,7 +17,7 @@ def readyness():


@app.route(BASE_PATH, methods=['POST'])
@validate_schema(schema=pool_schema)
@validators.validate_schema(schema=pool_schema)
def post():
result = repository.create_poll(request.get_json())
return {"id": str(result.inserted_id)}, 201
Expand All @@ -41,22 +41,11 @@ def get(id):


@app.route(f"{BASE_PATH}/inc", methods=['PATCH'])
@validate_schema(schema=increment_schema)
@validators.validate_schema(schema=increment_schema)
def increment():
id = request.get_json()['id']
repository.increment_votes(id)
return ''

# TODO: implement
# @app.route(f"{BASE_PATH}/val", methods=['POST'])
# @validate_schema(schema=increment_schema)
# def validate():
# val_json = request.get_json()
# id = val_json['id']
# option = val_json['option']
# repository.increment_votes(id)
# return ''


def create_app():
return app
21 changes: 0 additions & 21 deletions microservices/poll/src/keyvault.py

This file was deleted.

13 changes: 0 additions & 13 deletions microservices/poll/src/mongo.py

This file was deleted.

21 changes: 0 additions & 21 deletions microservices/poll/src/msal.py

This file was deleted.

2 changes: 1 addition & 1 deletion microservices/poll/src/repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from bson import ObjectId
from . import mongo
from epomatti_aksmrc_core import mongo


def create_poll(poll):
Expand Down
39 changes: 0 additions & 39 deletions microservices/poll/src/token_credential.py

This file was deleted.

2 changes: 0 additions & 2 deletions microservices/poll/src/utils.py

This file was deleted.

18 changes: 0 additions & 18 deletions microservices/poll/src/validators.py

This file was deleted.

0 comments on commit 4f8bc77

Please sign in to comment.