Files
pig-farm-controller/docs/docs.go

433 lines
13 KiB
Go
Raw Normal View History

2025-09-12 16:58:39 +08:00
// 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}}",
2025-09-12 20:32:29 +08:00
"contact": {},
2025-09-12 16:58:39 +08:00
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
2025-09-12 17:43:42 +08:00
"/devices": {
"get": {
"description": "获取系统中所有设备的列表",
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "获取设备列表",
"responses": {
"200": {
"description": "业务失败,具体错误码和信息见响应体",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
},
2025-09-12 16:58:39 +08:00
"post": {
2025-09-12 17:43:42 +08:00
"description": "根据提供的信息创建一个新设备",
2025-09-12 16:58:39 +08:00
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
2025-09-12 17:43:42 +08:00
"设备管理"
2025-09-12 16:58:39 +08:00
],
2025-09-12 17:43:42 +08:00
"summary": "创建新设备",
2025-09-12 16:58:39 +08:00
"parameters": [
{
2025-09-12 17:43:42 +08:00
"description": "设备信息",
"name": "device",
2025-09-12 16:58:39 +08:00
"in": "body",
"required": true,
"schema": {
2025-09-12 17:43:42 +08:00
"$ref": "#/definitions/device.CreateDeviceRequest"
2025-09-12 16:58:39 +08:00
}
}
],
"responses": {
"200": {
2025-09-12 17:43:42 +08:00
"description": "业务失败,具体错误码和信息见响应体",
2025-09-12 16:58:39 +08:00
"schema": {
2025-09-12 17:43:42 +08:00
"$ref": "#/definitions/controller.Response"
2025-09-12 16:58:39 +08:00
}
2025-09-12 17:43:42 +08:00
}
}
}
},
"/devices/{id}": {
"get": {
"description": "根据设备ID获取单个设备的详细信息",
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "获取设备信息",
"parameters": [
{
"type": "string",
"description": "设备ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "业务失败,具体错误码和信息见响应体",
2025-09-12 16:58:39 +08:00
"schema": {
"$ref": "#/definitions/controller.Response"
}
2025-09-12 17:43:42 +08:00
}
}
},
"put": {
"description": "根据设备ID更新一个已存在的设备信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "更新设备信息",
"parameters": [
{
"type": "string",
"description": "设备ID",
"name": "id",
"in": "path",
"required": true
2025-09-12 16:58:39 +08:00
},
2025-09-12 17:43:42 +08:00
{
"description": "要更新的设备信息",
"name": "device",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/device.UpdateDeviceRequest"
}
}
],
"responses": {
"200": {
"description": "业务失败,具体错误码和信息见响应体",
2025-09-12 16:58:39 +08:00
"schema": {
"$ref": "#/definitions/controller.Response"
}
2025-09-12 17:43:42 +08:00
}
}
},
"delete": {
"description": "根据设备ID删除一个设备软删除",
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "删除设备",
"parameters": [
{
"type": "string",
"description": "设备ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "业务失败,具体错误码和信息见响应体",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/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": "业务失败具体错误码和信息见响应体例如400, 409, 500",
2025-09-12 16:58:39 +08:00
"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": {
2025-09-12 17:43:42 +08:00
"description": "业务失败具体错误码和信息见响应体例如400, 401, 500",
2025-09-12 16:58:39 +08:00
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
}
},
"definitions": {
2025-09-12 17:43:42 +08:00
"controller.Properties": {
"type": "object"
},
2025-09-12 16:58:39 +08:00
"controller.Response": {
"type": "object",
"properties": {
"code": {
"description": "业务状态码",
"type": "integer"
},
"data": {
"description": "业务数据"
},
"message": {
"description": "提示信息",
"type": "string"
}
}
},
2025-09-12 17:43:42 +08:00
"device.CreateDeviceRequest": {
"type": "object"
},
"device.DeviceResponse": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"location": {
"type": "string"
},
"name": {
"type": "string"
},
"parent_id": {
"type": "integer"
},
"properties": {
"$ref": "#/definitions/controller.Properties"
},
"sub_type": {
"$ref": "#/definitions/models.DeviceSubType"
},
"type": {
"$ref": "#/definitions/models.DeviceType"
},
"updated_at": {
"type": "string"
}
}
},
"device.UpdateDeviceRequest": {
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"location": {
"type": "string"
},
"name": {
"type": "string"
},
"parent_id": {
"type": "integer"
},
"properties": {
"$ref": "#/definitions/controller.Properties"
},
"sub_type": {
"$ref": "#/definitions/models.DeviceSubType"
},
"type": {
"$ref": "#/definitions/models.DeviceType"
}
}
},
"models.DeviceSubType": {
"type": "string",
"enum": [
"",
"temperature",
"humidity",
"ammonia",
"feed_valve",
"fan",
"water_curtain"
],
"x-enum-varnames": [
"SubTypeNone",
"SubTypeSensorTemp",
"SubTypeSensorHumidity",
"SubTypeSensorAmmonia",
"SubTypeValveFeed",
"SubTypeFan",
"SubTypeWaterCurtain"
]
},
"models.DeviceType": {
"type": "string",
"enum": [
"area_controller",
"device"
],
"x-enum-varnames": [
"DeviceTypeAreaController",
"DeviceTypeDevice"
]
},
2025-09-12 16:58:39 +08:00
"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{
2025-09-12 20:32:29 +08:00
Version: "",
Host: "",
BasePath: "",
2025-09-12 16:58:39 +08:00
Schemes: []string{},
2025-09-12 20:32:29 +08:00
Title: "",
Description: "",
2025-09-12 16:58:39 +08:00
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}