diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index ee8ef62..b8b4b32 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -540,6 +540,7 @@ def start_resetpass(): connection.commit() # last_row_id=cursor.lastrowid + send_resetpass_mail('ameye@chiefsoft.com') # return jsonify(hello="ameye reset path world", last_row_id=last_row_id) return jsonify(hello="ameye reset path world") @@ -643,11 +644,28 @@ def recent_bar(current_user): } return jsonify(bar_data=bar_data) -# "initial": random.randint(0, 10), -# "processing": random.randint(0, 10), -# "verifying" : random.randint(0, 10), -# "completed" : random.randint(0, 10), -# +@app.route("/panel/account/calendar") +@token_required +def calendar_data(current_user): +# let send 60 days of data in only - cache heavy + bar_data = { + "last_update": datetime.datetime.utcnow(), + "category": [ + {"cid": "1", "description": "category 01" }, + {"cid": "2", "description": "category 02" }, + {"cid": "3", "description": "category 03" }, + {"cid": "4", "description": "category 04" }, + ], + "list": [ + {"id": "1", "description": "Contacts" , "last_update": "10-10-2010 11:00 AM", "value": random.randint(0, 10) , "data_span":'Last 2 months'}, + {"id": "2", "description": "Site Traffic" , "last_update": "10-10-2010 11:30 AM", "value": random.randint(0, 10), "data_span":'Past 12 hours'}, + {"id": "3", "description": "Appointments" , "last_update": "10-12-2010 11:30 AM", "value": random.randint(0, 10), "data_span":'Last 14 days'}, + {"id": "4", "description": "Purchases" , "last_update": "10-12-2010 11:30 AM", "value": random.randint(0, 10), "data_span":'Last 3 months'}, + ] + } + return jsonify(bar_data=bar_data) + + @app.route("/panel/account/actions") @token_required def recent_actions(current_user): @@ -657,7 +675,12 @@ def recent_actions(current_user): # RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id = " + user_id + " ORDER by id DESC LIMIT 4" # RECENT_ACTIONS = "SELECT * FROM members_actions WHERE member_id::text = %s ORDER by id DESC LIMIT 4" # print(user_id) - RECENT_ACTIONS = f"SELECT id AS no,action_label AS description,added::text AS date,status FROM members_actions WHERE member_id = {user_id} ORDER by id DESC LIMIT 4" + RECENT_ACTIONS = f"""SELECT id AS no, + action_label AS description, + added::text AS date,status + FROM members_actions + WHERE member_id = {user_id} + ORDER by id DESC LIMIT 4""" actionVal = (user_id) with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: cursor.execute(RECENT_ACTIONS) @@ -680,12 +703,6 @@ def recent_actions(current_user): } return jsonify(action_data=action_data, recent_actions=array3) -# "actions2": [ -# {"no": "1", "description": "Welcome to MERMS" , "date": "10-10-2010 11:00 AM", "status": 'completed'}, -# {"no": "2", "description": "Personal Blog Setup" , "date": "10-10-2010 11:30 AM", "status": 'processing'}, -# {"no": "3", "description": "Web Traffic Analysis" , "date": "10-12-2010 11:30 AM", "status": 'verifying'}, -# ], -# @app.route("/panel/account/products/url") @token_required def product_urls(current_user):