test URL duplicates
This commit is contained in:
@@ -207,6 +207,22 @@ class MyProductsService(BaseService):
|
|||||||
product_data = Products.get_product_by_product_id(product_id)
|
product_data = Products.get_product_by_product_id(product_id)
|
||||||
configured_start_url = product_data.start_url
|
configured_start_url = product_data.start_url
|
||||||
|
|
||||||
|
if configured_start_url =='':
|
||||||
|
configured_start_url = MyProductsService.START_URL_PATTERN
|
||||||
|
|
||||||
|
internal_url = url_name_part + configured_start_url # ".devprov.mermsemr.com" =
|
||||||
|
internal_url=internal_url.lower()
|
||||||
|
|
||||||
|
# let us see if this is in USE
|
||||||
|
anybodyUsingUrl = MembersProducts.get_member_product_by_internal_url(internal_url)
|
||||||
|
if anybodyUsingUrl:
|
||||||
|
return {
|
||||||
|
"message": "Unable to create URL",
|
||||||
|
"error_message": "Error - Please try again latter",
|
||||||
|
"data": None,
|
||||||
|
"error": f"Unable to create URL for the Product."
|
||||||
|
}, 400
|
||||||
|
|
||||||
if not product_data:
|
if not product_data:
|
||||||
if not product_data:
|
if not product_data:
|
||||||
return {
|
return {
|
||||||
@@ -228,10 +244,7 @@ class MyProductsService(BaseService):
|
|||||||
"uid": uid
|
"uid": uid
|
||||||
}
|
}
|
||||||
return ResponseHelper.success(data=response_data)
|
return ResponseHelper.success(data=response_data)
|
||||||
if configured_start_url =='':
|
|
||||||
configured_start_url = MyProductsService.START_URL_PATTERN
|
|
||||||
|
|
||||||
internal_url = url_name_part + configured_start_url # ".devprov.mermsemr.com"
|
|
||||||
status = 6
|
status = 6
|
||||||
subscription = MembersProducts.create_subscription(member_id, product_id, status, internal_url)
|
subscription = MembersProducts.create_subscription(member_id, product_id, status, internal_url)
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,13 @@ class MembersProducts(db.Model):
|
|||||||
return None
|
return None
|
||||||
return member_product
|
return member_product
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_member_product_by_internal_url(cls, internal_url):
|
||||||
|
member_product = cls.query.filter_by(internal_url=str(internal_url)).all()
|
||||||
|
if not member_product:
|
||||||
|
return None
|
||||||
|
return member_product
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_member_product_template(cls, member_id, product_id, product_template):
|
def set_member_product_template(cls, member_id, product_id, product_template):
|
||||||
member_product = cls.query.filter_by(member_id=str(member_id), product_id=str(product_id)).first()
|
member_product = cls.query.filter_by(member_id=str(member_id), product_id=str(product_id)).first()
|
||||||
|
|||||||
Reference in New Issue
Block a user