This commit is contained in:
CHIEFSOFT\ameye
2025-09-22 09:21:09 -04:00
parent 4a5f2ee946
commit 714393a39b
4 changed files with 27 additions and 3 deletions
+1
View File
@@ -67,6 +67,7 @@ ALTER TABLE ONLY members_profile
ALTER TABLE members_profile OWNER TO merms_panel
ALTER TABLE members_profile ADD url_name VARCHAR(25);
+2 -1
View File
@@ -5,4 +5,5 @@ class StartProfileSchema(Schema):
uid = fields.Str(required=True)
practice =fields.Str(required=True)
specialization =fields.Str(required=True)
introduction = fields.Str(required=True)
introduction = fields.Str(required=True)
url_name = fields.Str(required=True)
+13 -1
View File
@@ -220,6 +220,18 @@ class AccountService(BaseService):
practice = str(validated_data.get('practice'))
specialization = str(validated_data.get('specialization'))
introduction = str(validated_data.get('introduction'))
url_name = str(validated_data.get('url_name'))
#verify is anybody is using this url name
urlNammeData = MembersProfile.get_member_product_by_url_name(url_name)
if urlNammeData:
save_error = {
"error": 'Duplicate url name',
"error_message": 'Try another url name',
"url_name": url_name,
}
return ResponseHelper.error(data=save_error)
profile_uid = ''
profile_completed = None
member = Members.get_member_by_uid(uid)
@@ -242,7 +254,7 @@ class AccountService(BaseService):
profile_completed = member.profile_completed
else:
profle_result = MembersProfile.create_member_profile(member.id, practice, specialization,
introduction)
introduction,url_name)
if profle_result:
profile_uid = profle_result.uid
if profile_uid is not None and profile_uid != '':
+11 -1
View File
@@ -26,6 +26,7 @@ class MembersProfile(db.Model):
practice = db.Column(db.String(100), nullable=False)
specialization = db.Column(db.String(100), nullable=False)
introduction = db.Column(db.String(3500), nullable=True)
url_name = db.Column(db.String(25), nullable=True)
added = db.Column(db.DateTime(timezone=True), server_default=func.now())
updated = db.Column(db.DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
@@ -43,6 +44,13 @@ class MembersProfile(db.Model):
return None
return member_profile
@classmethod
def get_member_product_by_url_name(cls, url_name):
member_product = cls.query.filter_by(url_name=str(url_name)).first()
if not member_product:
return None
return member_product
@classmethod
def get_member_product_by_product_member_id(cls, member_id, product_id):
@@ -53,7 +61,7 @@ class MembersProfile(db.Model):
@classmethod
def create_member_profile(cls, member_id ,practice,specialization,introduction):
def create_member_profile(cls, member_id ,practice,specialization,introduction,url_name):
# Create the subscription
'''
merms_panel=# select * from members_profile;
@@ -69,6 +77,7 @@ class MembersProfile(db.Model):
practice=practice,
specialization=specialization,
introduction=introduction,
url_name = url_name,
added=datetime.now(timezone.utc),
updated=datetime.now(timezone.utc)
)
@@ -92,6 +101,7 @@ class MembersProfile(db.Model):
'practice': self.practice,
'specialization': self.specialization,
'introduction': self.dns_group,
'url_name': self.url_name,
'added': self.added,
'updated': self.updated
}