This commit is contained in:
2026-04-22 22:01:07 +08:00
parent d8716d70b0
commit b317c2a8ea
37 changed files with 1821 additions and 515 deletions

View File

@@ -1,4 +1,4 @@
import { type Request, type Response, Router } from 'express';
import express, { type Request, type Response, Router } from 'express';
import { z } from 'zod';
import type {
@@ -28,6 +28,7 @@ import {
revokeRefreshSession,
revokeUserSession,
sendPhoneLoginCode,
handleAliyunSmsDeliveryReport,
startWechatLogin,
} from '../auth/authService.js';
import {
@@ -116,6 +117,8 @@ export function createAuthRoutes(context: AppContext) {
const router = Router();
const requireAuth = requireJwtAuth(context.config, context.userRepository);
router.use('/phone/delivery-report/aliyun', express.urlencoded({ extended: false }));
router.get(
'/login-options',
routeMeta({ operation: 'auth.login_options' }),
@@ -178,6 +181,22 @@ export function createAuthRoutes(context: AppContext) {
}),
);
router.post(
'/phone/delivery-report/aliyun',
routeMeta({ operation: 'auth.phone.delivery_report.aliyun' }),
asyncHandler(async (request, response) => {
const payload =
request.body && typeof request.body === 'object'
? (request.body as Record<string, unknown>)
: {};
sendApiResponse(
response,
await handleAliyunSmsDeliveryReport(context, payload),
);
}),
);
router.post(
'/phone/change',
routeMeta({ operation: 'auth.phone.change' }),