添加区域主控相关路由
This commit is contained in:
588
docs/docs.go
588
docs/docs.go
@@ -15,6 +15,204 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/api/v1/area-controllers": {
|
||||
"get": {
|
||||
"description": "获取系统中所有区域主控的列表",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"区域主控管理"
|
||||
],
|
||||
"summary": "获取所有区域主控列表",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/device.AreaControllerResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "根据提供的信息创建一个新区域主控",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"区域主控管理"
|
||||
],
|
||||
"summary": "创建新区域主控",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "区域主控信息",
|
||||
"name": "areaController",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.CreateAreaControllerRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/device.AreaControllerResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/area-controllers/{id}": {
|
||||
"get": {
|
||||
"description": "根据ID获取单个区域主控的详细信息",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"区域主控管理"
|
||||
],
|
||||
"summary": "获取区域主控信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "区域主控ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/device.AreaControllerResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "根据ID更新一个已存在的区域主控信息",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"区域主控管理"
|
||||
],
|
||||
"summary": "更新区域主控信息",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "区域主控ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "要更新的区域主控信息",
|
||||
"name": "areaController",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/device.UpdateAreaControllerRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/device.AreaControllerResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "根据ID删除一个区域主控(软删除)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"区域主控管理"
|
||||
],
|
||||
"summary": "删除区域主控",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "区域主控ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/devices": {
|
||||
"get": {
|
||||
"description": "获取系统中所有设备的列表",
|
||||
@@ -381,7 +579,7 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "根据计划ID删除计划。",
|
||||
"description": "根据计划ID删除计划。(软删除)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -514,7 +712,7 @@ const docTemplate = `{
|
||||
},
|
||||
"/api/v1/users/login": {
|
||||
"post": {
|
||||
"description": "用户使用用户名和密码登录,成功后返回 JWT 令牌。",
|
||||
"description": "用户可以使用用户名、邮箱、手机号、微信号或飞书账号进行登录,成功后返回 JWT 令牌。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -557,6 +755,67 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/users/{id}/history": {
|
||||
"get": {
|
||||
"description": "根据用户ID,分页获取该用户的操作审计日志。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"用户管理"
|
||||
],
|
||||
"summary": "获取指定用户的操作历史",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "用户ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 1,
|
||||
"description": "页码",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"default": 10,
|
||||
"description": "每页大小",
|
||||
"name": "page_size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "按操作类型过滤",
|
||||
"name": "action_type",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "业务码为200代表成功获取",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/user.ListHistoryResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@@ -565,7 +824,11 @@ const docTemplate = `{
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "业务状态码",
|
||||
"type": "integer"
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.ResponseCode"
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"description": "业务数据"
|
||||
@@ -576,63 +839,50 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"device.CreateDeviceRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"type"
|
||||
"controller.ResponseCode": {
|
||||
"type": "integer",
|
||||
"enum": [
|
||||
2000,
|
||||
2001,
|
||||
4000,
|
||||
4001,
|
||||
4004,
|
||||
4009,
|
||||
5000,
|
||||
5003
|
||||
],
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"sub_type": {
|
||||
"$ref": "#/definitions/models.DeviceSubType"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.DeviceType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"device.UpdateDeviceRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"type"
|
||||
"x-enum-comments": {
|
||||
"CodeBadRequest": "请求参数错误",
|
||||
"CodeConflict": "资源冲突",
|
||||
"CodeCreated": "创建成功",
|
||||
"CodeInternalError": "服务器内部错误",
|
||||
"CodeNotFound": "资源未找到",
|
||||
"CodeServiceUnavailable": "服务不可用",
|
||||
"CodeSuccess": "操作成功",
|
||||
"CodeUnauthorized": "未授权"
|
||||
},
|
||||
"x-enum-descriptions": [
|
||||
"操作成功",
|
||||
"创建成功",
|
||||
"请求参数错误",
|
||||
"未授权",
|
||||
"资源未找到",
|
||||
"资源冲突",
|
||||
"服务器内部错误",
|
||||
"服务不可用"
|
||||
],
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"sub_type": {
|
||||
"$ref": "#/definitions/models.DeviceSubType"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.DeviceType"
|
||||
}
|
||||
}
|
||||
"x-enum-varnames": [
|
||||
"CodeSuccess",
|
||||
"CodeCreated",
|
||||
"CodeBadRequest",
|
||||
"CodeUnauthorized",
|
||||
"CodeNotFound",
|
||||
"CodeConflict",
|
||||
"CodeInternalError",
|
||||
"CodeServiceUnavailable"
|
||||
]
|
||||
},
|
||||
"git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse": {
|
||||
"device.AreaControllerResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
@@ -647,57 +897,152 @@ const docTemplate = `{
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
"network_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"sub_type": {
|
||||
"$ref": "#/definitions/models.DeviceSubType"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.DeviceType"
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.DeviceSubType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"",
|
||||
"temperature",
|
||||
"humidity",
|
||||
"ammonia",
|
||||
"weight",
|
||||
"feed_valve",
|
||||
"fan",
|
||||
"water_curtain"
|
||||
"device.CreateAreaControllerRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"network_id"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"SubTypeNone",
|
||||
"SubTypeSensorTemp",
|
||||
"SubTypeSensorHumidity",
|
||||
"SubTypeSensorAmmonia",
|
||||
"SubTypeSensorWeight",
|
||||
"SubTypeValveFeed",
|
||||
"SubTypeFan",
|
||||
"SubTypeWaterCurtain"
|
||||
]
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"network_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.DeviceType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"area_controller",
|
||||
"device"
|
||||
"device.CreateDeviceRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"area_controller_id",
|
||||
"device_template_id",
|
||||
"name"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"DeviceTypeAreaController",
|
||||
"DeviceTypeDevice"
|
||||
]
|
||||
"properties": {
|
||||
"area_controller_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"device_template_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"device.UpdateAreaControllerRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"network_id"
|
||||
],
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"network_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"device.UpdateDeviceRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"area_controller_id",
|
||||
"device_template_id",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"area_controller_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"device_template_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"area_controller_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"area_controller_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"device_template_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"device_template_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"location": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.PlanContentType": {
|
||||
"type": "string",
|
||||
@@ -1075,16 +1420,24 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.LoginRequest": {
|
||||
"user.HistoryResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"action_type": {
|
||||
"type": "string",
|
||||
"example": "password123"
|
||||
"example": "更新设备"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "设备更新成功"
|
||||
},
|
||||
"target_resource": {},
|
||||
"time": {
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "integer",
|
||||
"example": 101
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
@@ -1092,6 +1445,39 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.ListHistoryResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"history": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/user.HistoryResponse"
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "integer",
|
||||
"example": 100
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.LoginRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"identifier",
|
||||
"password"
|
||||
],
|
||||
"properties": {
|
||||
"identifier": {
|
||||
"description": "Identifier 可以是用户名、邮箱、手机号、微信号或飞书账号",
|
||||
"type": "string",
|
||||
"example": "testuser"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"example": "password123"
|
||||
}
|
||||
}
|
||||
},
|
||||
"user.LoginResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user