New data
This commit is contained in:
@@ -7,7 +7,7 @@ from marshmallow import ValidationError
|
||||
from app.api.enums import TransactionType
|
||||
from app.api.integrations import SimbrellaIntegration
|
||||
from app.extensions import db
|
||||
from app.models import MembersProducts, Products, Members
|
||||
from app.models import MembersProducts, Products, Members, ProductsDetails
|
||||
|
||||
from app.api.services.offer_analysis import OfferAnalysis
|
||||
from app.api.helpers.response_helper import ResponseHelper
|
||||
@@ -56,16 +56,17 @@ class MyProductsService(BaseService):
|
||||
|
||||
|
||||
merms_panel=#
|
||||
|
||||
"Product Description - Commitment is something that comes from understanding that everything has its price and then having the willingness to pay that price. This is important because nobody wants to put significant effort into something, only to find out after the fact that the price was too high.The price is something not necessarily defined as financial. It could be time, effort, sacrifice, money or perhaps, something else.",
|
||||
|
||||
|
||||
'''
|
||||
product_data = Products.get_product_by_product_id(product_id)
|
||||
|
||||
product_description = ProductsDetails.get_product_desctiption_by_product_id('A000002')
|
||||
# "banner": "banner.jpg",
|
||||
myproduct_data = {
|
||||
"myproudct": {
|
||||
"banner": product_data.banner,
|
||||
"description": "Product Description - Commitment is something that comes from understanding that everything has its price and then having the willingness to pay that price. This is important because nobody wants to put significant effort into something, only to find out after the fact that the price was too high.The price is something not necessarily defined as financial. It could be time, effort, sacrifice, money or perhaps, something else.",
|
||||
"description": product_description,
|
||||
"internal_url": "",
|
||||
"price_text": "90 days free and 3.95/Month",
|
||||
"product_id": product_data.product_id,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
from flask import session, jsonify
|
||||
|
||||
from app.api.routes.routes import myproduct_url
|
||||
from app.api.services import MyProductsService
|
||||
from app.models.loan import Loan
|
||||
from app.utils.logger import logger
|
||||
from app.api.services.base_service import BaseService
|
||||
@@ -128,6 +131,7 @@ class ProductsService(BaseService):
|
||||
product_data=[]
|
||||
logger.info(f"Product Data ****** *****: {products}")
|
||||
|
||||
|
||||
for t in products:
|
||||
product_data.append({
|
||||
'id': t.id,
|
||||
|
||||
@@ -16,9 +16,9 @@ from .products import Products
|
||||
from .members_products import MembersProducts
|
||||
from .members_actions import MembersActions
|
||||
from .members_pending import MembersPending
|
||||
|
||||
from .products_details import ProductsDetails
|
||||
|
||||
__all__ = ['Members','Customer', 'Account', 'Products',
|
||||
'MembersProducts', 'MembersActions', 'MembersPending', 'Loan', 'Transaction', 'Repayment',
|
||||
'MembersProducts', 'MembersActions', 'MembersPending', 'ProductsDetails', 'Loan', 'Transaction', 'Repayment',
|
||||
'LoanCharge', 'Offer', 'Charge', 'RACCheck', 'LoanRepaymentSchedule',
|
||||
'TransactionOffer', 'RepaymentsData', 'Salary']
|
||||
@@ -36,9 +36,8 @@ class MembersProducts(db.Model):
|
||||
@classmethod
|
||||
def get_member_productlist_by_member_id(cls, member_id):
|
||||
member_products = cls.query.filter_by(member_id=str(member_id))
|
||||
|
||||
if not member_products:
|
||||
raise ValueError(f"Products for member_id = {member_id} not found")
|
||||
return None
|
||||
return member_products
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from itertools import product
|
||||
from app.extensions import db
|
||||
from app.models.customer import Customer
|
||||
from app.models.account import Account
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import relationship
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from sqlalchemy import and_, or_, not_
|
||||
from sqlalchemy.sql import func
|
||||
import json
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class ProductsDetails(db.Model):
|
||||
__tablename__ = 'products'
|
||||
|
||||
id = db.Column(
|
||||
db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
)
|
||||
|
||||
product_id = db.Column(db.String(25), nullable=False)
|
||||
details = db.Column(db.String(5000), nullable=False)
|
||||
added = db.Column(db.DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_product_details_with_product_id(cls, product_id):
|
||||
"""
|
||||
Get customer's active loans by loan_id.
|
||||
"""
|
||||
productItem = cls.query.filter_by(product_id = product_id).first()
|
||||
if not productItem:
|
||||
raise ValueError(f"pProduct with ID {product_id} does not exist.")
|
||||
return productItem
|
||||
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Convert the Loan object to a dictionary format for JSON serialization.
|
||||
"""
|
||||
return {
|
||||
'id': self.id,
|
||||
'product_id': self.product_id,
|
||||
'details': self.details,
|
||||
'added': self.added
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Products {self.id}>'
|
||||
Reference in New Issue
Block a user