feat: add mojia sku sync admin page
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
||||
|
||||
export type MojiaSkuSyncStatus = 'PENDING' | 'SYNCING' | 'SUCCESS' | 'FAILED'
|
||||
|
||||
export interface MojiaSkuSyncRecord {
|
||||
id: string
|
||||
skuCode: string
|
||||
lengthCm: number
|
||||
widthCm: number
|
||||
heightCm: number
|
||||
weightKg: number
|
||||
imageFileId?: string | null
|
||||
imageUrl?: string | null
|
||||
measuredAt?: string | null
|
||||
receivedAt?: string | null
|
||||
syncStatus: MojiaSkuSyncStatus
|
||||
syncFailureCode?: string | null
|
||||
syncFailureReason?: string | null
|
||||
lingxingSkuId?: string | null
|
||||
revision: number
|
||||
updatedAt?: string | null
|
||||
}
|
||||
|
||||
export interface MojiaSkuSyncPage {
|
||||
records: MojiaSkuSyncRecord[]
|
||||
page: number
|
||||
size: number
|
||||
total: number
|
||||
pages: number
|
||||
}
|
||||
|
||||
export interface MojiaSkuSyncQuery {
|
||||
page: number
|
||||
size: number
|
||||
skuCode?: string
|
||||
syncStatus?: MojiaSkuSyncStatus
|
||||
}
|
||||
|
||||
const basePath = '/platform/v1/firstleg/mojia-sku-sync'
|
||||
|
||||
export async function listMojiaSkuSync(query: MojiaSkuSyncQuery) {
|
||||
const response = await http.get<ApiEnvelope<MojiaSkuSyncPage>, ApiEnvelope<MojiaSkuSyncPage>>(
|
||||
basePath, { params: query },
|
||||
)
|
||||
return unwrapApiResponse(response)
|
||||
}
|
||||
|
||||
export async function updateMojiaSkuSync(id: string, data: {
|
||||
skuCode: string
|
||||
lengthCm: number
|
||||
widthCm: number
|
||||
heightCm: number
|
||||
weightKg: number
|
||||
revision: number
|
||||
}) {
|
||||
const response = await http.put<ApiEnvelope<MojiaSkuSyncRecord>, ApiEnvelope<MojiaSkuSyncRecord>>(
|
||||
`${basePath}/${encodeURIComponent(id)}`, data,
|
||||
)
|
||||
return unwrapApiResponse(response)
|
||||
}
|
||||
|
||||
export async function retryMojiaSkuSync(id: string, revision: number) {
|
||||
const response = await http.post<ApiEnvelope<MojiaSkuSyncRecord>, ApiEnvelope<MojiaSkuSyncRecord>>(
|
||||
`${basePath}/${encodeURIComponent(id)}/retry`, { revision },
|
||||
)
|
||||
return unwrapApiResponse(response)
|
||||
}
|
||||
Reference in New Issue
Block a user