|
@@ -1,4 +1,3 @@
|
|
|
-import this
|
|
|
from function import QueryFunc
|
|
|
|
|
|
restfunc = QueryFunc()
|
|
@@ -16,7 +15,7 @@ class SharixQuery:
|
|
|
''', (request_data['login_email'], request_data['login_email'], request_data['password'],), True)
|
|
|
return generate_return_data(result, 200)
|
|
|
except Exception as ex:
|
|
|
- return {"data": {"msg":str(ex)}, "httpcode": 500}
|
|
|
+ return generate_return_data({"msg":str(ex)}, 500)
|
|
|
|
|
|
def add_query(self, request_data):
|
|
|
try:
|
|
@@ -75,7 +74,7 @@ class SharixQuery:
|
|
|
|
|
|
def update_user_query(self, request_data, id):
|
|
|
try:
|
|
|
- result = restfunc.query_delete_update(f'''
|
|
|
+ result = restfunc.query_delete_update('''
|
|
|
UPDATE rest_user
|
|
|
SET name = %s
|
|
|
WHERE id = %s;
|
|
@@ -86,4 +85,17 @@ class SharixQuery:
|
|
|
return generate_return_data({"msg":"User does not exist!"}, 400)
|
|
|
except Exception as ex:
|
|
|
return generate_return_data({"msg":str(ex)}, 500)
|
|
|
+
|
|
|
+ def add_car_log(self, request_data):
|
|
|
+ try:
|
|
|
+ result = restfunc.query_insert('''
|
|
|
+ INSERT INTO cars_log (id, resource_id, operation, time_log_created, user_id)
|
|
|
+ VALUES(%s, %s, %s, %s, %s)
|
|
|
+ RETURNING id;
|
|
|
+ ''', (8, 3, request_data['operation'], request_data['date_cur'], 1))
|
|
|
+ return generate_return_data(result, 201)
|
|
|
+ except Exception as ex:
|
|
|
+ return generate_return_data({"msg":str(ex)}, 500)
|
|
|
+
|
|
|
+
|
|
|
|