fix: require appointment cancellation reason and expose history
This commit is contained in:
@@ -42,10 +42,32 @@ export async function listArrivalCalendar(query: { from: string; to: string }, s
|
||||
return unwrapApiResponse(response)
|
||||
}
|
||||
|
||||
export async function deleteAppointment(appointmentNo: string, version: number) {
|
||||
export async function deleteAppointment(appointmentNo: string, version: number, cancelReason: string) {
|
||||
const response = await http.delete<ApiEnvelope<void>, ApiEnvelope<void>>(
|
||||
`/platform/v1/last-leg/inbound-plans/fba-appointments/${encodeURIComponent(appointmentNo)}`,
|
||||
{ params: { version } },
|
||||
{ data: { version, cancelReason } },
|
||||
)
|
||||
return unwrapApiResponse(response)
|
||||
}
|
||||
|
||||
export interface AppointmentCancellation {
|
||||
appointmentNo: string; version: number; cancelReason: string | null; cancelledAt: string
|
||||
snapshot: { fbaWarehouseCode: string; appointmentStatus: string; appointmentRemark: string | null;
|
||||
plannedDate: string | null; plannedAt: string | null; plannedEndAt: string | null;
|
||||
confirmationNo: string | null; appointmentAt: string | null; appointmentEndAt: string | null;
|
||||
timezone: string | null; selectedCount: number }
|
||||
}
|
||||
export async function listAppointmentCancellations(appointmentNo: string, page: number, size: number) {
|
||||
const result = unwrapApiResponse(await http.get<ApiEnvelope<{records: AppointmentCancellation[]; total: number}>, ApiEnvelope<{records: AppointmentCancellation[]; total: number}>>(
|
||||
`/platform/v1/last-leg/inbound-plans/fba-appointments/${encodeURIComponent(appointmentNo)}/cancellations`, {params: {page, size}},
|
||||
))
|
||||
return {...result, total: Number(result.total)}
|
||||
}
|
||||
|
||||
export type AppointmentCancellationSummary = Omit<AppointmentCancellation, 'snapshot'> & {fbaWarehouseCode: string; selectedCount: number}
|
||||
export async function listAppointmentCancellationRecords(page: number, size: number) {
|
||||
const result = unwrapApiResponse(await http.get<ApiEnvelope<{records: AppointmentCancellationSummary[]; total: number}>, ApiEnvelope<{records: AppointmentCancellationSummary[]; total: number}>>(
|
||||
'/platform/v1/last-leg/inbound-plans/fba-appointments/cancellations', {params: {page, size}},
|
||||
))
|
||||
return {...result, total: Number(result.total)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user