实现swagger
This commit is contained in:
310
docs/docs.go
310
docs/docs.go
@@ -23,6 +23,153 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/devices": {
|
||||
"get": {
|
||||
"description": "获取系统中所有设备的列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "获取设备列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "根据提供的信息创建一个新设备",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "创建新设备",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "设备信息",
|
||||
"name": "device",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.CreateDeviceRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/devices/{id}": {
|
||||
"get": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "根据设备ID更新一个已存在的设备信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "更新设备信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "设备ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "要更新的设备信息",
|
||||
"name": "device",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.UpdateDeviceRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "根据用户名和密码创建一个新的系统用户。",
|
||||
@@ -49,37 +196,7 @@ const docTemplate = `{
|
||||
],
|
||||
"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": "服务器内部错误",
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 409, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
@@ -113,37 +230,7 @@ const docTemplate = `{
|
||||
],
|
||||
"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": "服务器内部错误",
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 401, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
@@ -153,6 +240,9 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"controller.Properties": {
|
||||
"type": "object"
|
||||
},
|
||||
"controller.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -169,6 +259,100 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"user.CreateUserRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -240,7 +424,7 @@ const docTemplate = `{
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0",
|
||||
Host: "localhost:8080",
|
||||
Host: "localhost:8086",
|
||||
BasePath: "/api/v1",
|
||||
Schemes: []string{},
|
||||
Title: "猪场管理系统 API",
|
||||
|
||||
@@ -14,9 +14,156 @@
|
||||
},
|
||||
"version": "1.0"
|
||||
},
|
||||
"host": "localhost:8080",
|
||||
"host": "localhost:8086",
|
||||
"basePath": "/api/v1",
|
||||
"paths": {
|
||||
"/devices": {
|
||||
"get": {
|
||||
"description": "获取系统中所有设备的列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "获取设备列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "根据提供的信息创建一个新设备",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "创建新设备",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "设备信息",
|
||||
"name": "device",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.CreateDeviceRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/devices/{id}": {
|
||||
"get": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "根据设备ID更新一个已存在的设备信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"设备管理"
|
||||
],
|
||||
"summary": "更新设备信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "设备ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "要更新的设备信息",
|
||||
"name": "device",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.UpdateDeviceRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务失败,具体错误码和信息见响应体",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "根据用户名和密码创建一个新的系统用户。",
|
||||
@@ -43,37 +190,7 @@
|
||||
],
|
||||
"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": "服务器内部错误",
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 409, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
@@ -107,37 +224,7 @@
|
||||
],
|
||||
"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": "服务器内部错误",
|
||||
"description": "业务失败,具体错误码和信息见响应体(例如400, 401, 500)",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
@@ -147,6 +234,9 @@
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"controller.Properties": {
|
||||
"type": "object"
|
||||
},
|
||||
"controller.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -163,6 +253,100 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"user.CreateUserRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
basePath: /api/v1
|
||||
definitions:
|
||||
controller.Properties:
|
||||
type: object
|
||||
controller.Response:
|
||||
properties:
|
||||
code:
|
||||
@@ -11,6 +13,73 @@ definitions:
|
||||
description: 提示信息
|
||||
type: string
|
||||
type: object
|
||||
device.CreateDeviceRequest:
|
||||
type: object
|
||||
device.DeviceResponse:
|
||||
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
|
||||
type: object
|
||||
device.UpdateDeviceRequest:
|
||||
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'
|
||||
required:
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
models.DeviceSubType:
|
||||
enum:
|
||||
- ""
|
||||
- temperature
|
||||
- humidity
|
||||
- ammonia
|
||||
- feed_valve
|
||||
- fan
|
||||
- water_curtain
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- SubTypeNone
|
||||
- SubTypeSensorTemp
|
||||
- SubTypeSensorHumidity
|
||||
- SubTypeSensorAmmonia
|
||||
- SubTypeValveFeed
|
||||
- SubTypeFan
|
||||
- SubTypeWaterCurtain
|
||||
models.DeviceType:
|
||||
enum:
|
||||
- area_controller
|
||||
- device
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- DeviceTypeAreaController
|
||||
- DeviceTypeDevice
|
||||
user.CreateUserRequest:
|
||||
properties:
|
||||
password:
|
||||
@@ -57,7 +126,7 @@ definitions:
|
||||
example: testuser
|
||||
type: string
|
||||
type: object
|
||||
host: localhost:8080
|
||||
host: localhost:8086
|
||||
info:
|
||||
contact:
|
||||
email: divano@example.com
|
||||
@@ -70,6 +139,103 @@ info:
|
||||
title: 猪场管理系统 API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/devices:
|
||||
get:
|
||||
description: 获取系统中所有设备的列表
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 获取设备列表
|
||||
tags:
|
||||
- 设备管理
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据提供的信息创建一个新设备
|
||||
parameters:
|
||||
- description: 设备信息
|
||||
in: body
|
||||
name: device
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/device.CreateDeviceRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 创建新设备
|
||||
tags:
|
||||
- 设备管理
|
||||
/devices/{id}:
|
||||
delete:
|
||||
description: 根据设备ID删除一个设备(软删除)
|
||||
parameters:
|
||||
- description: 设备ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 删除设备
|
||||
tags:
|
||||
- 设备管理
|
||||
get:
|
||||
description: 根据设备ID获取单个设备的详细信息
|
||||
parameters:
|
||||
- description: 设备ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 获取设备信息
|
||||
tags:
|
||||
- 设备管理
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据设备ID更新一个已存在的设备信息
|
||||
parameters:
|
||||
- description: 设备ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: 要更新的设备信息
|
||||
in: body
|
||||
name: device
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/device.UpdateDeviceRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 业务失败,具体错误码和信息见响应体
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 更新设备信息
|
||||
tags:
|
||||
- 设备管理
|
||||
/users:
|
||||
post:
|
||||
consumes:
|
||||
@@ -86,24 +252,7 @@ paths:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 用户创建成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/controller.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/user.CreateUserResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: 请求参数错误
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
"409":
|
||||
description: 用户名已存在
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
"500":
|
||||
description: 服务器内部错误
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 409, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 创建新用户
|
||||
@@ -125,24 +274,7 @@ paths:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 登录成功
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/controller.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/user.LoginResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: 请求参数错误
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
"401":
|
||||
description: 用户名或密码不正确
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
"500":
|
||||
description: 服务器内部错误
|
||||
description: 业务失败,具体错误码和信息见响应体(例如400, 401, 500)
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
summary: 用户登录
|
||||
|
||||
Reference in New Issue
Block a user