增加新接口定义
This commit is contained in:
		| @@ -970,6 +970,149 @@ | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "/api/v1/monitor/notifications": { | ||||
|       "get": { | ||||
|         "security": [ | ||||
|           { | ||||
|             "BearerAuth": [] | ||||
|           } | ||||
|         ], | ||||
|         "description": "根据提供的过滤条件,分页获取通知列表", | ||||
|         "produces": [ | ||||
|           "application/json" | ||||
|         ], | ||||
|         "tags": [ | ||||
|           "数据监控" | ||||
|         ], | ||||
|         "summary": "批量查询通知", | ||||
|         "parameters": [ | ||||
|           { | ||||
|             "type": "string", | ||||
|             "name": "end_time", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "enum": [ | ||||
|               7, | ||||
|               -1, | ||||
|               0, | ||||
|               1, | ||||
|               2, | ||||
|               3, | ||||
|               4, | ||||
|               5, | ||||
|               -1, | ||||
|               5, | ||||
|               6 | ||||
|             ], | ||||
|             "type": "integer", | ||||
|             "format": "int32", | ||||
|             "x-enum-varnames": [ | ||||
|               "_numLevels", | ||||
|               "DebugLevel", | ||||
|               "InfoLevel", | ||||
|               "WarnLevel", | ||||
|               "ErrorLevel", | ||||
|               "DPanicLevel", | ||||
|               "PanicLevel", | ||||
|               "FatalLevel", | ||||
|               "_minLevel", | ||||
|               "_maxLevel", | ||||
|               "InvalidLevel" | ||||
|             ], | ||||
|             "name": "level", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "enum": [ | ||||
|               "邮件", | ||||
|               "企业微信", | ||||
|               "飞书", | ||||
|               "日志" | ||||
|             ], | ||||
|             "type": "string", | ||||
|             "x-enum-varnames": [ | ||||
|               "NotifierTypeSMTP", | ||||
|               "NotifierTypeWeChat", | ||||
|               "NotifierTypeLark", | ||||
|               "NotifierTypeLog" | ||||
|             ], | ||||
|             "name": "notifier_type", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "type": "string", | ||||
|             "name": "order_by", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "type": "integer", | ||||
|             "name": "page", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "type": "integer", | ||||
|             "name": "pageSize", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "type": "string", | ||||
|             "name": "start_time", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "enum": [ | ||||
|               "发送成功", | ||||
|               "发送失败", | ||||
|               "已跳过" | ||||
|             ], | ||||
|             "type": "string", | ||||
|             "x-enum-comments": { | ||||
|               "NotificationStatusFailed": "通知发送失败", | ||||
|               "NotificationStatusSkipped": "通知因某些原因被跳过(例如:用户未配置联系方式)", | ||||
|               "NotificationStatusSuccess": "通知已成功发送" | ||||
|             }, | ||||
|             "x-enum-descriptions": [ | ||||
|               "通知已成功发送", | ||||
|               "通知发送失败", | ||||
|               "通知因某些原因被跳过(例如:用户未配置联系方式)" | ||||
|             ], | ||||
|             "x-enum-varnames": [ | ||||
|               "NotificationStatusSuccess", | ||||
|               "NotificationStatusFailed", | ||||
|               "NotificationStatusSkipped" | ||||
|             ], | ||||
|             "name": "status", | ||||
|             "in": "query" | ||||
|           }, | ||||
|           { | ||||
|             "type": "integer", | ||||
|             "name": "user_id", | ||||
|             "in": "query" | ||||
|           } | ||||
|         ], | ||||
|         "responses": { | ||||
|           "200": { | ||||
|             "description": "OK", | ||||
|             "schema": { | ||||
|               "allOf": [ | ||||
|                 { | ||||
|                   "$ref": "#/definitions/controller.Response" | ||||
|                 }, | ||||
|                 { | ||||
|                   "type": "object", | ||||
|                   "properties": { | ||||
|                     "data": { | ||||
|                       "$ref": "#/definitions/dto.ListNotificationResponse" | ||||
|                     } | ||||
|                   } | ||||
|                 } | ||||
|               ] | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "/api/v1/monitor/pending-collections": { | ||||
|       "get": { | ||||
|         "security": [ | ||||
| @@ -3918,6 +4061,64 @@ | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "/api/v1/users/{id}/notifications/test": { | ||||
|       "post": { | ||||
|         "security": [ | ||||
|           { | ||||
|             "BearerAuth": [] | ||||
|           } | ||||
|         ], | ||||
|         "description": "为指定用户发送一条特定渠道的测试消息,以验证其配置是否正确。", | ||||
|         "consumes": [ | ||||
|           "application/json" | ||||
|         ], | ||||
|         "produces": [ | ||||
|           "application/json" | ||||
|         ], | ||||
|         "tags": [ | ||||
|           "用户管理" | ||||
|         ], | ||||
|         "summary": "发送测试通知", | ||||
|         "parameters": [ | ||||
|           { | ||||
|             "type": "integer", | ||||
|             "description": "用户ID", | ||||
|             "name": "id", | ||||
|             "in": "path", | ||||
|             "required": true | ||||
|           }, | ||||
|           { | ||||
|             "description": "请求体", | ||||
|             "name": "body", | ||||
|             "in": "body", | ||||
|             "required": true, | ||||
|             "schema": { | ||||
|               "$ref": "#/definitions/dto.SendTestNotificationRequest" | ||||
|             } | ||||
|           } | ||||
|         ], | ||||
|         "responses": { | ||||
|           "200": { | ||||
|             "description": "成功响应", | ||||
|             "schema": { | ||||
|               "allOf": [ | ||||
|                 { | ||||
|                   "$ref": "#/definitions/controller.Response" | ||||
|                 }, | ||||
|                 { | ||||
|                   "type": "object", | ||||
|                   "properties": { | ||||
|                     "data": { | ||||
|                       "type": "string" | ||||
|                     } | ||||
|                   } | ||||
|                 } | ||||
|               ] | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "definitions": { | ||||
| @@ -4426,6 +4627,20 @@ | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "dto.ListNotificationResponse": { | ||||
|       "type": "object", | ||||
|       "properties": { | ||||
|         "list": { | ||||
|           "type": "array", | ||||
|           "items": { | ||||
|             "$ref": "#/definitions/dto.NotificationDTO" | ||||
|           } | ||||
|         }, | ||||
|         "pagination": { | ||||
|           "$ref": "#/definitions/dto.PaginationDTO" | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "dto.ListPendingCollectionResponse": { | ||||
|       "type": "object", | ||||
|       "properties": { | ||||
| @@ -4734,6 +4949,47 @@ | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "dto.NotificationDTO": { | ||||
|       "type": "object", | ||||
|       "properties": { | ||||
|         "alarm_timestamp": { | ||||
|           "type": "string" | ||||
|         }, | ||||
|         "created_at": { | ||||
|           "type": "string" | ||||
|         }, | ||||
|         "error_message": { | ||||
|           "type": "string" | ||||
|         }, | ||||
|         "id": { | ||||
|           "type": "integer" | ||||
|         }, | ||||
|         "level": { | ||||
|           "$ref": "#/definitions/zapcore.Level" | ||||
|         }, | ||||
|         "message": { | ||||
|           "type": "string" | ||||
|         }, | ||||
|         "notifier_type": { | ||||
|           "$ref": "#/definitions/notify.NotifierType" | ||||
|         }, | ||||
|         "status": { | ||||
|           "$ref": "#/definitions/models.NotificationStatus" | ||||
|         }, | ||||
|         "title": { | ||||
|           "type": "string" | ||||
|         }, | ||||
|         "to_address": { | ||||
|           "type": "string" | ||||
|         }, | ||||
|         "updated_at": { | ||||
|           "type": "string" | ||||
|         }, | ||||
|         "user_id": { | ||||
|           "type": "integer" | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "dto.PaginationDTO": { | ||||
|       "type": "object", | ||||
|       "properties": { | ||||
| @@ -5586,6 +5842,22 @@ | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "dto.SendTestNotificationRequest": { | ||||
|       "type": "object", | ||||
|       "required": [ | ||||
|         "type" | ||||
|       ], | ||||
|       "properties": { | ||||
|         "type": { | ||||
|           "description": "Type 指定要测试的通知渠道", | ||||
|           "allOf": [ | ||||
|             { | ||||
|               "$ref": "#/definitions/notify.NotifierType" | ||||
|             } | ||||
|           ] | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "dto.SensorDataDTO": { | ||||
|       "type": "object", | ||||
|       "properties": { | ||||
| @@ -6196,6 +6468,29 @@ | ||||
|         "ReasonTypeHealthCare" | ||||
|       ] | ||||
|     }, | ||||
|     "models.NotificationStatus": { | ||||
|       "type": "string", | ||||
|       "enum": [ | ||||
|         "发送成功", | ||||
|         "发送失败", | ||||
|         "已跳过" | ||||
|       ], | ||||
|       "x-enum-comments": { | ||||
|         "NotificationStatusFailed": "通知发送失败", | ||||
|         "NotificationStatusSkipped": "通知因某些原因被跳过(例如:用户未配置联系方式)", | ||||
|         "NotificationStatusSuccess": "通知已成功发送" | ||||
|       }, | ||||
|       "x-enum-descriptions": [ | ||||
|         "通知已成功发送", | ||||
|         "通知发送失败", | ||||
|         "通知因某些原因被跳过(例如:用户未配置联系方式)" | ||||
|       ], | ||||
|       "x-enum-varnames": [ | ||||
|         "NotificationStatusSuccess", | ||||
|         "NotificationStatusFailed", | ||||
|         "NotificationStatusSkipped" | ||||
|       ] | ||||
|     }, | ||||
|     "models.PenStatus": { | ||||
|       "type": "string", | ||||
|       "enum": [ | ||||
| @@ -6525,6 +6820,51 @@ | ||||
|           "$ref": "#/definitions/models.SensorType" | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "notify.NotifierType": { | ||||
|       "type": "string", | ||||
|       "enum": [ | ||||
|         "邮件", | ||||
|         "企业微信", | ||||
|         "飞书", | ||||
|         "日志" | ||||
|       ], | ||||
|       "x-enum-varnames": [ | ||||
|         "NotifierTypeSMTP", | ||||
|         "NotifierTypeWeChat", | ||||
|         "NotifierTypeLark", | ||||
|         "NotifierTypeLog" | ||||
|       ] | ||||
|     }, | ||||
|     "zapcore.Level": { | ||||
|       "type": "integer", | ||||
|       "format": "int32", | ||||
|       "enum": [ | ||||
|         7, | ||||
|         -1, | ||||
|         0, | ||||
|         1, | ||||
|         2, | ||||
|         3, | ||||
|         4, | ||||
|         5, | ||||
|         -1, | ||||
|         5, | ||||
|         6 | ||||
|       ], | ||||
|       "x-enum-varnames": [ | ||||
|         "_numLevels", | ||||
|         "DebugLevel", | ||||
|         "InfoLevel", | ||||
|         "WarnLevel", | ||||
|         "ErrorLevel", | ||||
|         "DPanicLevel", | ||||
|         "PanicLevel", | ||||
|         "FatalLevel", | ||||
|         "_minLevel", | ||||
|         "_maxLevel", | ||||
|         "InvalidLevel" | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|   "securityDefinitions": { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user