update
This commit is contained in:
@@ -1,12 +1,40 @@
|
|||||||
|
from flask import Blueprint, request, jsonify, send_from_directory
|
||||||
from flask import Blueprint, request, jsonify
|
from flask import Blueprint, request, jsonify
|
||||||
from app.api.services.loan import LoanService
|
from app.api.services.loan import LoanService
|
||||||
from app.api.services.transaction import TransactionService
|
from app.api.services.transaction import TransactionService
|
||||||
from app.api.services.auth_service import AuthService
|
from app.api.services.auth_service import AuthService
|
||||||
from app.api.services.dashboard_service import DashboardService
|
from app.api.services.dashboard_service import DashboardService
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
from app.utils.logger import logger
|
||||||
|
from app.api.middlewares import enforce_json, require_auth
|
||||||
|
import os
|
||||||
|
from flask_jwt_extended import (
|
||||||
|
JWTManager,
|
||||||
|
jwt_required,
|
||||||
|
create_access_token,
|
||||||
|
get_jwt_identity,
|
||||||
|
create_refresh_token,
|
||||||
|
)
|
||||||
|
|
||||||
api = Blueprint('api', __name__)
|
api = Blueprint('api', __name__)
|
||||||
|
|
||||||
|
@api.before_request
|
||||||
|
def cors_middleware():
|
||||||
|
"""Middleware applied globally to all API routes in this blueprint"""
|
||||||
|
return enforce_json()
|
||||||
|
|
||||||
|
|
||||||
|
# Swagger JSON file
|
||||||
|
@api.route("/swagger.json", methods=["GET"])
|
||||||
|
def swagger_json():
|
||||||
|
swagger_dir = os.path.join("swagger")
|
||||||
|
return send_from_directory(swagger_dir, "digifi_swagger.json")
|
||||||
|
|
||||||
|
|
||||||
|
@api.route("/swagger/<path:filename>")
|
||||||
|
def serve_paths(filename):
|
||||||
|
swagger_dir = os.path.join("swagger")
|
||||||
|
return send_from_directory(swagger_dir, filename)
|
||||||
|
|
||||||
# JWT Authentication decorator
|
# JWT Authentication decorator
|
||||||
def token_required(f):
|
def token_required(f):
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ class Config:
|
|||||||
"""Base configuration for Flask app"""
|
"""Base configuration for Flask app"""
|
||||||
|
|
||||||
SWAGGER_URL = os.getenv("SWAGGER_URL", "/documentation")
|
SWAGGER_URL = os.getenv("SWAGGER_URL", "/documentation")
|
||||||
API_URL = os.getenv("API_URL", "/swagger.json")
|
API_URL = os.getenv("API_URL", "/digifi_swagger.json")
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
VALID_APP_ID = os.getenv("VALID_APP_ID", "app1")
|
VALID_APP_ID = os.getenv("VALID_APP_ID", "app1")
|
||||||
|
|||||||
Reference in New Issue
Block a user