refactor(channels): centralize BillingModelSource normalization and exhaustive enum maps
- service: add normalizeBillingModelSource helper, apply in Create/GetByID/Update/List/ListAvailable outputs - handler: drop channelToResponse fallback now that service owns the default; add passthrough test - frontend: replace ternary status/billing-source lookups with Record<Enum, ...> maps so new union members fail the build - chip/table: drop local type aliases, reuse UserSupportedModel/UserPricingInterval directly - tests: assert short-circuit on ListAll error, wrap-prefix preservation, and Name-based default lookup
This commit is contained in:
@@ -61,7 +61,7 @@ import { computed, useSlots } from 'vue'
|
||||
import DataTable from '@/components/common/DataTable.vue'
|
||||
import Icon from '@/components/icons/Icon.vue'
|
||||
import SupportedModelChip from './SupportedModelChip.vue'
|
||||
import type { UserSupportedModelPricing } from '@/api/channels'
|
||||
import type { UserSupportedModel } from '@/api/channels'
|
||||
|
||||
interface GroupRef {
|
||||
id: number
|
||||
@@ -73,11 +73,8 @@ interface Row {
|
||||
name: string
|
||||
description?: string
|
||||
groups: GroupRef[]
|
||||
supported_models: Array<{
|
||||
name: string
|
||||
platform: string
|
||||
pricing: UserSupportedModelPricing | null
|
||||
}>
|
||||
// 复用 user 侧最小 DTO;admin 侧 SupportedModel 结构上是其超集,可直接传入。
|
||||
supported_models: UserSupportedModel[]
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user