Files
pig-farm-controller/docs/docs.go
2025-09-12 16:58:39 +08:00

257 lines
8.3 KiB
Go

// 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": {
"name": "Divano",
"url": "http://www.example.com",
"email": "divano@example.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/users": {
"post": {
"description": "根据用户名和密码创建一个新的系统用户。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "创建新用户",
"parameters": [
{
"description": "用户信息",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "用户创建成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.CreateUserResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"409": {
"description": "用户名已存在",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/users/login": {
"post": {
"description": "用户使用用户名和密码登录,成功后返回 JWT 令牌。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "用户登录",
"parameters": [
{
"description": "登录凭证",
"name": "credentials",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "登录成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.LoginResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"401": {
"description": "用户名或密码不正确",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
}
},
"definitions": {
"controller.Response": {
"type": "object",
"properties": {
"code": {
"description": "业务状态码",
"type": "integer"
},
"data": {
"description": "业务数据"
},
"message": {
"description": "提示信息",
"type": "string"
}
}
},
"user.CreateUserRequest": {
"type": "object",
"required": [
"password",
"username"
],
"properties": {
"password": {
"type": "string",
"minLength": 6,
"example": "password123"
},
"username": {
"type": "string",
"example": "newuser"
}
}
},
"user.CreateUserResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"username": {
"type": "string",
"example": "newuser"
}
}
},
"user.LoginRequest": {
"type": "object",
"required": [
"password",
"username"
],
"properties": {
"password": {
"type": "string",
"example": "password123"
},
"username": {
"type": "string",
"example": "testuser"
}
}
},
"user.LoginResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"token": {
"type": "string",
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
},
"username": {
"type": "string",
"example": "testuser"
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8080",
BasePath: "/api/v1",
Schemes: []string{},
Title: "猪场管理系统 API",
Description: "这是一个用于管理猪场设备的后端服务。",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}