dbilayer_cassandra/reqhandlers/dbtype.py

96 lines
2.4 KiB
Python
Raw Permalink Normal View History

2023-04-03 17:17:27 +05:30
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
2023-04-21 10:39:08 +05:30
import uuid
2023-04-03 17:17:27 +05:30
dbtype = Blueprint('dbtype', __name__)
@dbtype.route('/dbtype/reqtest')
def retest():
return "success"
# 1.1. Create
@dbtype.route('/dbtype/create', methods=["POST"])
@cross_origin()
##@jwt_required()
#@cache.cached(timeout=50)
def createdbtype():
2023-04-21 10:39:08 +05:30
uuid_number=uuid_number=uuid.uuid4().hex
print("uuid number",uuid_number)
print(uuid_number)
2023-04-03 17:17:27 +05:30
req = request.json
2023-04-21 10:39:08 +05:30
print("values for insert",req, uuid_number)
req['requestdata']['id']=uuid_number
2023-04-03 17:17:27 +05:30
resp = bllengine.dbtype_processcreate(req)
return jsonify(resp)
# 1.2. Read One Conditional
@dbtype.route('/dbtype/readonecond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def readOnedbtypewithCondition():
req = request.json
resp = bllengine.dbtype_processreadonecond(req)
return jsonify(resp)
# 1.3. Read Multiple Conditional
@dbtype.route('/dbtype/readmanycond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def reaManydbtypewithCond():
req = request.json
resp = bllengine.dbtype_processreadmanycond(req)
return jsonify(resp)
# 1.4. Read All
@dbtype.route('/dbtype/readall', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def readManydbtypewithoutCond():
req = request.json
resp = bllengine.dbtype_processreadall(req)
return jsonify(resp)
# 1.5. Delete One Conditional
@dbtype.route('/dbtype/deleteonecond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def deleteOnedbtypewithcondition():
req = request.json
resp = bllengine.dbtype_processdeleteonecond(req)
return jsonify(resp)
# 1.6. Update One Conditional
@dbtype.route('/dbtype/updateonecond', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def updateonedbtypewithcondition():
req = request.json
resp = bllengine.dbtype_processupdateonecond(req)
return jsonify(resp)
""""# 1.7. Update All
@dbtype.route('/dbtype/updateall', methods=["POST"])
@cross_origin()
#@jwt_required()
#@cache.cached(timeout=50)
def createdbtype():
req = request.json
resp = bllengine.dbtype_processupdateall(req)
return jsonify(resp)
"""