This commit is contained in:
D8D Developer
2025-06-27 02:15:38 +00:00
parent 9e88b91ec7
commit e6ca49b039

View File

@@ -1,11 +1,9 @@
import { OpenAPIHono } from '@hono/zod-openapi'
import { errorHandler } from './utils/errorHandler'
import usersRouter from './api/users/index'
import { initConfigRouter, initStatusRouter } from './api/init'
import authRoute from './api/auth/index'
import { AuthContext } from './types/context'
import { AppDataSource } from './data-source'
import { authMiddleware } from './middleware/auth.middleware'
const api = new OpenAPIHono<AuthContext>()
@@ -52,66 +50,9 @@ if(!import.meta.env.PROD){
const userRoutes = api.route('/api/v1/users', usersRouter)
const authRoutes = api.route('/api/v1/auth', authRoute)
const authRoutes = api
.route('/api/v1/auth', authRoute.loginRoute.passwordRoute)
.route('/api/v1/auth', authRoute.loginRoute.smsRoute)
.route('/api/v1/auth', authRoute.logoutRoute)
.route('/api/v1/auth', authRoute.meRoute.meRoute)
.route('/api/v1/auth', authRoute.phoneCode.fixed)
.route('/api/v1/auth', authRoute.phoneCode.sms)
.route('/api/v1/auth', authRoute.registerRoute.registerRoute)
const themeSettingsRoutes = api.route('/api/v1/theme-settings', themeSettingsRoute)
const deviceTypesRoutes = api.route('/api/v1/device-types', deviceTypesRoute)
const deviceInstancesRoutes = api.route('/api/v1/device-instances', deviceInstancesRoute)
const rackRoutes = api.route('/api/v1/rack', rackRoute)
const rackServerTypeRoutes = api.route('/api/v1/rack-server-type', rackServerTypeRoute)
const rackServerRoutes = api.route('/api/v1/rack-server', rackServerRoute)
const zichanTransferRoutes = api.route('/api/v1/zichan-transfer', zichanTransferRoute)
const monitorDataRoutes = api.route('/api/v1/monitor-data', monitorDataRoute)
const monitorMapRoutes = api.route('/api/v1/monitor-map', monitorMapRoute)
const monitorTaskRoutes = api.route('/api/v1/monitor-task', monitorTaskRoute)
const knowInfoRoutes = api.route('/api/v1/know-info', knowInfoRoute)
const fileCategoryRoutes = api.route('/api/v1/file-categories', fileCategoryRoute)
const filesRoutes = api.route('/api/v1/files', filesRoute)
const alertsHandlesRoutes = api.route('/api/v1/alerts/handles', alertsHandlesRoute)
const alertsRoutes = api.route('/api/v1/alerts', alertRoute)
const alertNotifyConfigsRoutes = api.route('/api/v1/alert-notify-configs', alertNotifyConfigsRoute)
const alertRulesRoutes = api.route('/api/v1/alert-rules', alertRulesRoute)
const bigRoutes = api.route('/api/v1/big', bigRoute)
const ssoRoutes = api.route('/api/auth', authRoute.ssoVerify)
export type ApiRoutes = typeof routes
export type AuthRoutes = typeof authRoutes
export type ZichanRoutes = typeof zichanRoutes
export type ZichanCategoryRoutes = typeof zichanCategoryRoutes
export type ZichanAreaRoutes = typeof zichanAreaRoutes
export type UserRoutes = typeof userRoutes
export type ThemeSettingsRoutes = typeof themeSettingsRoutes
export type DeviceTypesRoutes = typeof deviceTypesRoutes
export type DeviceInstancesRoutes = typeof deviceInstancesRoutes
export type RackRoutes = typeof rackRoutes
export type RackServerTypeRoutes = typeof rackServerTypeRoutes
export type RackServerRoutes = typeof rackServerRoutes
export type ZichanTransferRoutes = typeof zichanTransferRoutes
export type MonitorDataRoutes = typeof monitorDataRoutes
export type MonitorTaskRoutes = typeof monitorTaskRoutes
export type AlertsRoutes = typeof alertsRoutes
export type AlertsHandlesRoutes = typeof alertsHandlesRoutes
export type AlertNotifyConfigsRoutes = typeof alertNotifyConfigsRoutes
export type AlertRulesRoutes = typeof alertRulesRoutes
export type MonitorMapRoutes = typeof monitorMapRoutes
export type KnowInfoRoutes = typeof knowInfoRoutes
export type FilesRoutes = typeof filesRoutes
export type FileCategoryRoutes = typeof fileCategoryRoutes
export type BigRoutes = typeof bigRoutes
export default api