- Add configuration of agents, tasks, tools, specialist in context of SPIN specialist
- correct startup of applications using gevent - introduce startup scripts (eveai_app) - caching manager for all configurations
This commit is contained in:
30
common/utils/model_logging_utils.py
Normal file
30
common/utils/model_logging_utils.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from flask_security import current_user
|
||||
|
||||
|
||||
def set_logging_information(obj, timestamp):
|
||||
obj.created_at = timestamp
|
||||
obj.updated_at = timestamp
|
||||
|
||||
user_id = get_current_user_id()
|
||||
if user_id:
|
||||
obj.created_by = user_id
|
||||
obj.updated_by = user_id
|
||||
|
||||
|
||||
def update_logging_information(obj, timestamp):
|
||||
obj.updated_at = timestamp
|
||||
|
||||
user_id = get_current_user_id()
|
||||
if user_id:
|
||||
obj.updated_by = user_id
|
||||
|
||||
|
||||
def get_current_user_id():
|
||||
try:
|
||||
if current_user and current_user.is_authenticated:
|
||||
return current_user.id
|
||||
else:
|
||||
return None
|
||||
except Exception:
|
||||
# This will catch any errors if current_user is not available (e.g., in API context)
|
||||
return None
|
||||
Reference in New Issue
Block a user