Added AWS SES email
This commit is contained in:
@@ -859,7 +859,9 @@ ALTER TABLE office_users ALTER COLUMN password TYPE VARCHAR(250);
|
|||||||
ALTER TABLE office_users OWNER TO merms_panel;
|
ALTER TABLE office_users OWNER TO merms_panel;
|
||||||
|
|
||||||
INSERT INTO office_users (username, password, firstname, lastname, acc_level) VALUES ('mermsadmin','password','Merms','Admin',1000);
|
INSERT INTO office_users (username, password, firstname, lastname, acc_level) VALUES ('mermsadmin','password','Merms','Admin',1000);
|
||||||
|
INSERT INTO office_users (username, password, firstname, lastname, acc_level) VALUES ('adminsanya','password','Sanya','Ameye',1000);
|
||||||
|
|
||||||
|
-- Dr.Sanya.Alan1!
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE products_contacts(
|
CREATE TABLE products_contacts(
|
||||||
|
|||||||
@@ -741,7 +741,7 @@ def get_subscription_transaction_office():
|
|||||||
def get_recent_signup_office():
|
def get_recent_signup_office():
|
||||||
# Call the dashboard service
|
# Call the dashboard service
|
||||||
filters = {}
|
filters = {}
|
||||||
result = OfficeDashboardService.get_payments_data(filters)
|
result = OfficeDashboardService.get_recent_signup_data(filters)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
|
||||||
@@ -930,3 +930,10 @@ def refresh():
|
|||||||
# logger.info(f"Authorize refresh request received: {data}")
|
# logger.info(f"Authorize refresh request received: {data}")
|
||||||
response = AuthorizationService.process_refresh_request()
|
response = AuthorizationService.process_refresh_request()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@api.route("/cron/report-subscription", methods=["GET"])
|
||||||
|
def report_subs():
|
||||||
|
data = {}
|
||||||
|
AccountService.process_test_email(data)
|
||||||
|
return {"status": "ok"}, 200
|
||||||
@@ -6,8 +6,6 @@ from app.config import settings
|
|||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
from app.api.services.base_service import BaseService
|
from app.api.services.base_service import BaseService
|
||||||
from sqlalchemy import func, desc
|
from sqlalchemy import func, desc
|
||||||
from datetime import datetime, timedelta, timezone
|
|
||||||
from app.extensions import db
|
|
||||||
from app.models import MembersProducts, Products, Payments, Members, CustomTemplates, ProductsTemplates, MembersProfile, \
|
from app.models import MembersProducts, Products, Payments, Members, CustomTemplates, ProductsTemplates, MembersProfile, \
|
||||||
ProductsDetails, MembersWebfiles
|
ProductsDetails, MembersWebfiles
|
||||||
|
|
||||||
@@ -226,7 +224,6 @@ class OfficeDashboardService(BaseService):
|
|||||||
|
|
||||||
return products_result
|
return products_result
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_office_product_templates(filters):
|
def get_office_product_templates(filters):
|
||||||
|
|
||||||
@@ -594,4 +591,57 @@ class OfficeDashboardService(BaseService):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred while getting dashboard data: {str(e)}", exc_info=True)
|
||||||
return jsonify({"message": "Internal Server Error"}), 500
|
return jsonify({"message": "Internal Server Error"}), 500
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_recent_signup_data(filters):
|
||||||
|
try:
|
||||||
|
if filters is None:
|
||||||
|
filters = {}
|
||||||
|
|
||||||
|
# Extract pagination parameters
|
||||||
|
page = int(filters.get('page', 1))
|
||||||
|
limit = int(filters.get('limit', 20))
|
||||||
|
|
||||||
|
# Ensure page and limit are valid
|
||||||
|
if page < 1:
|
||||||
|
page = 1
|
||||||
|
if limit < 1 or limit > 100:
|
||||||
|
limit = 20
|
||||||
|
|
||||||
|
membersList, total_count = Members.get_all_member(None,None,1,30)
|
||||||
|
# Convert loans to dictionary format
|
||||||
|
member_data = []
|
||||||
|
for member in membersList:
|
||||||
|
member_data.append({
|
||||||
|
'id': member.id,
|
||||||
|
'username': member.username,
|
||||||
|
'email': member.email,
|
||||||
|
'firstname': member.firstname,
|
||||||
|
'lastname': member.lastname,
|
||||||
|
'country': member.country,
|
||||||
|
'member_uid': member.uid,
|
||||||
|
'profile_completed': member.profile_completed,
|
||||||
|
"added": member.added,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
response_data = {
|
||||||
|
'members': member_data,
|
||||||
|
'count': 30,
|
||||||
|
'pagination': {
|
||||||
|
'total_count': total_count,
|
||||||
|
'total_pages': 1,
|
||||||
|
'current_page': page,
|
||||||
|
'limit': limit,
|
||||||
|
'has_next': page < 1,
|
||||||
|
'has_prev': page > 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response_data
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
@@ -15,6 +15,19 @@ def send_email_factory(to_email, subject, html_content, text_content=None):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def alert_email_factory(to_email, subject, html_content, text_content=None):
|
||||||
|
try:
|
||||||
|
send_email_ses(
|
||||||
|
to_email=to_email,
|
||||||
|
subject=subject,
|
||||||
|
html_content=alert_template(html_content)
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Alert_Email_Factory failed: {e}")
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
def body_template(html_content):
|
def body_template(html_content):
|
||||||
html_body = f"""\
|
html_body = f"""\
|
||||||
<html>
|
<html>
|
||||||
@@ -45,3 +58,38 @@ def body_template(html_content):
|
|||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
return html_body
|
return html_body
|
||||||
|
|
||||||
|
|
||||||
|
def alert_template(html_content):
|
||||||
|
html_body = f"""\
|
||||||
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<body style="font-size:14px;line-height:1.5;">
|
||||||
|
<table width="550px" border="0" cellpadding="3" cellspacing="3" background-color="#F0F8FF" style="font-size:16px">
|
||||||
|
<tr>
|
||||||
|
<td style="text-align:center">
|
||||||
|
<img style="width:150px; height:auto;" src="https://www.mermsemr.com/images/logo-pink.png" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{html_content}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<br />
|
||||||
|
LINKS --- ---- ---- -----
|
||||||
|
<br />
|
||||||
|
For any support<br>
|
||||||
|
Reach Out<br>
|
||||||
|
support@mermsemr.com<br>
|
||||||
|
https://www.mermsemr.com/
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
return html_body
|
||||||
|
|||||||
Reference in New Issue
Block a user