feat: 积分商城-供应商-对账-发票3
This commit is contained in:
@@ -3,14 +3,27 @@ import { guardMethod } from '../utils/method.js'
|
||||
import { withErrorBoundary } from '../utils/handler.js'
|
||||
import { basicService } from '../services/basic.service.js'
|
||||
import { minioUploadService, type PreviewInput, type UploadInput } from '../services/minio-upload.service.js'
|
||||
import { readJson } from '../utils/request.js'
|
||||
import { getBearerToken, readJson } from '../utils/request.js'
|
||||
import { adminAuthService, type AdminLoginInput } from '../services/admin-auth.service.js'
|
||||
import { toHttpResponse } from './controller-response.js'
|
||||
|
||||
export const loginController = withErrorBoundary(async (request: Request, _context: Context) => {
|
||||
const methodResponse = guardMethod(request, ['POST'])
|
||||
if (methodResponse) return methodResponse
|
||||
|
||||
return toHttpResponse(basicService.login())
|
||||
return toHttpResponse(await adminAuthService.login(await readJson<AdminLoginInput>(request)))
|
||||
})
|
||||
|
||||
export const adminSessionController = withErrorBoundary(async (request: Request, _context: Context) => {
|
||||
const methodResponse = guardMethod(request, ['POST'])
|
||||
if (methodResponse) return methodResponse
|
||||
return toHttpResponse(await adminAuthService.session(getBearerToken(request)))
|
||||
})
|
||||
|
||||
export const adminLogoutController = withErrorBoundary(async (request: Request, _context: Context) => {
|
||||
const methodResponse = guardMethod(request, ['POST'])
|
||||
if (methodResponse) return methodResponse
|
||||
return toHttpResponse(await adminAuthService.logout(getBearerToken(request)))
|
||||
})
|
||||
|
||||
export const cartAddController = withErrorBoundary(async (request: Request, _context: Context) => {
|
||||
|
||||
Reference in New Issue
Block a user