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 dbusername = Blueprint('dbusername', __name__) @dbusername.route('/dbusername/reqtest') def retest(): return "success" # 1.1. Create @dbusername.route('/dbusername/create', methods=["POST"]) @cross_origin() # @jwt_required() #@cache.cached(timeout=50) def createdbusername(): 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.dbusername_processcreate(req) return jsonify(resp) # 1.2. Read One Conditional @dbusername.route('/dbusername/readonecond', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def readOnedbusernamewithCondition(): req = request.json resp = bllengine.dbusername_processreadonecond(req) return jsonify(resp) # 1.3. Read Multiple Conditional @dbusername.route('/dbusername/readmanycond', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def reaManydbusernamewithCond(): req = request.json resp = bllengine.dbusername_processreadmanycond(req) return jsonify(resp) # 1.4. Read All @dbusername.route('/dbusername/readall', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def readManydbusernamewithoutCond(): req = request.json resp = bllengine.dbusername_processreadall(req) return jsonify(resp) # 1.5. Delete One Conditional @dbusername.route('/dbusername/deleteonecond', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def deleteOnedbusernamewithcondition(): req = request.json resp = bllengine.dbusername_processdeleteonecond(req) return jsonify(resp) # 1.6. Update One Conditional @dbusername.route('/dbusername/updateonecond', methods=["POST"]) @cross_origin() #@jwt_required() #@cache.cached(timeout=50) def updateonedbusernamewithcondition(): req = request.json resp = bllengine.dbusername_processupdateonecond(req) return jsonify(resp) """"# 1.7. Update All @dbusername.route('/dbusername/updateall', methods=["POST"]) @cross_origin() @jwt_required() #@cache.cached(timeout=50) async def createdbusername(): req = request.json resp = bllengine.dbusername_processupdateall(req) return jsonify(resp) """