From 5e3b1c4bba86281077cd0611654ab6f803f1530e Mon Sep 17 00:00:00 2001 From: BryantHe Date: Fri, 18 Aug 2023 14:55:30 +0800 Subject: [PATCH] feat: add api of body record chart 5 --- app/api/v1/schema/user.py | 2 +- app/api/v1/user.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/api/v1/schema/user.py b/app/api/v1/schema/user.py index 385e46d..fd82297 100644 --- a/app/api/v1/schema/user.py +++ b/app/api/v1/schema/user.py @@ -10,4 +10,4 @@ class UserInfoIn(Schema): class UserInfoOut(Schema): nickname = String() avatar_id = String() - height = Float() \ No newline at end of file + height = Float(allow_nan=True) \ No newline at end of file diff --git a/app/api/v1/user.py b/app/api/v1/user.py index 57d1767..c234e93 100644 --- a/app/api/v1/user.py +++ b/app/api/v1/user.py @@ -48,6 +48,8 @@ def get_user_info(): if user_dict: result.update(user_dict) if body_info_dict: - result['height'] = body_info_dict['height'] + result['height'] = body_info_dict.get('height', None) + else: + result['height'] = None return result