// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/repos": { "get": { "description": "分页查询仓库列表,支持按状态筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "获取仓库列表", "parameters": [ { "type": "string", "description": "状态筛选(pending/cloning/ready/failed)", "name": "status", "in": "query" }, { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 20, "description": "每页数量", "name": "page_size", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/repos/batch": { "post": { "description": "批量添加多个Git仓库,异步克隆到本地", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "批量添加仓库", "parameters": [ { "description": "仓库URL列表", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.AddReposRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.AddReposResponse" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/repos/{id}": { "get": { "description": "根据ID获取仓库详细信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "获取仓库详情", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/models.Repository" } } } ] } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/handlers.Response" } } } }, "delete": { "description": "删除指定仓库", "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "删除仓库", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.Response" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/repos/{id}/branches": { "get": { "description": "获取指定仓库的所有分支", "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "获取仓库分支列表", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/repos/{id}/reset": { "post": { "description": "异步重置仓库到最新状态", "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "重置仓库", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/models.Task" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/repos/{id}/switch-branch": { "post": { "description": "异步切换仓库到指定分支", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "切换仓库分支", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "id", "in": "path", "required": true }, { "description": "分支名称", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "properties": { "branch": { "type": "string" } } } } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/models.Task" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/repos/{id}/update": { "post": { "description": "异步拉取仓库最新代码(git pull)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "仓库管理" ], "summary": "更新仓库", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/models.Task" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/stats/caches": { "get": { "description": "获取已计算的统计缓存列表", "produces": [ "application/json" ], "tags": [ "统计管理" ], "summary": "获取统计缓存列表", "parameters": [ { "type": "integer", "description": "仓库ID(可选,不传则返回所有)", "name": "repo_id", "in": "query" }, { "type": "integer", "default": 50, "description": "返回数量限制", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/stats/calculate": { "post": { "description": "异步触发统计计算任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "统计管理" ], "summary": "触发统计任务", "parameters": [ { "description": "统计请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/service.CalculateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/models.Task" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/stats/commits/count": { "get": { "description": "统计指定条件下的提交次数", "produces": [ "application/json" ], "tags": [ "统计管理" ], "summary": "统计提交次数", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "repo_id", "in": "query", "required": true }, { "type": "string", "description": "分支名称", "name": "branch", "in": "query", "required": true }, { "type": "string", "description": "开始日期", "name": "from", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/service.CountCommitsResponse" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/stats/query": { "get": { "description": "查询统计计算结果", "produces": [ "application/json" ], "tags": [ "统计管理" ], "summary": "查询统计结果", "parameters": [ { "type": "integer", "description": "仓库ID", "name": "repo_id", "in": "query", "required": true }, { "type": "string", "description": "分支名称", "name": "branch", "in": "query", "required": true }, { "type": "string", "description": "约束类型", "name": "constraint_type", "in": "query" }, { "type": "string", "description": "开始日期", "name": "from", "in": "query" }, { "type": "string", "description": "结束日期", "name": "to", "in": "query" }, { "type": "integer", "description": "提交数限制", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/models.StatsResult" } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.Response" } } } } }, "/tasks": { "get": { "description": "查询任务列表,可按状态过滤", "produces": [ "application/json" ], "tags": [ "任务管理" ], "summary": "查询任务列表", "parameters": [ { "type": "string", "description": "任务状态", "name": "status", "in": "query" }, { "type": "integer", "default": 50, "description": "返回数量限制", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/handlers.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.Response" } } } } } }, "definitions": { "handlers.Response": { "type": "object", "properties": { "code": { "type": "integer" }, "data": {}, "message": { "type": "string" } } }, "models.ContributorStats": { "type": "object", "properties": { "additions": { "description": "新增行数", "type": "integer" }, "author": { "type": "string" }, "commits": { "type": "integer" }, "deletions": { "description": "删除行数", "type": "integer" }, "email": { "type": "string" }, "modifications": { "description": "修改行数 = min(additions, deletions)", "type": "integer" }, "net_additions": { "description": "净增加 = additions - deletions", "type": "integer" } } }, "models.DateRange": { "type": "object", "properties": { "from": { "type": "string" }, "to": { "type": "string" } } }, "models.Repository": { "type": "object", "properties": { "created_at": { "type": "string" }, "current_branch": { "type": "string" }, "error_message": { "type": "string" }, "has_credentials": { "type": "boolean" }, "id": { "type": "integer" }, "last_commit_hash": { "type": "string" }, "last_pull_at": { "type": "string" }, "local_path": { "type": "string" }, "name": { "type": "string" }, "status": { "description": "pending/cloning/ready/failed", "type": "string" }, "updated_at": { "type": "string" }, "url": { "type": "string" } } }, "models.Statistics": { "type": "object", "properties": { "by_contributor": { "type": "array", "items": { "$ref": "#/definitions/models.ContributorStats" } }, "summary": { "$ref": "#/definitions/models.StatsSummary" } } }, "models.StatsConstraint": { "type": "object", "properties": { "from": { "description": "type=date_range时使用", "type": "string" }, "limit": { "description": "type=commit_limit时使用", "type": "integer" }, "to": { "description": "type=date_range时使用", "type": "string" }, "type": { "description": "date_range 或 commit_limit", "type": "string" } } }, "models.StatsResult": { "type": "object", "properties": { "cache_hit": { "type": "boolean" }, "cached_at": { "type": "string" }, "commit_hash": { "type": "string" }, "statistics": { "$ref": "#/definitions/models.Statistics" } } }, "models.StatsSummary": { "type": "object", "properties": { "commit_limit": { "type": "integer" }, "date_range": { "$ref": "#/definitions/models.DateRange" }, "total_commits": { "type": "integer" }, "total_contributors": { "type": "integer" } } }, "models.Task": { "type": "object", "properties": { "completed_at": { "type": "string" }, "created_at": { "type": "string" }, "duration_ms": { "description": "计算字段", "type": "integer" }, "error_message": { "type": "string" }, "id": { "type": "integer" }, "parameters": { "description": "JSON string", "type": "string" }, "priority": { "type": "integer" }, "repo_id": { "type": "integer" }, "result": { "description": "JSON string", "type": "string" }, "retry_count": { "type": "integer" }, "started_at": { "type": "string" }, "status": { "type": "string" }, "task_type": { "type": "string" }, "updated_at": { "type": "string" } } }, "service.AddRepoFailure": { "type": "object", "properties": { "error": { "type": "string" }, "url": { "type": "string" } } }, "service.AddRepoResult": { "type": "object", "properties": { "repo_id": { "type": "integer" }, "task_id": { "type": "integer" }, "url": { "type": "string" } } }, "service.AddReposRequest": { "type": "object", "properties": { "password": { "description": "可选的认证信息", "type": "string" }, "repos": { "type": "array", "items": { "$ref": "#/definitions/service.RepoInput" } }, "username": { "description": "可选的认证信息", "type": "string" } } }, "service.AddReposResponse": { "type": "object", "properties": { "failed": { "type": "array", "items": { "$ref": "#/definitions/service.AddRepoFailure" } }, "succeeded": { "type": "array", "items": { "$ref": "#/definitions/service.AddRepoResult" } }, "total": { "type": "integer" } } }, "service.CalculateRequest": { "type": "object", "properties": { "branch": { "type": "string" }, "constraint": { "$ref": "#/definitions/models.StatsConstraint" }, "repo_id": { "type": "integer" } } }, "service.CountCommitsResponse": { "type": "object", "properties": { "branch": { "type": "string" }, "commit_count": { "type": "integer" }, "from": { "type": "string" }, "repo_id": { "type": "integer" }, "to": { "type": "string" } } }, "service.RepoInput": { "type": "object", "properties": { "branch": { "type": "string" }, "url": { "type": "string" } } } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "", Host: "", BasePath: "", Schemes: []string{}, Title: "", Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }