chore: sync local project changes

This commit is contained in:
Shen Wei
2026-04-28 16:39:21 +08:00
parent 365caa800a
commit e4cf7f8485
27 changed files with 13691 additions and 1317 deletions

View File

@@ -3,10 +3,14 @@
# Fonrey — 统一枚举字典(ENUMS)
> **定位**:本文件是 Fonrey 全局枚举标准(Public + Tenant)的统一实现基线。
> **版本**:v2.1
> **日期**:2026-04-27
> **版本**:v2.2
> **日期**:2026-04-28
> **适用范围**:`DATA_MODEL_PUBLIC.md`、`DATA_MODEL_LOGIN.md`、`DATA_MODEL_ORG.md`、`DATA_MODEL_COMPLEX.md`、`DATA_MODEL_PROPERTY.md`、`DATA_MODEL_CLIENT.md`、`DATA_MODEL_PERMISSION.md`、`DATA_MODEL_SETTING.md`
> **⚠️ 枚举值命名规范**:所有枚举值统一使用 **`lower_snake_case`**(全小写+下划线)。
> 历史遗留大写值(`SUCCESS`/`FAILED`、`BOOLEAN`/`SCOPE`/`INTEGER`、`REPLACE`/`RESTRICT`/`GRANT`、`A_urgent`/`A_app`/`B_schema`/`C_feature`)在 v2.2 中已统一迁移为小写。
> **DB `CHECK` 约束、`enum_labels` 种子数据、前端代码须同步更新为新值**;迁移脚本须包含历史数据 UPDATE。
---
## 一、枚举分层标准(必须遵守)
@@ -58,8 +62,8 @@ Fonrey 采用两层枚举体系:
### 2.3 平台审计与备份导出
**domain**: `public.platform_audit.result`
- `SUCCESS`:成功
- `FAILED`:失败
- `success`:成功
- `failed`:失败
**domain**: `public.backup_schedule.frequency`
- `hourly`:每小时
@@ -92,7 +96,7 @@ Fonrey 采用两层枚举体系:
**domain**: `public.export_task.status`
- `pending`:待执行
- `in_progress`:执行中
- `done`:已完成
- `success`:成功(语义等价原 `done`,与 `backup_record.status` 对齐)
- `failed`:失败
### 2.4 升级与发布(Public)
@@ -102,9 +106,9 @@ Fonrey 采用两层枚举体系:
- `rollback`:回滚
**domain**: `public.upgrade_event.upgrade_type`
- `A_app`:A类应用升级
- `B_schema`:B类数据库结构升级
- `C_feature`:C类功能开关升级
- `app`:A类-应用升级(原 `A_app`)
- `schema`:B类-数据库结构升级(原 `B_schema`)
- `feature`:C类-功能开关升级(原 `C_feature`)
**domain**: `public.upgrade_event.strategy`
- `full`:全量发布
@@ -241,9 +245,9 @@ Fonrey 采用两层枚举体系:
- `recharge`:在线充值
**domain**: `permission.value_type`
- `BOOLEAN`:开关型
- `SCOPE`:范围型
- `INTEGER`:数值型
- `boolean`:开关型(原 `BOOLEAN`)
- `scope`:范围型(原 `SCOPE`)
- `integer`:数值型(原 `INTEGER`)
**domain**: `permission.role_category`
- `agent`:置业顾问
@@ -262,9 +266,9 @@ Fonrey 采用两层枚举体系:
- `company`:全公司
**domain**: `permission.override_mode`
- `REPLACE`:覆盖
- `RESTRICT`:限制
- `GRANT`:授予
- `replace`:覆盖(原 `REPLACE`)
- `restrict`:限制(原 `RESTRICT`)
- `grant`:授予(原 `GRANT`)
**domain**: `permission.data_scope_type`
- `self`:本人
@@ -394,11 +398,10 @@ Fonrey 采用两层枚举体系:
- `inconvenient`:不便看房
**domain**: `property.grade`
- `A_urgent`:A(急迫)
- `A`:A
- `B`:B(较强)
- `C`:C(一般)
- `D`:D(较弱)
- `a`:A(急迫)
- `b`:B(较强)
- `c`:C(一般)
- `d`:D(较弱)
**domain**: `property.contact.gender`
- `male`:先生
@@ -519,6 +522,21 @@ Fonrey 采用两层枚举体系:
- `public`:公客
- `invalid`:无效
> **⚠️ 合法组合约束**(`client_type` × `client.status`)
> `client_type` 表示客源的"身份类别",`status` 表示客源的"当前业务状态",两者是不同维度。
> 合法组合矩阵如下:
>
> | `client_type` | 允许的 `status` 值 | 禁止的 `status` 值 |
> |---|---|---|
> | `private`(私客) | `buying` / `renting` / `buy_or_rent` / `suspended` / `invalid` | `public`、`bought`、`rented_done`(未成交不可用终态) |
> | `public`(公客) | `public` / `buying` / `renting` / `buy_or_rent` / `suspended` / `invalid` | `bought`、`rented_done` |
> | `transacted`(成交客) | `bought` / `rented_done` | 其他所有值(终态不可逆) |
>
> **实施要求**:
> - 服务层(`ClientService`)在状态变更时必须校验组合合法性
> - DB 侧可用触发器或 `CHECK` 约束覆盖最关键禁止项(如 `transacted` + 非终态)
> - `private → public` 转换须调用专用方法 `transfer_to_public()`,同时修改 `client_type` 和 `status`
**domain**: `client.grade`
- `A`:A(急迫)
- `B`:B(较强)
@@ -697,7 +715,7 @@ Fonrey 采用两层枚举体系:
- `sale`:出售
- `rent`:出租
- `sale_rent`:租售
- `*`:全部
- `all`:全部(原设计为 `*`,因 SQL/URL/权限表达式通配误解风险已统一改为 `all`;DB CHECK 约束、前端筛选器须同步)
**domain**: `setting.field_rule.requirement`
- `required`:必填