dbilayer_cassandra/reqhandlers/dbgst.py
2023-04-21 10:39:08 +05:30

97 lines
2.4 KiB
Python

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
dbgst = Blueprint('dbgst', __name__)
@dbgst.route('/dbgst/reqtest')
def retest():
return "success"
# 1.1. Create
@dbgst.route('/dbgst/create', methods=["POST"])
@cross_origin()
##@jwt_required()
#@cache.cached(timeout=50)
def createdbgst():
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.dbgst_processcreate(req)
return jsonify(resp)
# 1.2. Read One Conditional
@dbgst.route('/dbgst/readonecond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def readOnedbgstwithCondition():
req = request.json
resp = bllengine.dbgst_processreadonecond(req)
return jsonify(resp)
# 1.3. Read Multiple Conditional
@dbgst.route('/dbgst/readmanycond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def reaManydbgstwithCond():
req = request.json
resp = bllengine.dbgst_processreadmanycond(req)
return jsonify(resp)
# 1.4. Read All
@dbgst.route('/dbgst/readall', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def readManydbgstwithoutCond():
req = request.json
resp = bllengine.dbgst_processreadmanywithoutcond(req)
return jsonify(resp)
# 1.5. Delete One Conditional
@dbgst.route('/dbgst/deleteonecond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def deleteOnedbgstwithcondition():
req = request.json
resp = bllengine.dbgst_processdeleteonecond(req)
return jsonify(resp)
# 1.6. Update One Conditional
@dbgst.route('/dbgst/updateonecond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def updateonedbgstwithcondition():
req = request.json
resp = bllengine.dbgst_processupdateonecond(req)
return jsonify(resp)
""""# 1.7. Update All
@dbgst.route('/dbgst/updateall', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def createdbgst():
req = request.json
resp = bllengine.dbgst_processupdateall(req)
return jsonify(resp)
"""