107 lines
3.7 KiB
Python
107 lines
3.7 KiB
Python
from flask import jsonify
|
|
from app.utils.logger import logger
|
|
from app.api.services.base_service import BaseService
|
|
from sqlalchemy import func, desc
|
|
from datetime import datetime, timedelta, timezone
|
|
from app.extensions import db
|
|
from app.models import OfficeUsers
|
|
|
|
|
|
class OfficeTemplatesService(BaseService):
|
|
|
|
@staticmethod
|
|
def set_office_custom_template(data):
|
|
logger.info('set_office_custom_template')
|
|
try:
|
|
# office_users = OfficeUsers.get_office_users_list()
|
|
# office_users_data = []
|
|
# if office_users:
|
|
# for t in office_users:
|
|
# office_users_data.append({
|
|
# 'id': t.id,
|
|
# 'uid': t.uid,
|
|
# 'username': t.username,
|
|
# 'firstname': t.firstname,
|
|
# 'lastname': t.lastname,
|
|
# 'acc_level': t.acc_level,
|
|
# 'status': t.status,
|
|
# 'added': t.added.isoformat() if t.added else None
|
|
# })
|
|
|
|
office_users_result = {
|
|
"set_office_custom_template": [],
|
|
}
|
|
return office_users_result
|
|
|
|
except Exception as e:
|
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
office_users_result = {
|
|
"error": f"An error occurred: {str(e)}",
|
|
}
|
|
return office_users_result
|
|
|
|
|
|
@staticmethod
|
|
def set_office_user_template(data):
|
|
logger.info('set_office_user_template')
|
|
try:
|
|
# office_users = OfficeUsers.get_office_users_list()
|
|
# office_users_data = []
|
|
# if office_users:
|
|
# for t in office_users:
|
|
# office_users_data.append({
|
|
# 'id': t.id,
|
|
# 'uid': t.uid,
|
|
# 'username': t.username,
|
|
# 'firstname': t.firstname,
|
|
# 'lastname': t.lastname,
|
|
# 'acc_level': t.acc_level,
|
|
# 'status': t.status,
|
|
# 'added': t.added.isoformat() if t.added else None
|
|
# })
|
|
|
|
office_users_result = {
|
|
"set_office_user_template": [],
|
|
}
|
|
return office_users_result
|
|
|
|
except Exception as e:
|
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
office_users_result = {
|
|
"error": f"An error occurred: {str(e)}",
|
|
}
|
|
return office_users_result
|
|
|
|
|
|
|
|
@staticmethod
|
|
def create_custom_template(data):
|
|
logger.info('create_custom_template')
|
|
try:
|
|
# office_users = OfficeUsers.get_office_users_list()
|
|
# office_users_data = []
|
|
# if office_users:
|
|
# for t in office_users:
|
|
# office_users_data.append({
|
|
# 'id': t.id,
|
|
# 'uid': t.uid,
|
|
# 'username': t.username,
|
|
# 'firstname': t.firstname,
|
|
# 'lastname': t.lastname,
|
|
# 'acc_level': t.acc_level,
|
|
# 'status': t.status,
|
|
# 'added': t.added.isoformat() if t.added else None
|
|
# })
|
|
|
|
office_users_result = {
|
|
"set_office_user_template": [],
|
|
}
|
|
return office_users_result
|
|
|
|
except Exception as e:
|
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
office_users_result = {
|
|
"error": f"An error occurred: {str(e)}",
|
|
}
|
|
return office_users_result
|