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.input(BodyRecordIn)
|
||||
@record.doc(summary='添加身体记录', description='添加身体记录')
|
||||
@record.input(BodyRecordIn, location='json')
|
||||
@login_required
|
||||
def add_record(json_data):
|
||||
try:
|
||||
rpc.body_record.add(user_id=session['user_id'],
|
||||
height=json_data['height'],
|
||||
weight=json_data['weight'],
|
||||
bmi=json_data['bmi'])
|
||||
rpc.body_record.add(**{
|
||||
'user_id': session['user_id'],
|
||||
'height': json_data['height'],
|
||||
'weight': json_data['weight'],
|
||||
'bmi': json_data['bmi']
|
||||
})
|
||||
except Exception as e:
|
||||
raise AddBodyRecordError(extra_data={'error_docs': str(e)})
|
||||
return {'msg': 'add body record success'}
|
||||
|
||||
|
||||
@record.get('/<record_id>')
|
||||
@record.output(BodyRecordOut)
|
||||
@record.doc(summary='查询单条身体记录', description='查询单条身体记录')
|
||||
@record.output(BodyRecordOut)
|
||||
@login_required
|
||||
def get_record(record_id):
|
||||
try:
|
||||
|
@ -37,8 +39,8 @@ def get_record(record_id):
|
|||
|
||||
|
||||
@record.get('/list')
|
||||
@record.output(BodyRecordsOut)
|
||||
@record.doc(summary='查询身体记录列表', description='查询身体记录列表')
|
||||
@record.output(BodyRecordsOut)
|
||||
@login_required
|
||||
def get_records():
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue