优化券码操作类型, 增加手动销毁
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
approveAdminKuaishouIndustryRefund,
|
||||
checkAdminKuaishouIndustryVoucherAvailable,
|
||||
consumeAdminKuaishouIndustryVoucherByCode,
|
||||
destroyAdminKuaishouIndustryVoucherByCode,
|
||||
disagreeAdminKuaishouIndustryRefund,
|
||||
listAdminKuaishouIndustryRefunds,
|
||||
listAdminKuaishouIndustryShops,
|
||||
@@ -17,6 +18,7 @@ import type {
|
||||
AdminKuaishouIndustryRefundListRouteBody,
|
||||
AdminKuaishouIndustryVoucherCheckAvailableRouteBody,
|
||||
AdminKuaishouIndustryVoucherConsumeRouteBody,
|
||||
AdminKuaishouIndustryVoucherDestroyRouteBody,
|
||||
AdminKuaishouIndustryVoucherResendRouteBody,
|
||||
AdminKuaishouIndustryVoucherReverseRouteBody,
|
||||
} from '../../types/admin/route-inputs.js'
|
||||
@@ -156,6 +158,23 @@ router.post(
|
||||
),
|
||||
)
|
||||
|
||||
router.post(
|
||||
'/kuaishou-industry/vouchers/destroy',
|
||||
requireAdminRoles(['admin', 'operator']),
|
||||
createJsonHandler(
|
||||
(req) =>
|
||||
destroyAdminKuaishouIndustryVoucherByCode(
|
||||
req.body as AdminKuaishouIndustryVoucherDestroyRouteBody,
|
||||
),
|
||||
{
|
||||
successMessage: '电子凭证已手动销毁',
|
||||
errorMessage: '手动销毁电子凭证失败',
|
||||
scope: '[admin/kuaishou-industry/vouchers/destroy]',
|
||||
audit: (req, data) => buildKuaishouIndustryAudit('kuaishou_industry_voucher_destroy', req.body, data),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
function buildKuaishouIndustryAudit(action: string, body: unknown, data: unknown) {
|
||||
const payload = body && typeof body === 'object' ? body as Record<string, unknown> : {}
|
||||
const result = data && typeof data === 'object' ? data as Record<string, unknown> : {}
|
||||
|
||||
Reference in New Issue
Block a user