from flask import Blueprint, request, jsonify from core.bll import bllengine from flask_cors import cross_origin from flask_jwt_extended import create_access_token, get_jwt, jwt_required from reqhandlers.blocklist import BLOCKLIST import datetime from datetime import timedelta import uuid dbcountry = Blueprint('dbcountry', __name__) @dbcountry.route('/dbcountry/reqtest') def retest(): return "success" # 1.1. Create @dbcountry.route('/dbcountry/create', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def createdbcountry(): uuid_number=uuid_number=uuid.uuid4().hex print("uuid number",uuid_number) print(uuid_number) req = request.json print("values for insert",req, uuid_number) req['requestdata']['id']=uuid_number resp = bllengine.dbcountry_processcreate(req) return jsonify(resp) # 1.2. Read One Conditional @dbcountry.route('/dbcountry/readonecond', methods=["POST"]) @cross_origin() ##@jwt_required() #@cache.cached(timeout=50) def readOnedbcountrywithCondition(): req = request.json resp = bllengine.dbcountry_processreadonecond(req) return jsonify(resp) # 1.3. Read Multiple Conditional @dbcountry.route('/dbcountry/readmanycond', methods=["POST"]) @cross_origin() ##@jwt_required() #@cache.cached(timeout=50) def reaManydbcountrywithCond(): req = request.json resp = bllengine.dbcountry_processreadmanycond(req) return jsonify(resp) # 1.4. Read All @dbcountry.route('/dbcountry/readall', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def readManydbcountrywithoutCond(): req = request.json resp = bllengine.dbcountry_processreadall(req) return jsonify(resp) # 1.5. Delete One Conditional @dbcountry.route('/dbcountry/deleteonecond', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def deleteOnedbcountrywithcondition(): req = request.json resp = bllengine.dbcountry_processdeleteonecond(req) return jsonify(resp) # 1.6. Update One Conditional @dbcountry.route('/dbcountry/updateonecond', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def updateonedbcountrywithcondition(): req = request.json resp = bllengine.dbcountry_processupdateonecond(req) return jsonify(resp) """"# 1.7. Update All @dbcountry.route('/dbcountry/updateall', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def createdbcountry(): req = request.json resp = bllengine.dbcountry_processupdateall(req) return jsonify(resp) """