refactor(rule-groups): 重命名旧 PostgREST 函数为 _legacy 后缀
重命名函数(保留作为备份): 1. getRuleGroups → getRuleGroups_legacy 2. getAllRuleGroups → getAllRuleGroups_legacy 3. createRuleGroup → createRuleGroup_legacy 4. updateRuleGroup → updateRuleGroup_legacy 5. deleteRuleGroup → deleteRuleGroup_legacy 6. batchUpdateRuleGroupStatus → batchUpdateRuleGroupStatus_legacy 7. batchDeleteRuleGroups → batchDeleteRuleGroups_legacy 变更: - 所有旧函数添加 _legacy 后缀 - 添加 @deprecated 注释指向新的 FastAPI v3 函数 - 保留旧函数作为备份,不删除 目的: - 为过渡到 FastAPI v3 接口做准备 - 保留旧代码以便回滚 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -90,10 +90,11 @@ export interface RuleGroupQueryParams {
|
||||
|
||||
/**
|
||||
* 获取评查点分组列表(支持分页、筛选、排序)
|
||||
* @deprecated 使用 getEvaluationPointGroups 代替(FastAPI v3)
|
||||
* @param params 查询参数
|
||||
* @returns 评查点分组列表和总数
|
||||
*/
|
||||
export async function getRuleGroups(
|
||||
export async function getRuleGroups_legacy(
|
||||
params?: RuleGroupQueryParams
|
||||
): Promise<{data: RuleGroup[]; totalCount?: number; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
@@ -277,10 +278,11 @@ export async function getChildGroups(parentId: string, token?: string): Promise<
|
||||
|
||||
/**
|
||||
* 获取所有评查点分组(包括一级和二级)
|
||||
* @deprecated 使用 getAllEvaluationPointGroups 代替(FastAPI v3)
|
||||
* @param token JWT token (可选)
|
||||
* @returns 完整的评查点分组列表
|
||||
*/
|
||||
export async function getAllRuleGroups(token?: string): Promise<{data: RuleGroup[]; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
export async function getAllRuleGroups_legacy(token?: string): Promise<{data: RuleGroup[]; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
// 1. 获取所有分组
|
||||
const allGroupsParams: PostgrestParams = {
|
||||
@@ -476,11 +478,12 @@ export async function getRuleGroup(id: string, token?: string): Promise<{data: R
|
||||
|
||||
/**
|
||||
* 创建评查点分组(增强版 - 包含完整验证)
|
||||
* @deprecated 使用 createEvaluationPointGroup 代替(FastAPI v3)
|
||||
* @param groupData 分组数据
|
||||
* @param token JWT token (可选)
|
||||
* @returns 创建的分组
|
||||
*/
|
||||
export async function createRuleGroup(groupData: RuleGroupCreateUpdateDto, token?: string): Promise<{data: RuleGroup; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
export async function createRuleGroup_legacy(groupData: RuleGroupCreateUpdateDto, token?: string): Promise<{data: RuleGroup; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
// ========== 1. 基本字段验证 ==========
|
||||
|
||||
@@ -610,12 +613,13 @@ export async function createRuleGroup(groupData: RuleGroupCreateUpdateDto, token
|
||||
|
||||
/**
|
||||
* 更新评查点分组(增强版 - 包含完整验证,不允许修改 pid)
|
||||
* @deprecated 使用 updateEvaluationPointGroup 代替(FastAPI v3)
|
||||
* @param id 分组ID
|
||||
* @param data 更新的分组数据
|
||||
* @param token JWT token (可选)
|
||||
* @returns 更新后的分组
|
||||
*/
|
||||
export async function updateRuleGroup(id: string, data: RuleGroupCreateUpdateDto, token?: string): Promise<{data: RuleGroup; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
export async function updateRuleGroup_legacy(id: string, data: RuleGroupCreateUpdateDto, token?: string): Promise<{data: RuleGroup; error?: never} | {data?: never; error: string; status?: number}> {
|
||||
try {
|
||||
// ========== 1. ID有效性验证 ==========
|
||||
|
||||
@@ -742,6 +746,7 @@ export async function updateRuleGroup(id: string, data: RuleGroupCreateUpdateDto
|
||||
|
||||
/**
|
||||
* 删除评查点分组(增强版 - 安全的阻止删除策略)
|
||||
* @deprecated 使用 deleteEvaluationPointGroup 代替(FastAPI v3)
|
||||
*
|
||||
* 删除策略:
|
||||
* - 如果分组下有子分组,拒绝删除,提示用户先删除子分组
|
||||
@@ -752,7 +757,7 @@ export async function updateRuleGroup(id: string, data: RuleGroupCreateUpdateDto
|
||||
* @param token JWT token (可选)
|
||||
* @returns 删除结果
|
||||
*/
|
||||
export async function deleteRuleGroup(id: string, token?: string): Promise<{success: boolean; error?: string; details?: { hasChildren: boolean; hasPoints: boolean; childCount?: number; pointCount?: number }}> {
|
||||
export async function deleteRuleGroup_legacy(id: string, token?: string): Promise<{success: boolean; error?: string; details?: { hasChildren: boolean; hasPoints: boolean; childCount?: number; pointCount?: number }}> {
|
||||
try {
|
||||
// ========== 1. ID验证 ==========
|
||||
|
||||
@@ -949,12 +954,13 @@ async function deleteEvaluationPointsByGroupId(groupId: string, token?: string):
|
||||
|
||||
/**
|
||||
* 批量更新分组状态(启用/禁用)
|
||||
* @deprecated 使用 batchUpdateEvaluationPointGroupStatus 代替(FastAPI v3)
|
||||
* @param ids 分组ID列表
|
||||
* @param is_enabled 目标状态
|
||||
* @param token JWT token (可选)
|
||||
* @returns 更新结果
|
||||
*/
|
||||
export async function batchUpdateRuleGroupStatus(
|
||||
export async function batchUpdateRuleGroupStatus_legacy(
|
||||
ids: string[],
|
||||
is_enabled: boolean,
|
||||
token?: string
|
||||
@@ -1050,11 +1056,12 @@ export async function batchUpdateRuleGroupStatus(
|
||||
|
||||
/**
|
||||
* 批量删除分组(安全的阻止删除策略)
|
||||
* @deprecated 使用 batchDeleteEvaluationPointGroups 代替(FastAPI v3)
|
||||
* @param ids 分组ID列表
|
||||
* @param token JWT token (可选)
|
||||
* @returns 删除结果
|
||||
*/
|
||||
export async function batchDeleteRuleGroups(
|
||||
export async function batchDeleteRuleGroups_legacy(
|
||||
ids: string[],
|
||||
token?: string
|
||||
): Promise<{
|
||||
|
||||
Reference in New Issue
Block a user