diff --git a/docs/docs.go b/docs/docs.go index 329a40f..94911d7 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1939,6 +1939,46 @@ const docTemplate = `{ } } }, + "/dashboard/stats": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "description": "返回平台核心指标的统计数据", + "produces": [ + "application/json" + ], + "tags": [ + "Dashboard" + ], + "summary": "仪表盘统计", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/internal_modules_dashboard_interfaces.StatsResponse" + } + } + } + ] + } + } + } + } + }, "/health": { "get": { "description": "检查 PostgreSQL 和 Redis 连接状态", @@ -2185,6 +2225,248 @@ const docTemplate = `{ } } } + }, + "/users": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "description": "分页获取当前租户下的用户列表,支持搜索和状态过滤", + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "用户列表", + "parameters": [ + { + "type": "integer", + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "search", + "in": "query" + }, + { + "type": "integer", + "description": "状态过滤", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "创建用户", + "parameters": [ + { + "description": "用户信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.CreateUserRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO" + } + } + } + ] + } + } + } + } + }, + "/users/{id}": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "获取用户详情", + "parameters": [ + { + "type": "integer", + "description": "用户 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "更新用户", + "parameters": [ + { + "type": "integer", + "description": "用户 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新内容", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UpdateUserRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "tags": [ + "Users" + ], + "summary": "删除用户", + "parameters": [ + { + "type": "integer", + "description": "用户 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + } + } + } + } } }, "definitions": { @@ -2240,6 +2522,35 @@ const docTemplate = `{ } } }, + "internal_modules_dashboard_interfaces.StatsResponse": { + "type": "object", + "properties": { + "onlineCount": { + "type": "integer" + }, + "roleCount": { + "type": "integer" + }, + "roleGrowth": { + "type": "number" + }, + "tenantCount": { + "type": "integer" + }, + "tenantGrowth": { + "type": "number" + }, + "todayActiveUsers": { + "type": "integer" + }, + "userCount": { + "type": "integer" + }, + "userGrowth": { + "type": "number" + } + } + }, "mengstack_internal_app_version.Info": { "type": "object", "properties": { @@ -2295,6 +2606,35 @@ const docTemplate = `{ } } }, + "mengstack_internal_modules_auth_domain.CreateUserRequest": { + "type": "object", + "required": [ + "email", + "password", + "username" + ], + "properties": { + "email": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "password": { + "type": "string", + "maxLength": 128, + "minLength": 8 + }, + "status": { + "type": "integer" + }, + "username": { + "type": "string", + "maxLength": 64, + "minLength": 3 + } + } + }, "mengstack_internal_modules_auth_domain.LoginRequest": { "type": "object", "required": [ @@ -2350,6 +2690,20 @@ const docTemplate = `{ } } }, + "mengstack_internal_modules_auth_domain.UpdateUserRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "status": { + "type": "integer" + } + } + }, "mengstack_internal_modules_auth_domain.UserDTO": { "type": "object", "properties": { @@ -2362,6 +2716,9 @@ const docTemplate = `{ "id": { "type": "integer" }, + "last_login": { + "type": "string" + }, "nickname": { "type": "string" }, diff --git a/docs/swagger.json b/docs/swagger.json index d918b59..09be539 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1933,6 +1933,46 @@ } } }, + "/dashboard/stats": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "description": "返回平台核心指标的统计数据", + "produces": [ + "application/json" + ], + "tags": [ + "Dashboard" + ], + "summary": "仪表盘统计", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/internal_modules_dashboard_interfaces.StatsResponse" + } + } + } + ] + } + } + } + } + }, "/health": { "get": { "description": "检查 PostgreSQL 和 Redis 连接状态", @@ -2179,6 +2219,248 @@ } } } + }, + "/users": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "description": "分页获取当前租户下的用户列表,支持搜索和状态过滤", + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "用户列表", + "parameters": [ + { + "type": "integer", + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "每页数量", + "name": "page_size", + "in": "query" + }, + { + "type": "string", + "description": "搜索关键词", + "name": "search", + "in": "query" + }, + { + "type": "integer", + "description": "状态过滤", + "name": "status", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "创建用户", + "parameters": [ + { + "description": "用户信息", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.CreateUserRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO" + } + } + } + ] + } + } + } + } + }, + "/users/{id}": { + "get": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "获取用户详情", + "parameters": [ + { + "type": "integer", + "description": "用户 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO" + } + } + } + ] + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "更新用户", + "parameters": [ + { + "type": "integer", + "description": "用户 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "更新内容", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UpdateUserRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/mengstack_internal_modules_auth_domain.UserDTO" + } + } + } + ] + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + }, + { + "TenantID": [] + } + ], + "tags": [ + "Users" + ], + "summary": "删除用户", + "parameters": [ + { + "type": "integer", + "description": "用户 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/mengstack_internal_kernel_response.Response" + } + } + } + } } }, "definitions": { @@ -2234,6 +2516,35 @@ } } }, + "internal_modules_dashboard_interfaces.StatsResponse": { + "type": "object", + "properties": { + "onlineCount": { + "type": "integer" + }, + "roleCount": { + "type": "integer" + }, + "roleGrowth": { + "type": "number" + }, + "tenantCount": { + "type": "integer" + }, + "tenantGrowth": { + "type": "number" + }, + "todayActiveUsers": { + "type": "integer" + }, + "userCount": { + "type": "integer" + }, + "userGrowth": { + "type": "number" + } + } + }, "mengstack_internal_app_version.Info": { "type": "object", "properties": { @@ -2289,6 +2600,35 @@ } } }, + "mengstack_internal_modules_auth_domain.CreateUserRequest": { + "type": "object", + "required": [ + "email", + "password", + "username" + ], + "properties": { + "email": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "password": { + "type": "string", + "maxLength": 128, + "minLength": 8 + }, + "status": { + "type": "integer" + }, + "username": { + "type": "string", + "maxLength": 64, + "minLength": 3 + } + } + }, "mengstack_internal_modules_auth_domain.LoginRequest": { "type": "object", "required": [ @@ -2344,6 +2684,20 @@ } } }, + "mengstack_internal_modules_auth_domain.UpdateUserRequest": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "nickname": { + "type": "string" + }, + "status": { + "type": "integer" + } + } + }, "mengstack_internal_modules_auth_domain.UserDTO": { "type": "object", "properties": { @@ -2356,6 +2710,9 @@ "id": { "type": "integer" }, + "last_login": { + "type": "string" + }, "nickname": { "type": "string" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0501ef0..89b546f 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -34,6 +34,25 @@ definitions: manifest: $ref: '#/definitions/internal_app_upgrade.Manifest' type: object + internal_modules_dashboard_interfaces.StatsResponse: + properties: + onlineCount: + type: integer + roleCount: + type: integer + roleGrowth: + type: number + tenantCount: + type: integer + tenantGrowth: + type: number + todayActiveUsers: + type: integer + userCount: + type: integer + userGrowth: + type: number + type: object mengstack_internal_app_version.Info: properties: arch: @@ -71,6 +90,27 @@ definitions: - new_password - old_password type: object + mengstack_internal_modules_auth_domain.CreateUserRequest: + properties: + email: + type: string + nickname: + type: string + password: + maxLength: 128 + minLength: 8 + type: string + status: + type: integer + username: + maxLength: 64 + minLength: 3 + type: string + required: + - email + - password + - username + type: object mengstack_internal_modules_auth_domain.LoginRequest: properties: email: @@ -109,6 +149,15 @@ definitions: refresh_token: type: string type: object + mengstack_internal_modules_auth_domain.UpdateUserRequest: + properties: + email: + type: string + nickname: + type: string + status: + type: integer + type: object mengstack_internal_modules_auth_domain.UserDTO: properties: avatar: @@ -117,6 +166,8 @@ definitions: type: string id: type: integer + last_login: + type: string nickname: type: string status: @@ -1430,6 +1481,27 @@ paths: summary: 用户注册 tags: - Auth + /dashboard/stats: + get: + description: 返回平台核心指标的统计数据 + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/mengstack_internal_kernel_response.Response' + - properties: + data: + $ref: '#/definitions/internal_modules_dashboard_interfaces.StatsResponse' + type: object + security: + - Bearer: [] + - TenantID: [] + summary: 仪表盘统计 + tags: + - Dashboard /health: get: description: 检查 PostgreSQL 和 Redis 连接状态 @@ -1581,6 +1653,144 @@ paths: summary: 就绪探针 tags: - System + /users: + get: + description: 分页获取当前租户下的用户列表,支持搜索和状态过滤 + parameters: + - description: 页码 + in: query + name: page + type: integer + - description: 每页数量 + in: query + name: page_size + type: integer + - description: 搜索关键词 + in: query + name: search + type: string + - description: 状态过滤 + in: query + name: status + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/mengstack_internal_kernel_response.Response' + security: + - Bearer: [] + - TenantID: [] + summary: 用户列表 + tags: + - Users + post: + consumes: + - application/json + parameters: + - description: 用户信息 + in: body + name: request + required: true + schema: + $ref: '#/definitions/mengstack_internal_modules_auth_domain.CreateUserRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/mengstack_internal_kernel_response.Response' + - properties: + data: + $ref: '#/definitions/mengstack_internal_modules_auth_domain.UserDTO' + type: object + security: + - Bearer: [] + - TenantID: [] + summary: 创建用户 + tags: + - Users + /users/{id}: + delete: + parameters: + - description: 用户 ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: '#/definitions/mengstack_internal_kernel_response.Response' + security: + - Bearer: [] + - TenantID: [] + summary: 删除用户 + tags: + - Users + get: + parameters: + - description: 用户 ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/mengstack_internal_kernel_response.Response' + - properties: + data: + $ref: '#/definitions/mengstack_internal_modules_auth_domain.UserDTO' + type: object + security: + - Bearer: [] + - TenantID: [] + summary: 获取用户详情 + tags: + - Users + put: + consumes: + - application/json + parameters: + - description: 用户 ID + in: path + name: id + required: true + type: integer + - description: 更新内容 + in: body + name: request + required: true + schema: + $ref: '#/definitions/mengstack_internal_modules_auth_domain.UpdateUserRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/mengstack_internal_kernel_response.Response' + - properties: + data: + $ref: '#/definitions/mengstack_internal_modules_auth_domain.UserDTO' + type: object + security: + - Bearer: [] + - TenantID: [] + summary: 更新用户 + tags: + - Users securityDefinitions: Bearer: description: Bearer