feat: 为核心业务 API 全面挂载审计日志装饰器
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
from flask import Blueprint, request, jsonify
|
||||
from app.services.inbound.buy_service import BuyInboundService
|
||||
from app.utils.decorators import permission_required
|
||||
from app.utils.decorators import permission_required, audit_log
|
||||
import traceback
|
||||
|
||||
inbound_buy_bp = Blueprint('stock_buy', __name__)
|
||||
@ -155,6 +155,11 @@ def get_list():
|
||||
# ------------------------------------------------------------------
|
||||
@inbound_buy_bp.route('/submit', methods=['POST'])
|
||||
@permission_required('inbound_buy:operation')
|
||||
@audit_log(
|
||||
module='采购入库',
|
||||
action='新增',
|
||||
get_target_name_fn=lambda: request.get_json().get('material_name') if request.get_json() else None
|
||||
)
|
||||
def submit():
|
||||
try:
|
||||
data = request.get_json()
|
||||
@ -224,6 +229,12 @@ def submit():
|
||||
# ------------------------------------------------------------------
|
||||
@inbound_buy_bp.route('/<int:id>', methods=['PUT'])
|
||||
@permission_required('inbound_buy:operation')
|
||||
@audit_log(
|
||||
module='采购入库',
|
||||
action='修改',
|
||||
get_target_id_fn=lambda: request.view_args.get('id'),
|
||||
get_target_name_fn=lambda: request.get_json().get('material_name') if request.get_json() else None
|
||||
)
|
||||
def update_buy(id):
|
||||
try:
|
||||
data = request.get_json()
|
||||
@ -283,6 +294,11 @@ def update_buy(id):
|
||||
# ------------------------------------------------------------------
|
||||
@inbound_buy_bp.route('/<int:id>', methods=['DELETE'])
|
||||
@permission_required('inbound_buy:operation')
|
||||
@audit_log(
|
||||
module='采购入库',
|
||||
action='删除',
|
||||
get_target_id_fn=lambda: request.view_args.get('id')
|
||||
)
|
||||
def delete_buy(id):
|
||||
try:
|
||||
BuyInboundService.delete_inbound(id)
|
||||
|
||||
Reference in New Issue
Block a user