70 lines
2.9 KiB
Python
70 lines
2.9 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 app.api.helpers.response_helper import ResponseHelper
|
|
from app.api.schemas.user import UserSchema
|
|
from app.models import Members
|
|
from app.extensions import db
|
|
|
|
class SubscriptionService(BaseService):
|
|
|
|
@staticmethod
|
|
def subscription_available_products(data):
|
|
try:
|
|
with db.session.begin():
|
|
validated_data = SubscriptionService.validate_data(data, UserSchema())
|
|
token = validated_data.get('token')
|
|
uid = validated_data.get('uid')
|
|
member_data = Members.get_member_by_uid(uid)
|
|
member_id = member_data.id
|
|
|
|
subscription_products_data = {
|
|
"current_product": {
|
|
"display_name": "Subscriptions",
|
|
"subs":[
|
|
'Post Jobs',
|
|
'advanced instructors search',
|
|
'invite candidates',
|
|
'post events',
|
|
'Cancel anythime'
|
|
],
|
|
"next_payment":'2025-10-15 11:00:07.47214'
|
|
|
|
},
|
|
"options": {
|
|
"starter":{
|
|
"package_uid" : "cd2c0a4d-9ad4-472e-96f5-28d10c06916f",
|
|
"display_name" : "Starter",
|
|
"monthly" : 5.99,
|
|
"items" : ['Post Jobs','advanced instructors search','invite candidates','post events',
|
|
'Cancel anythime']
|
|
},
|
|
"basic": {
|
|
"package_uid": "ef2ffa1c-9272-42cd-9d33-0e614047b4f8",
|
|
"display_name": "Basic",
|
|
"monthly": 12.99,
|
|
"items": ['Post Jobs', 'advanced instructors search', 'invite candidates', 'post events',
|
|
'Cancel anythime']
|
|
},
|
|
"premium": {
|
|
"package_uid": "64bf48f6-1e7f-402e-8ff0-76f4ce0f2055",
|
|
"display_name": "Premium",
|
|
"monthly": 20.99,
|
|
"items": ['Post Jobs', 'advanced instructors search', 'invite candidates', 'post events',
|
|
'Cancel anythime']
|
|
},
|
|
}
|
|
}
|
|
|
|
|
|
return ResponseHelper.success(data=subscription_products_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
|
|
|
|
|
|
#
|
|
#
|
|
# |