()
return jsonify({'msg': '删除成功', 'status': 1})
删除用例集合
删除用例集合
删除用例集合
def del_set():
    """ 删除用例集合 """
    data = request.json
    set_id = data.get('id')
    _edit = CaseSet.query.filter_by(id=set_id).first()
    case = Case.query.filter_by(case_set_id=set_id).first()
    if current_user.id != Project.query.filter_by(id=_edit.project_id).first().user_id:
        return jsonify({'msg': '不能删除别人项目下的模块', 'status': 0})
    if case:
        return jsonify({'msg': '请先删除集合下的接口用例', 'status': 0})

    db.session.delete(_edit)
    db.session.commit()
    return jsonify({'msg': '删除成功', 'status': 1})
def del_set ( ) : data = request . json set_id = data . get ( 'id' ) _edit = CaseSet . query . filter_by ( id = set_id ) . first ( ) case = Case . query . filter_by ( case_set_id = set_id ) . first ( ) if current_user . id != Project . query . filter_by ( id = _edit . project_id ) . first ( ) . user_id : return jsonify ( { 'msg' : '不能删除别人项目下的模块', 'status': 0}) if case : return jsonify ( { 'msg' : '请先删除集合下的接口用例', 'status': 0}) db . session . delete ( _edit ) db . session . commit ( ) return jsonify ( { 'msg' : '删除成功', 'statu s : 1})