fix: adjust api of add_interaction 2
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ca04e70d53
commit
8ca5843a62
@ -6,11 +6,6 @@ class AddInteractionError(HTTPError):
|
||||
message = 'add interaction failed.'
|
||||
|
||||
|
||||
class InteractionExistedError(HTTPError):
|
||||
status_code = 401
|
||||
message = '已经提交过,不能再次提交~'
|
||||
|
||||
|
||||
class InteractionTodayBriefNotFound(HTTPError):
|
||||
status_code = 404
|
||||
message = '找不到用户对应的食物记录'
|
@ -2,7 +2,7 @@ from apiflask import APIBlueprint
|
||||
from flask import session
|
||||
|
||||
from app import rpc
|
||||
from app.api.v1.exception.interaction import AddInteractionError, InteractionExistedError
|
||||
from app.api.v1.exception.interaction import AddInteractionError
|
||||
from app.api.v1.schema.interaction import (InteractionIn, InteractionBriefIn, InteractionListIn,
|
||||
InteractionBriefOut, InteractionListOut)
|
||||
|
||||
@ -27,8 +27,8 @@ def add_interaction(json_data):
|
||||
except Exception as e:
|
||||
raise AddInteractionError(extra_data={'error_docs': str(e)})
|
||||
if is_existed:
|
||||
raise InteractionExistedError()
|
||||
return {'msg': 'add interaction successfully'}
|
||||
return {'msg': '已经提交过,不能再次提交~', 'code': 401}
|
||||
return {'msg': 'add interaction successfully', 'code': 200}
|
||||
|
||||
|
||||
@interaction.get('/brief')
|
||||
|
Loading…
Reference in New Issue
Block a user