Template services
This commit is contained in:
@@ -13,7 +13,7 @@ from app.api.services import (
|
||||
SubscriptionsService,
|
||||
CommonDataService,
|
||||
OfficeCustomerService,
|
||||
GenerativesService, OfficeUsersService
|
||||
GenerativesService, OfficeUsersService, OfficeTemplatesService
|
||||
)
|
||||
from app.api.services.comments import CommentsService
|
||||
from app.utils.logger import logger
|
||||
@@ -418,24 +418,18 @@ def get_subcriptions_view_office():
|
||||
@api.route('/office/template/set-custom', methods=['POST'])
|
||||
# @token_required
|
||||
def get_set_custom_template_office():
|
||||
# Call the dashboard service
|
||||
filters = {
|
||||
'subscription_uid': request.args.get('subscription_uid')
|
||||
}
|
||||
data = request.get_json()
|
||||
|
||||
response = []
|
||||
response = OfficeTemplatesService.set_office_custom_template(data)
|
||||
return response
|
||||
|
||||
|
||||
@api.route('/office/template/set-template', methods=['POST'])
|
||||
# @token_required
|
||||
def get_set_template_office():
|
||||
# Call the dashboard service
|
||||
filters = {
|
||||
'subscription_uid': request.args.get('subscription_uid')
|
||||
}
|
||||
data = request.get_json()
|
||||
|
||||
response = []
|
||||
response = OfficeTemplatesService.set_office_user_template(data)
|
||||
return response
|
||||
|
||||
@api.route('/office/billings', methods=['GET'])
|
||||
|
||||
@@ -11,9 +11,10 @@ from app.api.services.subscriptions import SubscriptionsService
|
||||
from app.api.services.common_data import CommonDataService
|
||||
from app.api.services.genaratives import GenerativesService
|
||||
from app.api.services.comments import CommentsService
|
||||
from app.api.services.office_users import OfficeUsersService
|
||||
|
||||
# OFFICE
|
||||
from app.api.services.office_customer import OfficeCustomerService
|
||||
from app.api.services.office_dashboard import OfficeDashboardService
|
||||
|
||||
from app.api.services.office_users import OfficeUsersService
|
||||
from app.api.services.office_templates import OfficeTemplatesService
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
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
|
||||
Reference in New Issue
Block a user