fix: 修改上传图片接口的返回值
continuous-integration/drone/push Build is passing Details

This commit is contained in:
BryantHe 2023-08-18 21:07:10 +08:00
parent 72303f4837
commit 330084ea4a
1 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,7 @@ api = APIBlueprint('api', __name__)
@api.post('/images')
@api.doc(summary='上传图片', description='上传图片')
@api.input(ImageIn, location='files')
@api.output(ImagePreSignUrlOut)
@login_required
def upload_image(files_data):
f = files_data['image']
@ -36,9 +37,16 @@ def upload_image(files_data):
except Exception as e:
raise UserInfoError(extra_data={'error_docs': str(e)})
return {'msg': 'uploading image success'}
try:
presign_url = rpc.storage.get_presign_url(result['_id'],
'bodyrecord',
bucket='bodyrecord')
except Exception as e:
raise ImageNotFound(extra_data={'error_docs': str(e)})
return {'image_presign_url': presign_url}
else:
return {'msg': 'uploading image fail'}
raise ImageUploadError()
@api.get('/images/presign_url')