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 Country class OfficeCountryService(BaseService): @staticmethod def get_office_country_list(filters): logger.info('ENTER API::get get_office_country_list') try: account_result_data =[] account_result = Country.get_all_countries() if account_result: for t in account_result: account_result_data.append({ 'id': t.id, 'uid': t.uid, 'code': t.code, 'description': t.description, 'status': t.status, 'signup': t.signup, }) account_result = { "country_data":account_result_data, } logger.info('RETURN API::get office account view') logger.info(account_result) return account_result except Exception as e: logger.error(f"An error occurred while get_office_country_list data: {str(e)}", exc_info=True) return jsonify({"message": "Internal Server Error"}), 500