增加设备模板列表

This commit is contained in:
2025-09-30 22:07:55 +08:00
parent 108d496346
commit 077e866915
8 changed files with 1416 additions and 1 deletions

View File

@@ -102,6 +102,52 @@ definitions:
- device_template_id
- name
type: object
device.CreateDeviceTemplateRequest:
properties:
category:
$ref: '#/definitions/models.DeviceCategory'
commands:
additionalProperties: true
type: object
description:
type: string
manufacturer:
type: string
name:
type: string
values:
items:
$ref: '#/definitions/models.ValueDescriptor'
type: array
required:
- category
- commands
- name
type: object
device.DeviceTemplateResponse:
properties:
category:
$ref: '#/definitions/models.DeviceCategory'
commands:
additionalProperties: true
type: object
created_at:
type: string
description:
type: string
id:
type: integer
manufacturer:
type: string
name:
type: string
updated_at:
type: string
values:
items:
$ref: '#/definitions/models.ValueDescriptor'
type: array
type: object
device.UpdateAreaControllerRequest:
properties:
location:
@@ -135,6 +181,28 @@ definitions:
- device_template_id
- name
type: object
device.UpdateDeviceTemplateRequest:
properties:
category:
$ref: '#/definitions/models.DeviceCategory'
commands:
additionalProperties: true
type: object
description:
type: string
manufacturer:
type: string
name:
type: string
values:
items:
$ref: '#/definitions/models.ValueDescriptor'
type: array
required:
- category
- commands
- name
type: object
git_huangwc_com_pig_pig-farm-controller_internal_app_controller_device.DeviceResponse:
properties:
area_controller_id:
@@ -159,6 +227,14 @@ definitions:
updated_at:
type: string
type: object
models.DeviceCategory:
enum:
- actuator
- sensor
type: string
x-enum-varnames:
- CategoryActuator
- CategorySensor
models.PlanContentType:
enum:
- sub_plans
@@ -210,6 +286,32 @@ definitions:
- PlanStatusEnabled
- PlanStatusStopeed
- PlanStatusFailed
models.SensorType:
enum:
- signal_metrics
- battery_level
- temperature
- humidity
- weight
type: string
x-enum-comments:
SensorTypeBatteryLevel: 电池电量
SensorTypeHumidity: 湿度
SensorTypeSignalMetrics: 信号强度
SensorTypeTemperature: 温度
SensorTypeWeight: 重量
x-enum-descriptions:
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
x-enum-varnames:
- SensorTypeSignalMetrics
- SensorTypeBatteryLevel
- SensorTypeTemperature
- SensorTypeHumidity
- SensorTypeWeight
models.TaskType:
enum:
- plan_analysis
@@ -228,6 +330,17 @@ definitions:
- TaskPlanAnalysis
- TaskTypeWaiting
- TaskTypeReleaseFeedWeight
models.ValueDescriptor:
properties:
multiplier:
description: 乘数,用于原始数据转换
type: number
offset:
description: 偏移量,用于原始数据转换
type: number
type:
$ref: '#/definitions/models.SensorType'
type: object
plan.CreatePlanRequest:
properties:
cron_expression:
@@ -594,6 +707,125 @@ paths:
summary: 更新区域主控信息
tags:
- 区域主控管理
/api/v1/device-templates:
get:
description: 获取系统中所有设备模板的列表
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
items:
$ref: '#/definitions/device.DeviceTemplateResponse'
type: array
type: object
summary: 获取设备模板列表
tags:
- 设备模板管理
post:
consumes:
- application/json
description: 根据提供的信息创建一个新设备模板
parameters:
- description: 设备模板信息
in: body
name: deviceTemplate
required: true
schema:
$ref: '#/definitions/device.CreateDeviceTemplateRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/device.DeviceTemplateResponse'
type: object
summary: 创建新设备模板
tags:
- 设备模板管理
/api/v1/device-templates/{id}:
delete:
description: 根据设备模板ID删除一个设备模板软删除
parameters:
- description: 设备模板ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
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: OK
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/device.DeviceTemplateResponse'
type: object
summary: 获取设备模板信息
tags:
- 设备模板管理
put:
consumes:
- application/json
description: 根据设备模板ID更新一个已存在的设备模板信息
parameters:
- description: 设备模板ID
in: path
name: id
required: true
type: string
- description: 要更新的设备模板信息
in: body
name: deviceTemplate
required: true
schema:
$ref: '#/definitions/device.UpdateDeviceTemplateRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/device.DeviceTemplateResponse'
type: object
summary: 更新设备模板信息
tags:
- 设备模板管理
/api/v1/devices:
get:
description: 获取系统中所有设备的列表