sub items
This commit is contained in:
@@ -338,6 +338,43 @@ CREATE TABLE subscription_options_items (
|
|||||||
|
|
||||||
ALTER TABLE subscription_options_items OWNER TO merms_panel;
|
ALTER TABLE subscription_options_items OWNER TO merms_panel;
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('STATRTER001','Personal Web Presence',0);
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('STATRTER001','Professional Online Presence',2);
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('STATRTER001','Personal and Professional Forum',4);
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('STATRTER001','',0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('BASIC001','Everything in Basic Plus',0);
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('BASIC001','',0);
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('BASIC001','',0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('PREMIUM001','Everything in Starter & Basic Plus',0);
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('PREMIUM001','',0);
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('PREMIUM001','',0);
|
||||||
|
|
||||||
|
INSERT INTO subscription_options_items (option_name,description,list_order)
|
||||||
|
VALUES('PREMIUM001','',0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from app.api.services.base_service import BaseService
|
|||||||
from sqlalchemy import func, desc
|
from sqlalchemy import func, desc
|
||||||
from app.api.helpers.response_helper import ResponseHelper
|
from app.api.helpers.response_helper import ResponseHelper
|
||||||
from app.api.schemas.user import UserSchema
|
from app.api.schemas.user import UserSchema
|
||||||
from app.models import Members, MembersProducts, SubscriptionOptions
|
from app.models import Members, MembersProducts, SubscriptionOptions, SubscriptionOptionsItems
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
|
|
||||||
|
|
||||||
@@ -87,9 +87,8 @@ class SubscriptionService(BaseService):
|
|||||||
'package_uid': t.uid,
|
'package_uid': t.uid,
|
||||||
'display_name': t.display_name,
|
'display_name': t.display_name,
|
||||||
'option_name': t.option_name,
|
'option_name': t.option_name,
|
||||||
'monthly': round(t.monthly*0.01, 2),
|
'monthly': round(t.monthly * 0.01, 2),
|
||||||
"items": ['Post Jobs', 'advanced instructors search', 'invite candidates', 'post events',
|
"items": SubscriptionService.subscription_items_data(t.option_name),
|
||||||
'Cancel anytime'],
|
|
||||||
'added': t.added.isoformat() if t.added else None,
|
'added': t.added.isoformat() if t.added else None,
|
||||||
'updated': t.updated.isoformat() if t.updated else None
|
'updated': t.updated.isoformat() if t.updated else None
|
||||||
})
|
})
|
||||||
@@ -115,6 +114,16 @@ class SubscriptionService(BaseService):
|
|||||||
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 subscription_items_data(option_name):
|
||||||
#
|
items_data = SubscriptionOptionsItems.get_subscription_item(option_name)
|
||||||
|
res_options_items = []
|
||||||
|
for t in items_data:
|
||||||
|
res_options_items.append({
|
||||||
|
'description': t.description
|
||||||
|
})
|
||||||
|
|
||||||
|
# return ['Post Jobs 222', 'advanced instructors search', 'invite candidates', 'post events',
|
||||||
|
# 'Cancel anytime']
|
||||||
|
return res_options_items
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ from .member_product_refresh import MembersProductsRefresh
|
|||||||
from .members_products_settings import MembersProductsSettings
|
from .members_products_settings import MembersProductsSettings
|
||||||
from .members_profile import MembersProfile
|
from .members_profile import MembersProfile
|
||||||
from .subscription_options import SubscriptionOptions
|
from .subscription_options import SubscriptionOptions
|
||||||
|
from .subscription_options_items import SubscriptionOptionsItems
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ from .subscription_options import SubscriptionOptions
|
|||||||
__all__ = ['Members','Customer', 'Account', 'Products',
|
__all__ = ['Members','Customer', 'Account', 'Products',
|
||||||
'MembersProducts', 'MembersActions', 'MembersPending', 'ProductsDetails',
|
'MembersProducts', 'MembersActions', 'MembersPending', 'ProductsDetails',
|
||||||
'ProvisionActions', 'MembersProductsRefresh','MembersProductsSettings',
|
'ProvisionActions', 'MembersProductsRefresh','MembersProductsSettings',
|
||||||
'PasswordReset','MembersProfile','SubscriptionOptions',
|
'PasswordReset','MembersProfile','SubscriptionOptions','SubscriptionOptionsItems',
|
||||||
|
|
||||||
'Loan', 'Transaction', 'Repayment',
|
'Loan', 'Transaction', 'Repayment',
|
||||||
'LoanCharge', 'Offer', 'Charge', 'RACCheck', 'LoanRepaymentSchedule',
|
'LoanCharge', 'Offer', 'Charge', 'RACCheck', 'LoanRepaymentSchedule',
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
from datetime import datetime, timezone
|
||||||
|
from app.extensions import db
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
|
||||||
|
|
||||||
|
class SubscriptionOptionsItems(db.Model):
|
||||||
|
__tablename__ = 'subscription_options_items'
|
||||||
|
|
||||||
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
|
uid = db.Column(db.String(150), nullable=True)
|
||||||
|
description = db.Column(db.String(100), nullable=False)
|
||||||
|
option_name = db.Column(db.String(100), nullable=False)
|
||||||
|
list_order = db.Column(db.Integer, nullable=True, default=0)
|
||||||
|
status = db.Column(db.Integer, nullable=True, default=1)
|
||||||
|
added = db.Column(db.DateTime(timezone=False), server_default=func.now())
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_subscription_item(cls, option_name):
|
||||||
|
sub_options = cls.query.filter_by(option_name=option_name).all()
|
||||||
|
if not sub_options:
|
||||||
|
return None
|
||||||
|
return sub_options
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return {
|
||||||
|
"id": self.id,
|
||||||
|
"uid": self.uid,
|
||||||
|
"description": self.description,
|
||||||
|
"status": self.status,
|
||||||
|
"added": self.added.isoformat() if self.added else None
|
||||||
|
}
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f'<SubscriptionOptionsItems {self.id} - {self.amount}>'
|
||||||
Reference in New Issue
Block a user