feat: add field is_hidden_weight
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d039cc69e1
commit
0ef80c8816
|
@ -1,14 +1,17 @@
|
|||
from apiflask import Schema
|
||||
from apiflask.fields import String, Float, URL
|
||||
from apiflask.fields import String, Float, URL, Boolean
|
||||
|
||||
|
||||
class UserInfoIn(Schema):
|
||||
nickname = String()
|
||||
height = Float()
|
||||
is_hidden_weight = Boolean()
|
||||
|
||||
|
||||
class UserInfoOut(Schema):
|
||||
user_id = String(attribute='_id')
|
||||
nickname = String()
|
||||
avatar_id = String()
|
||||
avatar_url = URL()
|
||||
height = Float(allow_nan=True)
|
||||
height = Float(allow_nan=True)
|
||||
is_hidden_weight = Boolean()
|
|
@ -23,7 +23,8 @@ def set_user_info(json_data):
|
|||
|
||||
try:
|
||||
rpc.body_record.set_body_info(session['user_id'],
|
||||
height=json_data.get('height', None))
|
||||
height=json_data.get('height', None),
|
||||
is_hidden_weight=json_data.get('is_hidden_weight', None),)
|
||||
except Exception as e:
|
||||
raise UserInfoError(extra_data={'error_docs': str(e)})
|
||||
|
||||
|
@ -57,7 +58,12 @@ def get_user_info():
|
|||
result.update(user_dict)
|
||||
if body_info_dict:
|
||||
result['height'] = body_info_dict.get('height', None)
|
||||
if body_info_dict.get('is_hidden_weight', None):
|
||||
result['is_hidden_weight'] = True
|
||||
else:
|
||||
result['is_hidden_weight'] = False
|
||||
else:
|
||||
result['height'] = None
|
||||
result['is_hidden_weight'] = False
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue