Compare commits
No commits in common. "a22d8becbbc1b81fbb299e1c88bbe339ab3219ca" and "7342516ce77cdcdfc1aeee195ad4e1a0442a6a1e" have entirely different histories.
a22d8becbb
...
7342516ce7
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -8,7 +8,6 @@
|
|||||||
"checkpw",
|
"checkpw",
|
||||||
"jsonify",
|
"jsonify",
|
||||||
"lastrowid",
|
"lastrowid",
|
||||||
"rtype",
|
"rtype"
|
||||||
"flasgger"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
from flask import jsonify, abort, request
|
from flask import jsonify, abort, request
|
||||||
from flask_jwt_extended import jwt_required, get_jwt_identity
|
from flask_jwt_extended import jwt_required, get_jwt_identity
|
||||||
|
|
||||||
from app.doc.product_swag import get_products_swagger, get_product_info_swagger, create_product_swagger
|
from app.doc.product_swag import get_products_swagger, get_product_info_swagger
|
||||||
|
|
||||||
from flasgger import swag_from
|
from flasgger import swag_from
|
||||||
|
|
||||||
@ -39,7 +39,6 @@ def get_product_info(id: int):
|
|||||||
|
|
||||||
|
|
||||||
@bp_product.route('/create', methods=['POST'])
|
@bp_product.route('/create', methods=['POST'])
|
||||||
@swag_from(create_product_swagger)
|
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def create_product_listing():
|
def create_product_listing():
|
||||||
user_id = get_jwt_identity()
|
user_id = get_jwt_identity()
|
||||||
|
@ -4,7 +4,7 @@ from flask import request, abort
|
|||||||
|
|
||||||
from flasgger import swag_from
|
from flasgger import swag_from
|
||||||
|
|
||||||
from app.doc.user_swag import login_swagger, logout_swagger, delete_swagger
|
from app.doc.user_swag import login_swagger
|
||||||
|
|
||||||
from app.services.user_service import UserService
|
from app.services.user_service import UserService
|
||||||
|
|
||||||
@ -36,7 +36,6 @@ def login():
|
|||||||
return result, status_code
|
return result, status_code
|
||||||
|
|
||||||
@bp_user.route('/logout', methods=['DELETE'])
|
@bp_user.route('/logout', methods=['DELETE'])
|
||||||
@swag_from(logout_swagger)
|
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def logout():
|
def logout():
|
||||||
jwt = get_jwt()
|
jwt = get_jwt()
|
||||||
@ -125,7 +124,6 @@ def update_password():
|
|||||||
return result, status_code
|
return result, status_code
|
||||||
|
|
||||||
@bp_user.route('/delete', methods=['DELETE'])
|
@bp_user.route('/delete', methods=['DELETE'])
|
||||||
@swag_from(delete_swagger)
|
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
def delete_user():
|
def delete_user():
|
||||||
user_id = get_jwt_identity()
|
user_id = get_jwt_identity()
|
||||||
|
@ -10,7 +10,6 @@ class MySqlConfig:
|
|||||||
class RedisConfig:
|
class RedisConfig:
|
||||||
REDIS_HOST = os.environ.get('REDIS_HOST')
|
REDIS_HOST = os.environ.get('REDIS_HOST')
|
||||||
REDIS_PORT = os.environ.get('REDIS_PORT')
|
REDIS_PORT = os.environ.get('REDIS_PORT')
|
||||||
REDIS_PASSWORD = os.environ.get('REDIS_PASSWORD')
|
|
||||||
|
|
||||||
class FlaskProduction:
|
class FlaskProduction:
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
@ -44,30 +44,3 @@ get_product_info_swagger = {
|
|||||||
"500": {"description": "Internal Server Error"}
|
"500": {"description": "Internal Server Error"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
create_product_swagger = {
|
|
||||||
"methods": ["POST"],
|
|
||||||
"tags": ["Products"],
|
|
||||||
"security": [{"JWT": []}],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"in": "body",
|
|
||||||
"type": "string",
|
|
||||||
"description": "Name for the new product",
|
|
||||||
"required": True
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "price",
|
|
||||||
"in": "body",
|
|
||||||
"type": "float",
|
|
||||||
"description": "Price of the product",
|
|
||||||
"required": True
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {"description": "Successfully fetched product information"},
|
|
||||||
"400": {"description": "Bad Request - Invalid input or missing input"},
|
|
||||||
"500": {"description": "Internal Server Error"}
|
|
||||||
}
|
|
||||||
}
|
|
@ -42,34 +42,4 @@ login_swagger = {
|
|||||||
"description": "Password is incorrect"
|
"description": "Password is incorrect"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
logout_swagger = {
|
|
||||||
"methods": ["DELETE"],
|
|
||||||
"tags": ["User"],
|
|
||||||
"security": [{"JWT": []}],
|
|
||||||
"description": "Logs out the user via provided JWT token",
|
|
||||||
"parameters": [],
|
|
||||||
"responses":
|
|
||||||
{
|
|
||||||
"200":
|
|
||||||
{
|
|
||||||
"description": "User successfully logged out"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete_swagger = {
|
|
||||||
"methods": ["DELETE"],
|
|
||||||
"tags": ["User"],
|
|
||||||
"security": [{"JWT": []}],
|
|
||||||
"description": "Deletes a user via JWT token",
|
|
||||||
"parameters": [],
|
|
||||||
"responses":
|
|
||||||
{
|
|
||||||
"200":
|
|
||||||
{
|
|
||||||
"description": "User successfully deleted out"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -15,7 +15,6 @@ db_connection = mysql.connector.connect(
|
|||||||
jwt_redis_blocklist = redis.StrictRedis(
|
jwt_redis_blocklist = redis.StrictRedis(
|
||||||
host=RedisConfig.REDIS_HOST,
|
host=RedisConfig.REDIS_HOST,
|
||||||
port=RedisConfig.REDIS_PORT,
|
port=RedisConfig.REDIS_PORT,
|
||||||
password=RedisConfig.REDIS_PASSWORD,
|
|
||||||
db=0,
|
db=0,
|
||||||
decode_responses=True
|
decode_responses=True
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user