This commit is contained in:
2026-08-15 11:15:00 +08:00
parent 4573b3df1c
commit e000f8bed2
4 changed files with 23 additions and 29 deletions
@@ -1,7 +1,6 @@
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
export type PlatformPartnerType = 'CUSTOMER' | 'SUPPLIER' | 'CARRIER' | 'CUSTOMS_BROKER' | 'SHIPPER' | 'CONSIGNEE'
export type PlatformPartnerLegacyType = PlatformPartnerType | 'BOTH'
export type PlatformPartnerType = 'CARRIER' | 'SHIPPER' | 'CONSIGNEE'
export type PlatformPartnerStatus = 'ACTIVE' | 'INACTIVE'
export interface PlatformPartnerResource {
@@ -10,7 +9,7 @@ export interface PlatformPartnerResource {
dataScopeId: number | string
partnerCode: string
partnerName: string
partnerType: PlatformPartnerLegacyType
partnerType: PlatformPartnerType
types: PlatformPartnerType[]
contactName: string
contactPhone: string
@@ -86,13 +85,10 @@ const basePath = '/platform/v1/partners'
const platformResourceScope = 0
function normalizePartner(resource: PlatformPartnerResource): PlatformPartnerResource {
const legacyTypes: PlatformPartnerType[] = resource.partnerType === 'BOTH'
? ['CUSTOMER', 'SUPPLIER']
: [resource.partnerType]
return {
...resource,
dataScopeId: resource.dataScopeId ?? resource.tenantId,
types: resource.types?.length ? resource.types : legacyTypes,
types: resource.types?.length ? resource.types : [resource.partnerType],
remark: resource.remark ?? null,
}
}