全局审计日志
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
# inventory-backend/app/api/v1/warehouse.py
|
||||
from flask import Blueprint, request, jsonify
|
||||
from flask_jwt_extended import jwt_required
|
||||
from app.extensions import db
|
||||
from app.models.system import SysWarehouseLocation
|
||||
from app.utils.decorators import audit_log
|
||||
|
||||
warehouse_bp = Blueprint('warehouse', __name__, url_prefix='/api/v1/warehouse')
|
||||
|
||||
@ -49,6 +51,12 @@ def get_tree():
|
||||
|
||||
|
||||
@warehouse_bp.route('', methods=['POST'])
|
||||
@jwt_required()
|
||||
@audit_log(
|
||||
module='库位管理',
|
||||
action='新增',
|
||||
get_target_name_fn=lambda: request.get_json().get('name') if request.get_json() else None
|
||||
)
|
||||
def create_location():
|
||||
"""
|
||||
创建库位
|
||||
@ -100,6 +108,13 @@ def create_location():
|
||||
|
||||
|
||||
@warehouse_bp.route('/<int:location_id>', methods=['PUT'])
|
||||
@jwt_required()
|
||||
@audit_log(
|
||||
module='库位管理',
|
||||
action='修改',
|
||||
get_target_id_fn=lambda: request.view_args.get('location_id'),
|
||||
get_target_name_fn=lambda: request.get_json().get('name') if request.get_json() else None
|
||||
)
|
||||
def update_location(location_id):
|
||||
"""
|
||||
更新库位
|
||||
@ -144,6 +159,12 @@ def update_location(location_id):
|
||||
|
||||
|
||||
@warehouse_bp.route('/<int:location_id>', methods=['DELETE'])
|
||||
@jwt_required()
|
||||
@audit_log(
|
||||
module='库位管理',
|
||||
action='删除',
|
||||
get_target_id_fn=lambda: request.view_args.get('location_id')
|
||||
)
|
||||
def delete_location(location_id):
|
||||
"""
|
||||
删除库位(级联删除子库位)
|
||||
|
||||
Reference in New Issue
Block a user