office pages
This commit is contained in:
@@ -13,7 +13,7 @@ from app.api.services import (
|
||||
SubscriptionsService,
|
||||
CommonDataService,
|
||||
OfficeCustomerService,
|
||||
GenerativesService
|
||||
GenerativesService, OfficeUsersService
|
||||
)
|
||||
from app.api.services.comments import CommentsService
|
||||
from app.utils.logger import logger
|
||||
@@ -420,7 +420,6 @@ def get_subscription_billings_office():
|
||||
|
||||
|
||||
@api.route('/office/transaction', methods=['GET'])
|
||||
# @token_required
|
||||
def get_subscription_transaction_office():
|
||||
# Call the dashboard service
|
||||
filters = {
|
||||
@@ -432,6 +431,33 @@ def get_subscription_transaction_office():
|
||||
result = OfficeDashboardService.get_payments_data(filters)
|
||||
return jsonify(result)
|
||||
|
||||
@api.route('/office/recent-signup', methods=['GET'])
|
||||
def get_recent_signup_office():
|
||||
# Call the dashboard service
|
||||
filters = {}
|
||||
result = OfficeDashboardService.get_payments_data(filters)
|
||||
return jsonify(result)
|
||||
|
||||
@api.route('/office/right-sidebar', methods=['GET'])
|
||||
def get_office_sidebar():
|
||||
# Call the dashboard service
|
||||
filters = {}
|
||||
result = OfficeDashboardService.get_payments_data(filters)
|
||||
return jsonify(result)
|
||||
|
||||
@api.route('/office/users', methods=['GET'])
|
||||
def get_office_users():
|
||||
# Call the dashboard service
|
||||
filters = {}
|
||||
result = OfficeUsersService.get_office_users(filters)
|
||||
return jsonify(result)
|
||||
|
||||
@api.route('/office/products', methods=['GET'])
|
||||
def get_product_office():
|
||||
# Call the dashboard service
|
||||
filters = {}
|
||||
result = OfficeDashboardService.get_office_products(filters)
|
||||
return jsonify(result)
|
||||
|
||||
# =====================================================
|
||||
@api.route('/web/contents', methods=['GET'])
|
||||
|
||||
@@ -11,7 +11,7 @@ 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
|
||||
|
||||
@@ -122,3 +122,26 @@ class OfficeDashboardService(BaseService):
|
||||
except Exception as e:
|
||||
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
||||
return jsonify({"message": "Internal Server Error"}), 500
|
||||
|
||||
@staticmethod
|
||||
def get_office_products(filters):
|
||||
products = Products.get_user_product_list(0)
|
||||
product_data = []
|
||||
|
||||
for t in products:
|
||||
product_data.append({
|
||||
'id': t.id,
|
||||
'uid': t.uid,
|
||||
'product_id': t.product_id,
|
||||
'description': t.description,
|
||||
'name': t.name,
|
||||
'status': t.status,
|
||||
'added': t.added.isoformat() if t.added else None,
|
||||
'updated': t.updated.isoformat() if t.updated else None,
|
||||
'banner': t.banner,
|
||||
})
|
||||
products_result = {
|
||||
"products": product_data,
|
||||
}
|
||||
|
||||
return products_result
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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 MembersProducts, Products, Members, ProductsDetails, ProductsDetails, ProvisionActions, Payments, \
|
||||
OfficeUsers
|
||||
|
||||
|
||||
class OfficeUsersService(BaseService):
|
||||
|
||||
@staticmethod
|
||||
def get_office_users(filters):
|
||||
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,
|
||||
'product_id': t.product_id,
|
||||
'description': t.description,
|
||||
'name': t.name,
|
||||
'status': t.status,
|
||||
'added': t.added.isoformat() if t.added else None,
|
||||
'updated': t.updated.isoformat() if t.updated else None,
|
||||
'banner': t.banner,
|
||||
})
|
||||
|
||||
office_users_result = {
|
||||
"office_users": office_users_data,
|
||||
}
|
||||
|
||||
return office_users_result
|
||||
Reference in New Issue
Block a user