From e51f2a3a66bc3f4a8b453d77b8d8330b15317259 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 14 Dec 2024 05:33:10 -0500 Subject: [PATCH] added swagger --- services/web/project/__init__.py | 33 +++++++++++++++++++++++++++++++- services/web/requirements.txt | 3 ++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index 5a8475a..c95dcf0 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -10,7 +10,7 @@ import project.validate.validate as validate #import project.models.members as Members from project.models.members import Members from flask_cors import CORS - +from flasgger import Swagger #from models.models import User @@ -32,6 +32,25 @@ app.config.from_object("project.config.Config") db = SQLAlchemy(app) app.config['SECRET_KEY'] ='thisisourwondefulkey' + +template = { + "swagger": "2.0", + "info": { + "title": "MERMS Core API", + "description": "This API was developed using Python Flask, which provides an interface for producing and consuming messages with Apache Kafka topics via HTTP endpoints.", + "version": "1.0" + } + } + +app.config['SWAGGER'] = { + 'title': 'Flask Kafka API', + 'uiversion': 2, + 'template': './resources/flasgger/swagger_ui.html' + } + +Swagger(app, template=template) + + def token_required(f): @wraps(f) def decorated(*args, **kwargs): @@ -247,3 +266,15 @@ def account_payments(current_user): } return jsonify(payments_data=payments_data) ##. Description Date Status "10-10-2021 10 AM" + +@app.route("/panel/myproduct/dash") +@token_required +def myproduct(current_user): + dash_data = { + "username": "sanyaameye", + "account_name": "This is the test account name", + "firstname": "TestFirstname", + "lastname" : "Testlastname", + "email": "bestemail@email.com" + } + return jsonify(dash_data=dash_data) \ No newline at end of file diff --git a/services/web/requirements.txt b/services/web/requirements.txt index 798f325..5f4ae5e 100644 --- a/services/web/requirements.txt +++ b/services/web/requirements.txt @@ -7,4 +7,5 @@ python-dotenv pyjwt pillow flask-cors -pandas \ No newline at end of file +pandas +flasgger \ No newline at end of file