feat: 积分商城-供应商-对账-发票4
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { withErrorBoundary } from '../utils/handler.js'
|
||||
import { guardMethod } from '../utils/method.js'
|
||||
import { getBearerToken, readJson } from '../utils/request.js'
|
||||
import { adminAuthService } from '../services/admin-auth.service.js'
|
||||
import { serviceFail } from '../types/service-result.js'
|
||||
import { merchantInvoiceService, type MerchantInvoiceListInput, type MerchantInvoiceFileInput } from '../services/merchant-invoice.service.js'
|
||||
import { toHttpResponse } from './controller-response.js'
|
||||
|
||||
export const merchantInvoiceListController = withErrorBoundary(async request => {
|
||||
const methodResponse = guardMethod(request, ['POST'])
|
||||
if (methodResponse) return methodResponse
|
||||
if (!await adminAuthService.findSession(getBearerToken(request))) return toHttpResponse(serviceFail('登录已失效,请重新登录', 401, 'UNAUTHORIZED'))
|
||||
return toHttpResponse(await merchantInvoiceService.list(await readJson<MerchantInvoiceListInput>(request)))
|
||||
})
|
||||
|
||||
export const merchantInvoiceFileController = withErrorBoundary(async request => {
|
||||
const methodResponse = guardMethod(request, ['POST'])
|
||||
if (methodResponse) return methodResponse
|
||||
if (!await adminAuthService.findSession(getBearerToken(request))) return toHttpResponse(serviceFail('登录已失效,请重新登录', 401, 'UNAUTHORIZED'))
|
||||
return toHttpResponse(await merchantInvoiceService.file(await readJson<MerchantInvoiceFileInput>(request)))
|
||||
})
|
||||
Reference in New Issue
Block a user