feat: 添加 G5 状态表同步开关,默认关闭写入功能并更新相关配置和文档
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# Change: add g5 room status sync toggle
|
||||
|
||||
## Why
|
||||
当前 G5 `room_status.room_status_moment_g5` 同步是默认启用的,但新的运行要求需要默认关闭,避免未经确认就写入状态表。
|
||||
|
||||
## What Changes
|
||||
- 新增一个环境变量开关,控制是否同步写入 G5 `room_status.room_status_moment_g5`。
|
||||
- 默认值为 `false`,即不写入该表。
|
||||
- 当开关开启时,保留现有按 `hotel_id + room_id` upsert 更新 `ip` 的行为。
|
||||
|
||||
## Impact
|
||||
- Affected specs: `openspec/specs/onoffline/spec.md`
|
||||
- Affected code: `src/config/config.js`, `src/index.js`, `.env`, `.env.example`
|
||||
@@ -0,0 +1,14 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: G5 状态表同步开关
|
||||
系统 SHALL 提供一个环境变量开关,用于控制是否向 G5 状态表 `room_status.room_status_moment_g5` 写入数据;该开关默认值 SHALL 为 `false`。
|
||||
|
||||
#### Scenario: 默认关闭
|
||||
- **GIVEN** 未设置 G5 状态表同步开关
|
||||
- **WHEN** 服务启动并处理 Kafka 消息
|
||||
- **THEN** 系统不向 `room_status.room_status_moment_g5` 写入数据
|
||||
|
||||
#### Scenario: 显式开启
|
||||
- **GIVEN** G5 状态表同步开关被设置为 `true`
|
||||
- **WHEN** 服务处理 Kafka 消息
|
||||
- **THEN** 系统恢复向 `room_status.room_status_moment_g5` 写入数据
|
||||
@@ -0,0 +1,11 @@
|
||||
## 1. Implementation
|
||||
- [x] 1.1 Add a config flag for G5 room_status synchronization.
|
||||
- [x] 1.2 Disable `room_status.room_status_moment_g5` writes by default.
|
||||
- [x] 1.3 Keep the existing upsert behavior when the flag is enabled.
|
||||
- [x] 1.4 Update environment samples to set the flag to `false`.
|
||||
|
||||
## 2. Validation
|
||||
- [x] 2.1 Run `npm run lint`.
|
||||
- [x] 2.2 Run `npm run test`.
|
||||
- [x] 2.3 Run `npm run build`.
|
||||
- [x] 2.4 Run `openspec validate add-g5-room-status-sync-toggle --strict`.
|
||||
Reference in New Issue
Block a user