refactor(router): extract route registration into helper methods

This commit is contained in:
ryan
2026-06-13 16:27:08 +08:00
parent 922f764241
commit 5698169f20
6 changed files with 253 additions and 228 deletions
+32 -32
View File
@@ -107,6 +107,38 @@ const docTemplate = `{
}
}
},
"/api/health": {
"get": {
"description": "检查服务是否正常运行,可用于负载均衡存活探测",
"produces": [
"application/json"
],
"tags": [
"health"
],
"summary": "健康检查",
"responses": {
"200": {
"description": "服务正常",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"type": "string"
}
}
}
]
}
}
}
}
},
"/api/v1/admin/auth-sources": {
"get": {
"security": [
@@ -3426,38 +3458,6 @@ const docTemplate = `{
}
}
},
"/api/v1/health": {
"get": {
"description": "检查服务是否正常运行,可用于负载均衡存活探测",
"produces": [
"application/json"
],
"tags": [
"health"
],
"summary": "健康检查",
"responses": {
"200": {
"description": "服务正常",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"type": "string"
}
}
}
]
}
}
}
}
},
"/api/v1/oauth/callback": {
"post": {
"description": "接收前端传回的 state 和 code,完成 OAuth/OIDC 认证并建立会话。支持登录(login)和账号绑定(bind)两种场景。",
+32 -32
View File
@@ -100,6 +100,38 @@
}
}
},
"/api/health": {
"get": {
"description": "检查服务是否正常运行,可用于负载均衡存活探测",
"produces": [
"application/json"
],
"tags": [
"health"
],
"summary": "健康检查",
"responses": {
"200": {
"description": "服务正常",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"type": "string"
}
}
}
]
}
}
}
}
},
"/api/v1/admin/auth-sources": {
"get": {
"security": [
@@ -3419,38 +3451,6 @@
}
}
},
"/api/v1/health": {
"get": {
"description": "检查服务是否正常运行,可用于负载均衡存活探测",
"produces": [
"application/json"
],
"tags": [
"health"
],
"summary": "健康检查",
"responses": {
"200": {
"description": "服务正常",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"type": "string"
}
}
}
]
}
}
}
}
},
"/api/v1/oauth/callback": {
"post": {
"description": "接收前端传回的 state 和 code,完成 OAuth/OIDC 认证并建立会话。支持登录(login)和账号绑定(bind)两种场景。",
+18 -18
View File
@@ -1190,6 +1190,24 @@ paths:
summary: 校验人机验证解答
tags:
- cap
/api/health:
get:
description: 检查服务是否正常运行,可用于负载均衡存活探测
produces:
- application/json
responses:
"200":
description: 服务正常
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
summary: 健康检查
tags:
- health
/api/v1/admin/auth-sources:
get:
description: 返回所有已配置的 OAuth/OIDC 认证源列表,包括已启用和未启用的,需要管理员权限
@@ -3193,24 +3211,6 @@ paths:
summary: Sample Hello API
tags:
- custom
/api/v1/health:
get:
description: 检查服务是否正常运行,可用于负载均衡存活探测
produces:
- application/json
responses:
"200":
description: 服务正常
schema:
allOf:
- $ref: '#/definitions/util.ResponseAny'
- properties:
data:
type: string
type: object
summary: 健康检查
tags:
- health
/api/v1/oauth/{source}/authorize:
get:
description: 根据指定认证源名称发起 OAuth 授权,支持 purpose 参数用于区分登录和账号绑定场景。认证源必须已启用。