diff --git a/app/api/v1/api.py b/app/api/v1/api.py index c3ea9ac..95c61a3 100644 --- a/app/api/v1/api.py +++ b/app/api/v1/api.py @@ -56,7 +56,15 @@ def upload_avatar_image(files_data): @login_required def upload_diet_image(files_data): f = files_data['image'] - category = files_data['category'] # 食物类别 + category_dict = { + 0: '早餐', + 1: '午餐', + 2: '晚餐', + 3: '零食', + 4: '下午茶', + 5: '夜宵', + } + category = category_dict[files_data['category']] # 食物类别 try: result = rpc.storage.upload(file_name=str(session['user_id'] + f'_{f.filename}'), file_binary=f.read(), diff --git a/app/api/v1/schema/api.py b/app/api/v1/schema/api.py index 1bf55af..afa3122 100644 --- a/app/api/v1/schema/api.py +++ b/app/api/v1/schema/api.py @@ -8,7 +8,7 @@ class ImageIn(Schema): class DietImageIn(Schema): image = File() - category = String() + category = Integer() class ImagePreSignUrlIn(Schema):