feat: add api of body record 11
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
019ea67043
commit
5ddf94aa82
|
@ -10,23 +10,25 @@ record = APIBlueprint('record', __name__)
|
||||||
|
|
||||||
|
|
||||||
@record.post('/')
|
@record.post('/')
|
||||||
@record.input(BodyRecordIn)
|
|
||||||
@record.doc(summary='添加身体记录', description='添加身体记录')
|
@record.doc(summary='添加身体记录', description='添加身体记录')
|
||||||
|
@record.input(BodyRecordIn, location='json')
|
||||||
@login_required
|
@login_required
|
||||||
def add_record(json_data):
|
def add_record(json_data):
|
||||||
try:
|
try:
|
||||||
rpc.body_record.add(user_id=session['user_id'],
|
rpc.body_record.add(**{
|
||||||
height=json_data['height'],
|
'user_id': session['user_id'],
|
||||||
weight=json_data['weight'],
|
'height': json_data['height'],
|
||||||
bmi=json_data['bmi'])
|
'weight': json_data['weight'],
|
||||||
|
'bmi': json_data['bmi']
|
||||||
|
})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise AddBodyRecordError(extra_data={'error_docs': str(e)})
|
raise AddBodyRecordError(extra_data={'error_docs': str(e)})
|
||||||
return {'msg': 'add body record success'}
|
return {'msg': 'add body record success'}
|
||||||
|
|
||||||
|
|
||||||
@record.get('/<record_id>')
|
@record.get('/<record_id>')
|
||||||
@record.output(BodyRecordOut)
|
|
||||||
@record.doc(summary='查询单条身体记录', description='查询单条身体记录')
|
@record.doc(summary='查询单条身体记录', description='查询单条身体记录')
|
||||||
|
@record.output(BodyRecordOut)
|
||||||
@login_required
|
@login_required
|
||||||
def get_record(record_id):
|
def get_record(record_id):
|
||||||
try:
|
try:
|
||||||
|
@ -37,8 +39,8 @@ def get_record(record_id):
|
||||||
|
|
||||||
|
|
||||||
@record.get('/list')
|
@record.get('/list')
|
||||||
@record.output(BodyRecordsOut)
|
|
||||||
@record.doc(summary='查询身体记录列表', description='查询身体记录列表')
|
@record.doc(summary='查询身体记录列表', description='查询身体记录列表')
|
||||||
|
@record.output(BodyRecordsOut)
|
||||||
@login_required
|
@login_required
|
||||||
def get_records():
|
def get_records():
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue