feat: add api of delete one
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
63e6311d17
commit
6ce72c5a74
|
@ -4,7 +4,7 @@ from flask import session
|
||||||
from app import rpc
|
from app import rpc
|
||||||
from app.api.v1.exception.record import AddBodyRecordError, BodyRecordNotFound, BodyRecordChartError
|
from app.api.v1.exception.record import AddBodyRecordError, BodyRecordNotFound, BodyRecordChartError
|
||||||
from app.api.v1.schema.record import BodyRecordIn, BodyRecordOut, BodyRecordsOut, BodyRecordsIn, BodyRecordChartIn, \
|
from app.api.v1.schema.record import BodyRecordIn, BodyRecordOut, BodyRecordsOut, BodyRecordsIn, BodyRecordChartIn, \
|
||||||
BodyRecordChartOut
|
BodyRecordChartOut, BodyRecordIdIn
|
||||||
from app.util.auth import login_required
|
from app.util.auth import login_required
|
||||||
|
|
||||||
record = APIBlueprint('record', __name__)
|
record = APIBlueprint('record', __name__)
|
||||||
|
@ -39,6 +39,18 @@ def get_record(record_id):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@record.delete('/<record_id>')
|
||||||
|
@record.doc(summary='删除单条身体记录', description='删除单条身体记录')
|
||||||
|
@record.input(BodyRecordIdIn, location='json')
|
||||||
|
@login_required
|
||||||
|
def get_record(json_data):
|
||||||
|
try:
|
||||||
|
rpc.body_record.delete_one(json_data['record_id'])
|
||||||
|
except Exception as e:
|
||||||
|
raise BodyRecordNotFound(extra_data={'error_docs': str(e)})
|
||||||
|
return {'msg': ' delete body record success'}
|
||||||
|
|
||||||
|
|
||||||
@record.get('/list')
|
@record.get('/list')
|
||||||
@record.doc(summary='查询身体记录列表', description='查询身体记录列表')
|
@record.doc(summary='查询身体记录列表', description='查询身体记录列表')
|
||||||
@record.input(BodyRecordsIn, location='query')
|
@record.input(BodyRecordsIn, location='query')
|
||||||
|
|
|
@ -8,6 +8,10 @@ class BodyRecordIn(Schema):
|
||||||
bmi = fields.Float()
|
bmi = fields.Float()
|
||||||
|
|
||||||
|
|
||||||
|
class BodyRecordIdIn(Schema):
|
||||||
|
record_id = fields.String(required=True)
|
||||||
|
|
||||||
|
|
||||||
class BodyRecordOut(Schema):
|
class BodyRecordOut(Schema):
|
||||||
record_id = fields.String(attribute='_id')
|
record_id = fields.String(attribute='_id')
|
||||||
height = fields.Float()
|
height = fields.Float()
|
||||||
|
|
Loading…
Reference in New Issue