mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-27 00:54:54 +00:00
jira-15 changes in profile API
This commit is contained in:
@ -199,6 +199,8 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
|
||||
first_name = serializers.SerializerMethodField('get_first_name')
|
||||
last_name = serializers.SerializerMethodField('get_last_name')
|
||||
notification_count = serializers.SerializerMethodField('get_notification_count')
|
||||
total_count = serializers.SerializerMethodField('get_total_count')
|
||||
complete_field_count = serializers.SerializerMethodField('get_complete_field_count')
|
||||
|
||||
def get_auth(self, obj):
|
||||
"""user email address"""
|
||||
@ -213,12 +215,22 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
|
||||
return obj.auth.last_name
|
||||
|
||||
def get_notification_count(self, obj):
|
||||
"""user email address"""
|
||||
"""total notification count"""
|
||||
return 0
|
||||
|
||||
def get_total_count(self, obj):
|
||||
"""total fields count"""
|
||||
return 9
|
||||
|
||||
def get_complete_field_count(self, obj):
|
||||
"""total filled fields count"""
|
||||
field_list = [obj.auth.first_name, obj.auth.last_name, obj.auth.email, obj.country_name, obj.country_code,
|
||||
obj.phone, obj.gender, obj.dob, obj.image]
|
||||
complete_field = [data for data in field_list if data is not None and data != '']
|
||||
return len(complete_field)
|
||||
class Meta(object):
|
||||
"""Meta info"""
|
||||
model = Junior
|
||||
fields = ['id', 'email', 'first_name', 'last_name', 'country_name', 'country_code', 'phone', 'gender', 'dob',
|
||||
'guardian_code', 'referral_code','is_active', 'is_complete_profile', 'created_at', 'image',
|
||||
'updated_at', 'notification_count']
|
||||
'updated_at', 'notification_count', 'total_count', 'complete_field_count']
|
||||
|
||||
Reference in New Issue
Block a user