Commit Graph

8 Commits

Author SHA1 Message Date
ryan 2000908bac feat: enhance Safew watcher initialization and token management
- Added functionality to list and start Safew tokens in the main server function, ensuring proper initialization of the Safew watcher.
- Introduced `ensureSafewWatcher` method in the ChannelHandler to manage Safew tokens during channel creation and updates.
- Implemented `StartTokens` method in the Watcher to handle multiple tokens efficiently.
- Enhanced error handling and logging for Safew watcher operations to improve observability.
2026-08-15 01:28:51 +08:00
ryan 39f3774940 feat: 配置列表分页与钉钉机器人分钟级排队限流
统一 sources/templates/channels/rules 列表为分页响应,避免配置增多时全量返回;按钉钉 access_token 限制每分钟发送并在超限时等待下一分钟,降低触发官方封禁风险。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 00:34:26 +08:00
ryan c74bab3033 fix(数据存储): 确保列表查询返回空数组而非 null,并补充 HTTPie/Postman API 文档
Motivation:
当数据库查询无结果时,Go 的 `var slice []Type` 声明会使 JSON 序列化输出 `null`,而非 `[]`。这在 API 响应中造成不一致,也增加了客户端的空值处理负担。改为 `make([]Type, 0)` 后空结果统一输出为 `[]`,提升 API 规范性。

Changes:

* 统一 store 层所有 List 方法使用 `make([]Type, 0)` 初始化切片,覆盖 Sources、Channels、Templates、Rules、MessageLogs 及 RuleChannels 查询
* 新增完整的 cURL 示例文档,覆盖全部 API 端点(通知、Source、Template、Channel、Rule、消息记录)
* 新增 Postman Collection JSON 文件,可直接导入 HTTPie 使用,包含环境变量配置
2026-07-31 22:09:39 +08:00
ryan a0d26fa3a3 refactor: rename database tables for notification entities to improve clarity and consistency 2026-07-02 16:04:18 +08:00
ryan d030f0f0df fix: error handling in rule store 2026-06-27 13:09:34 +08:00
ryan a8e939da40 feat: rule and message_log store CRUD 2026-06-27 13:06:54 +08:00
ryan 236105ea9c feat: template and channel store CRUD 2026-06-27 13:04:57 +08:00
ryan 7cd84c8468 feat: store connection and source CRUD 2026-06-27 13:02:17 +08:00