Add json object for environment info for each function, this is mutable from custom code
This commit is contained in:
12
db.py
12
db.py
@@ -48,21 +48,21 @@ class DataBase():
|
||||
|
||||
def get_http_functions(self):
|
||||
http_functions = self.execute(
|
||||
'SELECT id, NAME, script_content, invoked_count FROM http_functions', [])
|
||||
'SELECT id, NAME, script_content, invoked_count, environment_info FROM http_functions ORDER by id DESC', [])
|
||||
return http_functions
|
||||
|
||||
def get_http_function(self, name):
|
||||
http_function = self.execute(
|
||||
'SELECT id, NAME, script_content, invoked_count FROM http_functions WHERE NAME=%s', [name], one=True)
|
||||
'SELECT id, NAME, script_content, invoked_count, environment_info FROM http_functions WHERE NAME=%s', [name], one=True)
|
||||
return http_function
|
||||
|
||||
def create_new_http_function(self, name, script_content):
|
||||
def create_new_http_function(self, name, script_content, environment_info):
|
||||
self.execute(
|
||||
'INSERT INTO http_functions (NAME, script_content) VALUES (%s, %s)', [name, script_content], commit=True)
|
||||
'INSERT INTO http_functions (NAME, script_content, environment_info) VALUES (%s, %s, %s)', [name, script_content, environment_info], commit=True)
|
||||
|
||||
def edit_http_function(self, name, script_content):
|
||||
def edit_http_function(self, name, script_content, environment_info):
|
||||
self.execute(
|
||||
'UPDATE http_functions SET script_content=%s WHERE NAME=%s', [script_content, name], commit=True)
|
||||
'UPDATE http_functions SET script_content=%s, environment_info=%s WHERE NAME=%s', [script_content, environment_info, name], commit=True)
|
||||
|
||||
def delete_http_function(self, name):
|
||||
self.execute(
|
||||
|
||||
Reference in New Issue
Block a user