members profile
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 Members, MembersActions
|
||||
from app.models import Members, MembersActions, MembersProfile
|
||||
# from app.api.services.offer_analysis import OfferAnalysis
|
||||
from app.api.helpers.response_helper import ResponseHelper
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
@@ -153,14 +153,40 @@ class AccountService(BaseService):
|
||||
practice = str(validated_data.get('practice'))
|
||||
specialization = str(validated_data.get('specialization'))
|
||||
introduction = str(validated_data.get('introduction'))
|
||||
profile_uid = ''
|
||||
profile_completed = None
|
||||
member = Members.get_member_by_uid(uid)
|
||||
if member:
|
||||
# Simulate processing
|
||||
member_data = {
|
||||
"member_id": member.id,
|
||||
"uid": str(uid),
|
||||
"username": member.username,
|
||||
"account_name": member.account_name,
|
||||
"firstname":member.firstname,
|
||||
"lastname": member.lastname,
|
||||
"email": member.email,
|
||||
"room": member.uid,
|
||||
"token": user_token
|
||||
}
|
||||
current_profile = MembersProfile.get_member_profile_by_member_id(member.id)
|
||||
if current_profile is not None:
|
||||
profile_uid=current_profile.uid
|
||||
profile_completed = member.profile_completed
|
||||
else:
|
||||
profle_result = MembersProfile.create_member_profile(member.id, practice, specialization, introduction)
|
||||
if profle_result:
|
||||
profile_uid = profle_result.uid
|
||||
if profile_uid is not None and profile_uid != '':
|
||||
profile_completed = Members.set_member_profile_completed(member_data['uid'])
|
||||
|
||||
|
||||
calendar_data = {
|
||||
"last_update": datetime.datetime.utcnow(),
|
||||
"start_profile_called": "Doing nothing yet"
|
||||
result_data = {
|
||||
"profile_completed": profile_completed,
|
||||
"profile_uid": profile_uid,
|
||||
"last_update": datetime.datetime.utcnow()
|
||||
}
|
||||
|
||||
return ResponseHelper.success(data=calendar_data)
|
||||
return ResponseHelper.success(data=result_data)
|
||||
|
||||
except ValidationError as err:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user